From 31d5a5a6996bb99b2107f3aeb18748c3146550e2 Mon Sep 17 00:00:00 2001 From: Chandler Prall Date: Mon, 25 Jun 2018 14:12:46 -0600 Subject: [PATCH] Add check to release script to run only within npm --- scripts/release.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/release.js b/scripts/release.js index 7c117cadf855..e5f0b141c5ff 100644 --- a/scripts/release.js +++ b/scripts/release.js @@ -19,6 +19,14 @@ const humanReadableTypes = { }; (async function () { + // make sure the release script is being run by npm (required for `npm publish` step) + // https://github.com/yarnpkg/yarn/issues/5063 + const packageManagerScript = path.basename(process.env.npm_execpath); + if (packageManagerScript !== 'npm-cli.js') { + console.error('The release script must be run with npm: npm run release'); + process.exit(1); + } + // ensure git is on the master branch await ensureMasterBranch();