12 lines
627 B
JavaScript
12 lines
627 B
JavaScript
import fs from 'node:fs';
|
|
import { spawnSync } from 'node:child_process';
|
|
const modules = ['normalize.mjs', 'summary.mjs', 'render.mjs', 'cli.mjs'];
|
|
for (const name of modules) {
|
|
const check = spawnSync(process.execPath, ['--check', 'src/' + name], { encoding: 'utf8', windowsHide: true });
|
|
if (check.status !== 0) { process.stderr.write(check.stderr); process.exit(1); }
|
|
}
|
|
fs.mkdirSync('dist', { recursive: true });
|
|
for (const name of modules) fs.copyFileSync('src/' + name, 'dist/' + name);
|
|
fs.writeFileSync('dist/package.json', '{"type":"module"}\n');
|
|
console.log('四个模块语法检查及可运行构建完成。');
|