midscene/packages/web-integration/report-script.mjs
Zhou xiao 1c15fd691a
fix(web-report): modified the report generation command to fix the report generation failure (#20)
* chore: update report logic

* chore: update report logic

* chore: update report logic

* chore: update report logic
2024-08-01 19:28:30 +08:00

17 lines
675 B
JavaScript

import path from 'node:path';
import os from 'os';
import fsExtra from 'fs-extra';
const projectDir = process.cwd();
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`);
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);