2024-08-04 08:28:19 +08:00
|
|
|
import os from 'node:os';
|
2024-08-01 19:28:30 +08:00
|
|
|
import path from 'node:path';
|
|
|
|
|
import fsExtra from 'fs-extra';
|
|
|
|
|
|
|
|
|
|
const projectDir = process.cwd();
|
2024-08-04 08:28:19 +08:00
|
|
|
const reportHtmlDir = path.join(
|
|
|
|
|
projectDir,
|
|
|
|
|
'node_modules/@midscene/visualizer-report/dist',
|
|
|
|
|
);
|
|
|
|
|
const distPath = path.join(projectDir, 'dist/visualizer-report');
|
|
|
|
|
const distPublicPath = path.join(projectDir, 'dist/visualizer-report/public');
|
2024-08-01 19:28:30 +08:00
|
|
|
|
|
|
|
|
const tempDir = path.join(os.tmpdir(), 'temp-folder');
|
|
|
|
|
|
|
|
|
|
// First copy to the temporary directory
|
|
|
|
|
fsExtra.copySync(reportHtmlDir, tempDir);
|
|
|
|
|
// Then move the contents of the temporary directory to the destination directory
|
|
|
|
|
fsExtra.moveSync(tempDir, distPath, { overwrite: true });
|
|
|
|
|
fsExtra.emptyDirSync(distPublicPath);
|