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}`);