41 lines
1.5 KiB
JavaScript
41 lines
1.5 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',
|
|
},
|
|
};
|
|
|
|
const tasks = {
|
|
js: [
|
|
{ source: 'hanyuu.js', target: '/assets', name: 'hanyuu.{hash}.js', },
|
|
{ source: 'oauth2.js', target: '/assets', name: 'oauth2.{hash}.js', },
|
|
],
|
|
css: [
|
|
{ source: 'errors.css', target: '/', name: 'errors.css', },
|
|
{ source: 'hanyuu.css', target: '/assets', name: 'hanyuu.{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/500', target: '/', name: 'error-500.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));
|
|
})();
|