From 77ecc5631784e7acd84d6c0d3afc89802e899803 Mon Sep 17 00:00:00 2001 From: Youcef Mammar Date: Tue, 16 Apr 2019 17:55:16 +0200 Subject: [PATCH] fix(tools): use commonjs in bump-package-version.js It seems before 92966391b1b2d2870827f164f1046d9a0c544efb the script was run in developement env with no modules setting, which mean it defaulted to the poorly documented `auto`. Looking at their codebase it seems `auto` is simply `commonjs`. This explains why it worked before. We could have used BABEL_ENV=cjs in front of the babel-node command but I've moved this file to cjs as it's more simple and is consistent with other release scripts. --- scripts/release/bump-package-version.js | 10 +++++----- scripts/release/publish-maintenance.sh | 2 +- scripts/release/publish.js | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/release/bump-package-version.js b/scripts/release/bump-package-version.js index 1b240f80e6f..a922d1092f9 100644 --- a/scripts/release/bump-package-version.js +++ b/scripts/release/bump-package-version.js @@ -1,10 +1,10 @@ /* eslint-disable no-console */ -import fs from 'fs'; -import path from 'path'; -import mversion from 'mversion'; -import semver from 'semver'; -import { version as currentVersion } from '../../package.json'; +const fs = require('fs'); +const path = require('path'); +const mversion = require('mversion'); +const semver = require('semver'); +const { version: currentVersion } = require('../../package.json'); if (!process.env.VERSION) { throw new Error( diff --git a/scripts/release/publish-maintenance.sh b/scripts/release/publish-maintenance.sh index 2e8616d7d7c..2cff8355d0b 100755 --- a/scripts/release/publish-maintenance.sh +++ b/scripts/release/publish-maintenance.sh @@ -40,7 +40,7 @@ conventional-changelog --preset angular --output-unreleased | less # printf "\n\nRelease: Please enter the new chosen version > " printf "\n=> Release: please type the new chosen version > " read -e newVersion -VERSION=$newVersion babel-node ./scripts/release/bump-package-version.js +VERSION=$newVersion node ./scripts/release/bump-package-version.js # build new version NODE_ENV=production VERSION=$newVersion npm run build diff --git a/scripts/release/publish.js b/scripts/release/publish.js index 8a158b4de21..eae9470f0f4 100755 --- a/scripts/release/publish.js +++ b/scripts/release/publish.js @@ -157,7 +157,7 @@ inquirer // bump new version shell.echo(colors.blue(`Bump version to "${newVersion}"`)); shell.exec( - `VERSION=${newVersion} babel-node ./scripts/release/bump-package-version.js` + `VERSION=${newVersion} node ./scripts/release/bump-package-version.js` ); // build library new version