From 18d512b4c72ff87be1158c680696cceec2833323 Mon Sep 17 00:00:00 2001 From: Chandler Prall Date: Fri, 22 Jun 2018 12:40:05 -0600 Subject: [PATCH] moved No interface changes sanity check to release script --- scripts/release.js | 20 +++++++++++++------- scripts/update-changelog-version.js | 6 ------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/scripts/release.js b/scripts/release.js index 747159773b18..0f68a6cff9ec 100644 --- a/scripts/release.js +++ b/scripts/release.js @@ -20,28 +20,28 @@ const humanReadableTypes = { (async function () { // ensure git is on the master branch - // await ensureMasterBranch(); + await ensureMasterBranch(); // run linting and unit tests - // execSync('npm test', execOptions); + execSync('npm test', execOptions); // (trans|com)pile `src` into `lib` and `dist` - // execSync('npm run build', execOptions); + execSync('npm run build', execOptions); // prompt user for what type of version bump to make (major|minor|patch) const versionTarget = await getVersionTypeFromChangelog(); // update package.json & package-lock.json version, git commit, git tag - execSync(`npm --no-git-tag-version version ${versionTarget}`, execOptions); + execSync(`npm version ${versionTarget}`, execOptions); // push the version commit & tag to upstream - // execSync('git push upstream --tags', execOptions); + execSync('git push upstream --tags', execOptions); // publish new version to npm - // execSync('npm publish', execOptions); + execSync('npm publish', execOptions); // update docs, git commit, git push - // execSync('npm run sync-docs', execOptions); + execSync('npm run sync-docs', execOptions); }()).catch(e => console.error(e)); async function ensureMasterBranch() { @@ -60,6 +60,12 @@ async function getVersionTypeFromChangelog() { const changelog = fs.readFileSync(pathToChangelog).toString(); + // Sanity check, if the changelog contains "No public interface changes"then we shouldn't be releasing + if (changelog.indexOf('No public interface changes') !== -1) { + console.error(`Unable to release: CHANGELOG.md indicates "No public interface changes"`); + process.exit(1); + } + // get contents between the first two headings // changelog headings always use ##, this matches: // diff --git a/scripts/update-changelog-version.js b/scripts/update-changelog-version.js index e6702e2bd3ca..8307e3d6538a 100644 --- a/scripts/update-changelog-version.js +++ b/scripts/update-changelog-version.js @@ -17,12 +17,6 @@ if (changelogContents.indexOf(masterHeading) !== 0) { process.exit(1); } -// sanity check, if there are "No public interface changes" then what are we releasing? -if (changelogContents.indexOf("No public interface changes") !== -1) { - console.error(`Cannot update CHANGELOG.md: "No public interface changes"`); - process.exit(1); -} - // Insert the changelog template after the master header changelogContents = changelogContents.replace( masterHeading,