allow building only specific games
This commit is contained in:
parent
f1db68390a
commit
d2fcdfc825
2 changed files with 14 additions and 1 deletions
|
@ -65,6 +65,7 @@ Building
|
|||
Notes:
|
||||
- using `gulp build watch` instead of `gulp build` makes *gulp* start watching files after the build. Whenever a file is changed, a build is automatically generated
|
||||
- you can use `--no-default-games` to prevent including the game modules from directory, and `--modules <colon-separated-directories>` to specify additional game modules to include. For instance, `gulp --no-default-games --modules src/games/chessbase:src/games/checkers build` will only generate distribution for Chess and checkers games
|
||||
- you can specify the games to be built in the distribution with the `--games` option. For instance, `gulp --no-default-games --modules src/games --games xiangqi:classic-chess build` only generates Jocly for Classic Chess and XiangQi
|
||||
|
||||
API Documentation
|
||||
-----------------
|
||||
|
|
14
gulpfile.js
14
gulpfile.js
|
@ -43,6 +43,7 @@ const allGames = {};
|
|||
|
||||
var moduleDirs = [];
|
||||
var modulesMap = {};
|
||||
var exclusiveGames = null;
|
||||
|
||||
if (typeof argv.defaultGames == "undefined" || argv.defaultGames)
|
||||
moduleDirs = fs.readdirSync("src/games").map((dir) => {
|
||||
|
@ -54,6 +55,13 @@ moduleDirs.forEach((dir) => {
|
|||
modulesMap[path.basename(dir)] = dir;
|
||||
});
|
||||
|
||||
if (argv.games) {
|
||||
exclusiveGames = {};
|
||||
argv.games.split(":").forEach((game) => {
|
||||
exclusiveGames[game] = true;
|
||||
});
|
||||
}
|
||||
|
||||
function HandleModuleGames(modelOnly) {
|
||||
|
||||
return through.obj(function (file, enc, next) {
|
||||
|
@ -65,6 +73,9 @@ function HandleModuleGames(modelOnly) {
|
|||
moduleManifest.games.forEach((game) => {
|
||||
// this is executed for every game in the game module
|
||||
|
||||
if (exclusiveGames && !exclusiveGames[game.name])
|
||||
return;
|
||||
|
||||
// same some game data so we can list all games later
|
||||
allGames[game.name] = {
|
||||
title: game.config.model["title-en"],
|
||||
|
@ -352,7 +363,8 @@ commands:
|
|||
options:
|
||||
--prod: generate for production
|
||||
--no-default-games: do not process game module from default src/games directory
|
||||
--modules: process additional game modules from specified directories (colon separated)
|
||||
--modules <modules>: process additional game modules from specified directories (colon separated)
|
||||
--games <games>: process exclusively the specified games (colon separated)
|
||||
`;
|
||||
console.log(help);
|
||||
process.exit(0);
|
||||
|
|
Loading…
Reference in a new issue