diff --git a/README.md b/README.md index 42ac0c6..918e6ae 100644 --- a/README.md +++ b/README.md @@ -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 ` 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 ----------------- diff --git a/gulpfile.js b/gulpfile.js index 3991d4b..24dad1a 100644 --- a/gulpfile.js +++ b/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 : process additional game modules from specified directories (colon separated) + --games : process exclusively the specified games (colon separated) `; console.log(help); process.exit(0);