48 lines
2 KiB
JavaScript
48 lines
2 KiB
JavaScript
const assproc = require('@railcomm/assproc');
|
|
const { join: pathJoin } = require('path');
|
|
const fs = require('fs');
|
|
|
|
(async () => {
|
|
const isDebug = fs.existsSync(pathJoin(__dirname, '.debug'));
|
|
|
|
const env = {
|
|
root: __dirname,
|
|
source: pathJoin(__dirname, 'assets'),
|
|
public: pathJoin(__dirname, 'public'),
|
|
debug: isDebug,
|
|
swc: {
|
|
es: 'es2021',
|
|
jsx: '$jsx',
|
|
},
|
|
};
|
|
|
|
const tasks = {
|
|
js: [
|
|
{ source: 'common.js', target: '/assets', name: 'common.{hash}.js', },
|
|
{ source: 'misuzu.js', target: '/assets', name: 'misuzu.{hash}.js', },
|
|
{ source: 'oauth2.js', target: '/assets', name: 'oauth2.{hash}.js', },
|
|
{ source: 'redir-bsky.js', target: '/assets', name: 'redir-bsky.{hash}.js', },
|
|
{ source: 'redir-fedi.js', target: '/assets', name: 'redir-fedi.{hash}.js', },
|
|
],
|
|
css: [
|
|
{ source: 'errors.css', target: '/', name: 'errors.css', },
|
|
{ source: 'common.css', target: '/assets', name: 'common.{hash}.css', },
|
|
{ source: 'misuzu.css', target: '/assets', name: 'misuzu.{hash}.css', },
|
|
{ source: 'oauth2.css', target: '/assets', name: 'oauth2.{hash}.css', },
|
|
],
|
|
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', },
|
|
],
|
|
};
|
|
|
|
const files = await assproc.process(env, tasks);
|
|
|
|
fs.writeFileSync(pathJoin(__dirname, 'assets/current.json'), JSON.stringify(files));
|
|
})();
|