2024-06-11 00:24:12 +00:00
|
|
|
const assproc = require('@railcomm/assproc');
|
|
|
|
const { join: pathJoin } = require('path');
|
2023-10-13 18:08:45 +00:00
|
|
|
const fs = require('fs');
|
|
|
|
|
|
|
|
(async () => {
|
2024-06-11 00:24:12 +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: 'es2020',
|
|
|
|
},
|
|
|
|
};
|
2024-04-24 01:12:54 +00:00
|
|
|
|
2024-06-11 00:24:12 +00:00
|
|
|
const tasks = {
|
|
|
|
js: [
|
|
|
|
{ source: 'makai.js', target: '/assets', name: 'makai.{hash}.js', },
|
|
|
|
],
|
|
|
|
css: [
|
|
|
|
{ source: 'errors.css', target: '/', name: 'errors.css', },
|
|
|
|
{ source: 'makai.css', target: '/assets', name: 'makai.{hash}.css', },
|
|
|
|
],
|
|
|
|
twig: [
|
|
|
|
{ source: 'errors/401', target: '/', name: 'error-401.html', },
|
|
|
|
{ source: 'errors/403', target: '/', name: 'error-403.html', },
|
|
|
|
{ source: 'errors/404', target: '/', name: 'error-404.html', },
|
|
|
|
{ source: 'errors/500', target: '/', name: 'error-500.html', },
|
|
|
|
{ source: 'errors/503', target: '/', name: 'error-503.html', },
|
|
|
|
],
|
|
|
|
};
|
2024-04-24 01:12:54 +00:00
|
|
|
|
2024-06-11 00:24:12 +00:00
|
|
|
const files = await assproc.process(env, tasks);
|
2024-04-24 01:12:54 +00:00
|
|
|
|
2024-06-11 00:24:12 +00:00
|
|
|
fs.writeFileSync(pathJoin(__dirname, 'assets/current.json'), JSON.stringify(files));
|
2023-10-13 18:08:45 +00:00
|
|
|
})();
|