From 3a3bed75207c4916602c09184a078d95ec8c0347 Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Thu, 26 Apr 2018 10:19:19 +0100 Subject: [PATCH 1/2] build(node4): Drop Node 4 builds which has expired Thanks for all the fish Node 4, you won't be missed. --- .circleci/config.yml | 10 ---------- __tests__/index.js | 23 ++++++++++------------- bin/yarn.js | 6 +++--- package.json | 11 +++-------- scripts/build-deb.sh | 2 +- scripts/build-dist.sh | 9 ++------- scripts/build-webpack.js | 36 ------------------------------------ src/constants.js | 2 +- 8 files changed, 20 insertions(+), 79 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a73b4b67ac..f9d7442d2a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -133,11 +133,6 @@ jobs: docker: - image: node:6 <<: *test_steps - test-linux-node4: - <<: *docker_defaults - docker: - - image: node:4 - <<: *test_steps test-macos-node8: <<: *macos_defaults steps: @@ -233,10 +228,6 @@ workflows: filters: *default_filters requires: - install - - test-linux-node4: - filters: *default_filters - requires: - - install - test-macos-node6: filters: *default_filters requires: @@ -258,7 +249,6 @@ workflows: - test-pkg-tests-linux-node8 - test-linux-node8 - test-linux-node6 - - test-linux-node4 - test-macos-node8 - test-macos-node6 - lint diff --git a/__tests__/index.js b/__tests__/index.js index d2b46703e6..dd137a31f2 100644 --- a/__tests__/index.js +++ b/__tests__/index.js @@ -125,20 +125,17 @@ test('should add lockfile package', async () => { expectAddOutput(stdout); }); -// test is failing on Node 4, https://travis-ci.org/yarnpkg/yarn/jobs/216254539 -if (semver.satisfies(ver, '>=5.0.0')) { - test.concurrent('should add progress package globally', async () => { - const stdout = await execCommand( - 'global', - ['add', 'progress@2.0.0', '--global-folder', './global'], - 'run-add-progress-globally', - true, - ); +test.concurrent('should add progress package globally', async () => { + const stdout = await execCommand( + 'global', + ['add', 'progress@2.0.0', '--global-folder', './global'], + 'run-add-progress-globally', + true, + ); - const lastLine = stdout[stdout.length - 1]; - expect(lastLine).toMatch(/^Done/); - }); -} + const lastLine = stdout[stdout.length - 1]; + expect(lastLine).toMatch(/^Done/); +}); test.concurrent('should run custom script', async () => { const stdout = await execCommand('run', ['custom-script'], 'run-custom-script'); diff --git a/bin/yarn.js b/bin/yarn.js index e46b1f6002..b9bc7f0796 100755 --- a/bin/yarn.js +++ b/bin/yarn.js @@ -7,14 +7,14 @@ var ver = process.versions.node; var majorVer = parseInt(ver.split('.')[0], 10); -if (majorVer < 4) { - console.error('Node version ' + ver + ' is not supported, please use Node.js 4.0 or higher.'); +if (majorVer < 6) { + console.error('Node version ' + ver + ' is not supported, please use Node.js 6.0 or higher.'); process.exit(1); // eslint-disable-line no-process-exit } else { var dirPath = '../lib/'; var v8CompileCachePath = dirPath + 'v8-compile-cache'; var fs = require('fs'); - // We don't have/need this on legacy builds and dev builds + // We don't have/need this on dev builds if (fs.existsSync(v8CompileCachePath)) { require(v8CompileCachePath); } diff --git a/package.json b/package.json index e64aebdd2e..cb4302e38b 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,7 @@ "yargs": "^6.3.0" }, "engines": { - "node": ">=4.0.0" + "node": "^6.2.2 || >=8.0.0" }, "repository": "yarnpkg/yarn", "bin": { @@ -122,14 +122,9 @@ "commit": "git-cz" }, "jest": { - "collectCoverageFrom": [ - "src/**/*.js" - ], + "collectCoverageFrom": ["src/**/*.js"], "testEnvironment": "node", - "modulePathIgnorePatterns": [ - "__tests__/fixtures/", - "packages/pkg-tests/pkg-tests-fixtures" - ], + "modulePathIgnorePatterns": ["__tests__/fixtures/", "packages/pkg-tests/pkg-tests-fixtures"], "testPathIgnorePatterns": [ "__tests__/(fixtures|__mocks__)/", "updates/", diff --git a/scripts/build-deb.sh b/scripts/build-deb.sh index 382295947d..6e59a51a60 100755 --- a/scripts/build-deb.sh +++ b/scripts/build-deb.sh @@ -13,7 +13,7 @@ ensureAvailable lintian ensureAvailable rpmbuild PACKAGE_TMPDIR=tmp/debian_pkg -VERSION=`./artifacts/yarn-legacy-* --version` +VERSION=`./artifacts/yarn-* --version` OUTPUT_DIR=artifacts TARBALL_NAME=$OUTPUT_DIR/yarn-v$VERSION.tar.gz DEB_PACKAGE_NAME=yarn_$VERSION'_all.deb' diff --git a/scripts/build-dist.sh b/scripts/build-dist.sh index de7c277a06..10b91db863 100755 --- a/scripts/build-dist.sh +++ b/scripts/build-dist.sh @@ -27,17 +27,12 @@ eval $system_yarn run build eval $system_yarn run build-bundle chmod +x artifacts/*.js # Verify that it works as expected -if (( node_version > 4 )); then - [[ "$version" == "$(node artifacts/yarn-$version.js --version)" ]] || exit 1 -fi -[[ "$version" == "$(node artifacts/yarn-legacy-$version.js --version)" ]] || exit 1 +[[ "$version" == "$(node artifacts/yarn-$version.js --version)" ]] || exit 1 cp package.json dist/ cp README.md dist/ cp LICENSE dist/ -# Only use the legacy version for NPM builds so we are compatible -# with any Node >= 4 and still small in terms of size. -cp artifacts/yarn-legacy-$version.js dist/lib/cli.js +cp artifacts/yarn-$version.js dist/lib/cli.js cp bin/{yarn.js,yarn,yarnpkg,*.cmd} dist/bin/ chmod +x dist/bin/* diff --git a/scripts/build-webpack.js b/scripts/build-webpack.js index 8acad2ef4a..27c19b8e13 100755 --- a/scripts/build-webpack.js +++ b/scripts/build-webpack.js @@ -56,39 +56,3 @@ compiler.run((err, stats) => { const filenames = fileDependencies.map(x => x.replace(basedir, '')); console.log(util.inspect(filenames, {maxArrayLength: null})); }); - -// -// Legacy build -// - -const compilerLegacy = webpack({ - // devtool: 'inline-source-map', - entry: path.join(basedir, 'src/cli/index.js'), - module: { - loaders: [ - { - test: /\.js$/, - exclude: /node_modules/, - loader: 'babel-loader', - query: babelRc.env['pre-node5'], - }, - ], - }, - plugins: [ - new webpack.BannerPlugin({ - banner: '#!/usr/bin/env node', - raw: true, - }), - ], - output: { - filename: `yarn-legacy-${version}.js`, - path: path.join(basedir, 'artifacts'), - libraryTarget: 'commonjs2', - }, - target: 'node', - node: nodeOptions, -}); - -compilerLegacy.run((err, stats) => { - // do nothing, but keep here for debugging... -}); diff --git a/src/constants.js b/src/constants.js index e9cb7cf26c..aa4d2f6e61 100644 --- a/src/constants.js +++ b/src/constants.js @@ -14,7 +14,7 @@ export const DEPENDENCY_TYPES = ['devDependencies', 'dependencies', 'optionalDep export const RESOLUTIONS = 'resolutions'; export const MANIFEST_FIELDS = [RESOLUTIONS, ...DEPENDENCY_TYPES]; -export const SUPPORTED_NODE_VERSIONS = '^4.8.0 || ^5.7.0 || ^6.2.2 || >=8.0.0'; +export const SUPPORTED_NODE_VERSIONS = '^6.2.2 || >=8.0.0'; export const YARN_REGISTRY = 'https://registry.yarnpkg.com'; From 21599a088f112476e0ff160edabc167542b86d59 Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Thu, 26 Apr 2018 11:39:04 +0100 Subject: [PATCH 2/2] Fix glob --- scripts/build-deb.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-deb.sh b/scripts/build-deb.sh index 6e59a51a60..39371ed3c6 100755 --- a/scripts/build-deb.sh +++ b/scripts/build-deb.sh @@ -13,7 +13,7 @@ ensureAvailable lintian ensureAvailable rpmbuild PACKAGE_TMPDIR=tmp/debian_pkg -VERSION=`./artifacts/yarn-* --version` +VERSION=`./artifacts/yarn-*.js --version` OUTPUT_DIR=artifacts TARBALL_NAME=$OUTPUT_DIR/yarn-v$VERSION.tar.gz DEB_PACKAGE_NAME=yarn_$VERSION'_all.deb'