diff --git a/check_publish_env.js b/check_publish_env.js new file mode 100644 index 0000000000..ce6f066cff --- /dev/null +++ b/check_publish_env.js @@ -0,0 +1,4 @@ +if (!process.env.PUBLISH) { + console.error('npm publish must be run with the PUBLISH environment variable set'); + process.exit(1); +} diff --git a/package.json b/package.json index 333838e69d..5b04c3e82e 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,7 @@ "dev": "rollup -cw", "pretest": "npm run build", "posttest": "agadoo internal/index.mjs", - "prepublishOnly": "npm run lint && PUBLISH=true npm test", + "prepublishOnly": "node check_publish_env.js && npm run lint && npm test", "tsd": "tsc -p src/compiler --emitDeclarationOnly && tsc -p src/runtime --emitDeclarationOnly", "lint": "eslint \"{src,test}/**/*.{ts,js}\"" },