misuzu/build.js

31 lines
816 B
JavaScript
Raw Permalink Normal View History

2024-06-11 00:48:44 +00:00
const assproc = require('@railcomm/assproc');
const { join: pathJoin } = require('path');
const fs = require('fs');
(async () => {
2024-06-11 00:48:44 +00:00
const isDebug = fs.existsSync(pathJoin(__dirname, '.debug'));
const env = {
root: __dirname,
source: pathJoin(__dirname, 'assets'),
public: pathJoin(__dirname, 'public'),
debug: isDebug,
swc: {
es: 'es2021',
},
};
2024-01-24 18:24:40 +00:00
2024-06-11 00:48:44 +00:00
const tasks = {
js: [
{ source: 'misuzu.js', target: '/assets', name: 'misuzu.{hash}.js', },
],
css: [
{ source: 'misuzu.css', target: '/assets', name: 'misuzu.{hash}.css', },
],
};
2024-01-24 18:24:40 +00:00
2024-06-11 00:48:44 +00:00
const files = await assproc.process(env, tasks);
2024-06-11 00:48:44 +00:00
fs.writeFileSync(pathJoin(__dirname, 'assets/current.json'), JSON.stringify(files));
})();