diff --git a/build.js b/build.js index 06885966..088cdccd 100644 --- a/build.js +++ b/build.js @@ -41,10 +41,20 @@ const fs = require('fs'); ], }; - const files = await assproc.process(env, tasks); + const infoPath = process.env.ASSET_INFO_PATH ?? pathJoin(__dirname, 'assets/current.json'); + let files = {}; - fs.writeFileSync( - pathJoin(__dirname, 'assets/current.json'), - JSON.stringify(files), - ); + if(process.argv.length > 2) { + files = JSON.parse(fs.readFileSync(infoPath)); + + const filter = process.argv.slice(2); + for(const name in tasks) + if(!filter.includes(name)) + delete tasks[name]; + } + + fs.writeFileSync(infoPath, JSON.stringify({ + ...files, + ...await assproc.process(env, tasks), + })); })();