diff --git a/package.json b/package.json index 28a950f7926..f03dfb493dc 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "rollup": "dist/bin/rollup" }, "scripts": { - "build": "shx rm -rf dist && git rev-parse HEAD > .commithash && rollup --config rollup.config.ts --configPlugin typescript && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup", + "build": "shx rm -rf dist && node scripts/update-git-commit.js && rollup --config rollup.config.ts --configPlugin typescript && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup", "build:cjs": "shx rm -rf dist && rollup --config rollup.config.ts --configPlugin typescript --configTest && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup", "build:bootstrap": "node dist/bin/rollup --config rollup.config.ts --configPlugin typescript && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup", "ci:lint": "npm run lint:nofix", @@ -22,10 +22,9 @@ "perf": "npm run build:cjs && node --expose-gc scripts/perf.js", "perf:debug": "node --inspect-brk scripts/perf-debug.js", "perf:init": "node scripts/perf-init.js", - "postinstall": "husky install", - "postpublish": "pinst --enable && git push && git push --tags", + "postpublish": "git push && git push --tags", "prepare": "husky install && npm run build", - "prepublishOnly": "pinst --disable && npm ci && npm run lint:nofix && npm run security && npm run build:bootstrap && npm run test:all", + "prepublishOnly": "npm ci && npm run lint:nofix && npm run security && npm run build:bootstrap && npm run test:all", "security": "npm audit", "test": "npm run build && npm run test:all", "test:cjs": "npm run build:cjs && npm run test:only", @@ -97,7 +96,6 @@ "magic-string": "^0.25.7", "mocha": "^9.2.1", "nyc": "^15.1.0", - "pinst": "^3.0.0", "prettier": "^2.5.1", "pretty-bytes": "^5.6.0", "pretty-ms": "^7.0.1", diff --git a/scripts/update-git-commit.js b/scripts/update-git-commit.js new file mode 100644 index 00000000000..2f167f35d27 --- /dev/null +++ b/scripts/update-git-commit.js @@ -0,0 +1,12 @@ +const { execSync } = require('child_process'); +const { writeFileSync } = require('fs'); +const { join } = require('path'); + +let revision; +try { + revision = execSync('git rev-parse HEAD').toString().trim(); +} catch (e) { + console.warn('Could not determine git commit when building Rollup.'); + revision = '(could not be determined)'; +} +writeFileSync(join(__dirname, '../.commithash'), revision);