From 565a411a3b0f7f975ff36212a9a91310513a4611 Mon Sep 17 00:00:00 2001 From: cenfun Date: Sat, 2 Dec 2023 18:17:22 +0800 Subject: [PATCH] update docs --- package.json | 4 ++-- scripts/build-docs.js | 2 ++ scripts/conf.cli.js | 7 +++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c61a9582..1f147699 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "build-istanbul": "npx webpack --config mock/webpack.config-istanbul.js", "build-v8": "npx webpack --config mock/webpack.config-v8.js", "test": "node ./tests/test.js", - "build": "sf lint && sf b -p", + "build": "sf lint && sf b -p && npm run build-docs", "dev": "sf d v8", "build-docs": "node ./scripts/build-docs.js", "patch": "npm run build && sf publish patch -r" @@ -60,4 +60,4 @@ "webpack": "^5.89.0", "webpack-cli": "^5.1.4" } -} +} \ No newline at end of file diff --git a/scripts/build-docs.js b/scripts/build-docs.js index e801e5a4..c5f9a3a0 100644 --- a/scripts/build-docs.js +++ b/scripts/build-docs.js @@ -7,6 +7,8 @@ const Util = require('../lib/utils/util.js'); const buildDocs = () => { + console.log('build docs ...'); + // copy css const cssDir = path.resolve(__dirname, '../docs/assets'); if (!fs.existsSync(cssDir)) { diff --git a/scripts/conf.cli.js b/scripts/conf.cli.js index 6487954a..b8485f9b 100644 --- a/scripts/conf.cli.js +++ b/scripts/conf.cli.js @@ -17,6 +17,13 @@ const beforeV8 = (item, Util) => { } const jsPath = path.resolve(item.buildPath, dataFile); + const distDir = path.dirname(jsPath); + if (!fs.existsSync(distDir)) { + fs.mkdirSync(distDir, { + recursive: true + }); + } + fs.copyFileSync(jsDataPath, jsPath); EC.logGreen(`coverage data file copied: ${dataFile}`);