123456789101112131415161718192021222324 |
- import fs from 'fs-extra';
- import ch from 'child_process';
- const SCENE = process.env.VITE_APP_SCENE;
- fs.ensureDirSync('.temp');
- fs.emptyDirSync('.temp');
- const distDir = `build${SCENE ? '/' + SCENE : ''}`;
- ch.execSync(`pnpm build${SCENE ? ':' + SCENE : ''}:test`, {
- stdio: ['ignore', 'inherit', 'inherit'],
- });
- const distFiles = fs.readdirSync(distDir);
- if (!distFiles.length) throw new Error(`请先执行 pnpm ${distDir}`);
- distFiles.forEach((fileName) => {
- fs.copySync(
- `${distDir}/${fileName}`,
- `.temp/${fileName === 'resources' ? fileName : 'data/' + fileName}`
- );
- });
|