assayo/scripts/remove-hash.js

18 lines
605 B
JavaScript
Raw Normal View History

2024-05-03 08:34:46 +00:00
const fs = require('node:fs');
const { exec } = require('node:child_process');
exec([
'mv ../build/static/js/main.*.js ../build/static/index.js',
'rm -rf ../build/static/js',
'mv ../build/static/css/main.*.css ../build/static/index.css',
'rm -rf ../build/static/css',
'rm ../build/asset-manifest.json',
'rm ../build/test.txt',
].join(' && '));
const html = fs.readFileSync('../build/index.html', 'utf8');
const text = html
.replace(/static\/js\/[a-z0-9.]+/gim, 'static/index.js')
.replace(/static\/css\/[a-z0-9.]+/gim, 'static/index.css');
fs.writeFileSync('../build/index.html', text);