From 6a6dbe1746503151961d0c849ffd156c0e926870 Mon Sep 17 00:00:00 2001 From: Youcef Mammar Date: Tue, 16 Apr 2019 18:35:45 +0200 Subject: [PATCH] fix(tools): use commonjs in bump-package-version.js (#3699) * 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. * fix(tools): remove unsued @babel/node --- package.json | 1 - scripts/release/bump-package-version.js | 12 ++-- scripts/release/publish-maintenance.sh | 2 +- scripts/release/publish.js | 2 +- yarn.lock | 74 +------------------------ 5 files changed, 9 insertions(+), 82 deletions(-) diff --git a/package.json b/package.json index 57bd145c77..2eaeb77cb5 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,6 @@ "devDependencies": { "@babel/cli": "7.4.3", "@babel/core": "7.4.3", - "@babel/node": "7.2.2", "@babel/plugin-proposal-class-properties": "7.4.0", "@babel/plugin-transform-react-constant-elements": "7.2.0", "@babel/preset-env": "7.4.3", diff --git a/scripts/release/bump-package-version.js b/scripts/release/bump-package-version.js index 1b240f80e6..d005da86f2 100644 --- a/scripts/release/bump-package-version.js +++ b/scripts/release/bump-package-version.js @@ -1,10 +1,10 @@ -/* eslint-disable no-console */ +/* eslint-disable no-console, import/no-commonjs */ -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 2e8616d7d7..2cff8355d0 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 8a158b4de2..eae9470f0f 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 diff --git a/yarn.lock b/yarn.lock index 0f8a955afe..8a8402ccb8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -359,17 +359,6 @@ esutils "^2.0.2" js-tokens "^4.0.0" -"@babel/node@7.2.2": - version "7.2.2" - resolved "https://registry.yarnpkg.com/@babel/node/-/node-7.2.2.tgz#1557dd23545b38d7b1d030a9c0e8fb225dbf70ab" - integrity sha512-jPqgTycE26uFsuWpLika9Ohz9dmLQHWjOnMNxBOjYb1HXO+eLKxEr5FfKSXH/tBvFwwaw+pzke3gagnurGOfCA== - dependencies: - "@babel/polyfill" "^7.0.0" - "@babel/register" "^7.0.0" - commander "^2.8.1" - lodash "^4.17.10" - v8flags "^3.1.1" - "@babel/parser@^7.0.0", "@babel/parser@^7.2.2", "@babel/parser@^7.2.3": version "7.3.2" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.3.2.tgz#95cdeddfc3992a6ca2a1315191c1679ca32c55cd" @@ -796,14 +785,6 @@ "@babel/helper-regex" "^7.4.3" regexpu-core "^4.5.4" -"@babel/polyfill@^7.0.0": - version "7.2.5" - resolved "https://registry.yarnpkg.com/@babel/polyfill/-/polyfill-7.2.5.tgz#6c54b964f71ad27edddc567d065e57e87ed7fa7d" - integrity sha512-8Y/t3MWThtMLYr0YNC/Q76tqN1w30+b0uQMeFUYauG2UGTR19zyUtFrAzT23zNtBxPp+LbE5E/nwV/q/r3y6ug== - dependencies: - core-js "^2.5.7" - regenerator-runtime "^0.12.0" - "@babel/preset-env@7.4.3", "@babel/preset-env@^7.4.1": version "7.4.3" resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.4.3.tgz#e71e16e123dc0fbf65a52cbcbcefd072fbd02880" @@ -877,19 +858,6 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-transform-typescript" "^7.3.2" -"@babel/register@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.0.0.tgz#fa634bae1bfa429f60615b754fc1f1d745edd827" - integrity sha512-f/+CRmaCe7rVEvcvPvxeA8j5aJhHC3aJie7YuqcMDhUOuyWLA7J/aNrTaHIzoWPEhpHA54mec4Mm8fv8KBlv3g== - dependencies: - core-js "^2.5.7" - find-cache-dir "^1.0.0" - home-or-tmp "^3.0.0" - lodash "^4.17.10" - mkdirp "^0.5.1" - pirates "^4.0.0" - source-map-support "^0.5.9" - "@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2": version "7.3.1" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.3.1.tgz#574b03e8e8a9898eaf4a872a92ea20b7846f6f2a" @@ -5492,15 +5460,6 @@ find-babel-config@^1.1.0: json5 "^0.5.1" path-exists "^3.0.0" -find-cache-dir@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-1.0.0.tgz#9288e3e9e3cc3748717d39eade17cf71fc30ee6f" - integrity sha1-kojj6ePMN0hxfTnq3hfPcfww7m8= - dependencies: - commondir "^1.0.1" - make-dir "^1.0.0" - pkg-dir "^2.0.0" - find-cache-dir@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-2.0.0.tgz#4c1faed59f45184530fb9d7fa123a4d04a98472d" @@ -6174,18 +6133,6 @@ hoist-non-react-statics@^2.3.1: resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.5.5.tgz#c5903cf409c0dfd908f388e619d86b9c1174cb47" integrity sha512-rqcy4pJo55FTTLWt+bU8ukscqHeE/e9KWvsOW2b/a3afxQZhwkQdT1rPPCJ0rYXdj4vNcasY8zHTH+jF/qStxw== -home-or-tmp@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-3.0.0.tgz#57a8fe24cf33cdd524860a15821ddc25c86671fb" - integrity sha1-V6j+JM8zzdUkhgoVgh3cJchmcfs= - -homedir-polyfill@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz#4c2bbc8a758998feebf5ed68580f76d46768b4bc" - integrity sha1-TCu8inWJmP7r9e1oWA921GdotLw= - dependencies: - parse-passwd "^1.0.0" - hosted-git-info@^2.1.4: version "2.7.1" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" @@ -9146,11 +9093,6 @@ parse-json@^4.0.0: error-ex "^1.3.1" json-parse-better-errors "^1.0.1" -parse-passwd@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6" - integrity sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY= - parse5@4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/parse5/-/parse5-4.0.0.tgz#6d78656e3da8d78b4ec0b906f7c08ef1dfe3f608" @@ -9281,13 +9223,6 @@ pinkie@^2.0.0: resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" integrity sha1-clVrgM+g1IqXToDnckjoDtT3+HA= -pirates@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.0.tgz#850b18781b4ac6ec58a43c9ed9ec5fe6796addbd" - integrity sha512-8t5BsXy1LUIjn3WWOlOuFDuKswhQb/tkak641lvBgmPOBUQHXveORtlMCp6OdPV1dtuTaEahKA8VNz6uLfKBtA== - dependencies: - node-modules-regexp "^1.0.0" - pirates@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.1.tgz#643a92caf894566f91b2b986d2c66950a8e2fb87" @@ -11096,7 +11031,7 @@ source-map-resolve@^0.5.0: source-map-url "^0.4.0" urix "^0.1.0" -source-map-support@^0.5.6, source-map-support@^0.5.9, source-map-support@~0.5.9: +source-map-support@^0.5.6, source-map-support@~0.5.9: version "0.5.10" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.10.tgz#2214080bc9d51832511ee2bab96e3c2f9353120c" integrity sha512-YfQ3tQFTK/yzlGJuX8pTwa4tifQj4QS2Mj7UegOu8jAz59MqIiMGPXxQhVQiIMNzayuUSF/jEuVnfFF5JqybmQ== @@ -12269,13 +12204,6 @@ uuid@^3.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.2.tgz#1b4af4955eb3077c501c23872fc6513811587131" integrity sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA== -v8flags@^3.1.1: - version "3.1.2" - resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-3.1.2.tgz#fc5cd0c227428181e6c29b2992e4f8f1da5e0c9f" - integrity sha512-MtivA7GF24yMPte9Rp/BWGCYQNaUj86zeYxV/x2RRJMKagImbbv3u8iJC57lNhWLPcGLJmHcHmFWkNsplbbLWw== - dependencies: - homedir-polyfill "^1.0.1" - validate-npm-package-license@^3.0.1: version "3.0.4" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a"