Allow filtering to a specific type of asset task.
This commit is contained in:
parent
99e3e3111a
commit
0d8283495d
1 changed files with 15 additions and 5 deletions
20
build.js
20
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),
|
||||
}));
|
||||
})();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue