From ad1cc7c8b5a9e28dc1b338ad57ebebff2191978b Mon Sep 17 00:00:00 2001 From: tanhauhau Date: Thu, 13 Oct 2022 20:00:56 +0800 Subject: [PATCH] skip prepare flag --- .github/workflows/ci.yml | 12 +++++++++--- package.json | 2 +- scripts/skip_in_ci.js | 7 +++++++ 3 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 scripts/skip_in_ci.js diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1639a4f5e3..337d2a89fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,9 @@ jobs: with: node-version: 16 cache: npm - - run: npm install --ignore-scripts + - run: npm install + env: + SKIP_PREPARE: true - run: npm run build env: PUBLISH: true @@ -64,7 +66,9 @@ jobs: store/ transition/ types/ - - run: npm install --ignore-scripts + - run: npm install + env: + SKIP_PREPARE: true - run: npm test env: CI: true @@ -88,5 +92,7 @@ jobs: - uses: actions/setup-node@v2 with: cache: npm - - run: npm install --ignore-scripts + - run: npm install + env: + SKIP_PREPARE: true - run: npm run test:unit diff --git a/package.json b/package.json index 1fcbc8e48e..40c8957b17 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,7 @@ "test:unit": "mocha --config .mocharc.unit.js --exit", "quicktest": "mocha --exit", "build": "rollup -c && npm run tsd", - "prepare": "npm run build", + "prepare": "node scripts/skip_in_ci.js npm run build", "dev": "rollup -cw", "posttest": "agadoo internal/index.mjs", "prepublishOnly": "node check_publish_env.js && npm run lint && npm run build && npm test", diff --git a/scripts/skip_in_ci.js b/scripts/skip_in_ci.js new file mode 100644 index 0000000000..d845d000ab --- /dev/null +++ b/scripts/skip_in_ci.js @@ -0,0 +1,7 @@ +if (process.env.SKIP_PREPARE) { + console.log('Skipped "prepare" script'); +} else { + const { execSync } = require("child_process"); + const command = process.argv.slice(2).join(" "); + execSync(command, { stdio: "inherit" }); +}