You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import fs from 'fs-extra';
|
|
|
|
import { path } from '@tycrek/joint';
|
|
|
|
import { TLog } from '@tycrek/log';
|
|
|
|
const log = new TLog();
|
|
|
|
|
|
|
|
const FILES = {
|
|
|
|
prefix: 'dist/frontend',
|
|
|
|
suffix: '.mjs',
|
|
|
|
pages: [
|
|
|
|
'setup',
|
|
|
|
'login',
|
|
|
|
'admin',
|
|
|
|
'user',
|
|
|
|
]
|
|
|
|
};
|
|
|
|
|
|
|
|
const fixFile = (page) => {
|
|
|
|
const filePath = path.join(FILES.prefix, `${page}${FILES.suffix}`);
|
|
|
|
const fixed = fs.readFileSync(filePath).toString().replace('export {};', '');
|
|
|
|
|
|
|
|
return fs.writeFile(filePath, fixed);
|
|
|
|
};
|
|
|
|
|
|
|
|
log.info('Fixing frontend JS', `${FILES.pages.length} files`);
|
|
|
|
Promise.all(FILES.pages.map(fixFile))
|
|
|
|
.then(() => log.success('Fixed.'))
|
|
|
|
.catch(console.error);
|
|
|
|
|