misuzu/build.js

44 lines
1.7 KiB
JavaScript
Raw 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', },
2025-01-29 21:07:12 +00:00
{ source: 'redir-bsky.js', target: '/assets', name: 'redir-bsky.{hash}.js', },
{ source: 'redir-fedi.js', target: '/assets', name: 'redir-fedi.{hash}.js', },
2024-06-11 00:48:44 +00:00
],
css: [
2025-01-30 14:52:01 +00:00
{ source: 'errors.css', target: '/', name: 'errors.css', },
2024-06-11 00:48:44 +00:00
{ source: 'misuzu.css', target: '/assets', name: 'misuzu.{hash}.css', },
],
2025-01-30 14:52:01 +00:00
twig: [
{ source: 'errors/400', target: '/', name: 'error-400.html', },
{ 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/405', target: '/', name: 'error-405.html', },
{ source: 'errors/500', target: '/', name: 'error-500.html', },
{ source: 'errors/502', target: '/', name: 'error-502.html', },
{ source: 'errors/503', target: '/', name: 'error-503.html', },
],
2024-06-11 00:48:44 +00:00
};
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));
})();