From 0d8283495dc04ffdd543384f81fc99aafe845d9e Mon Sep 17 00:00:00 2001 From: flashwave <me@flash.moe> Date: Fri, 11 Apr 2025 18:15:50 +0000 Subject: [PATCH] Allow filtering to a specific type of asset task. --- build.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) 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), + })); })();