From 4f0cd2da66eedbfc804d87db6c154c041e3393aa Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Tue, 30 Apr 2019 19:43:20 +0800 Subject: [PATCH] workflow: add dist-tag when publishing [ci skip] --- .../__tests__/jestGenerator.spec.js | 2 -- .../cli-plugin-unit-jest/generator/index.js | 18 +++++------------- .../@vue/cli-plugin-unit-jest/package.json | 3 ++- scripts/release.js | 16 ++++++++++++---- yarn.lock | 2 +- 5 files changed, 20 insertions(+), 21 deletions(-) diff --git a/packages/@vue/cli-plugin-unit-jest/__tests__/jestGenerator.spec.js b/packages/@vue/cli-plugin-unit-jest/__tests__/jestGenerator.spec.js index 35186575b..8160c2bb0 100644 --- a/packages/@vue/cli-plugin-unit-jest/__tests__/jestGenerator.spec.js +++ b/packages/@vue/cli-plugin-unit-jest/__tests__/jestGenerator.spec.js @@ -25,8 +25,6 @@ test('base', async () => { // should inject babel-jest expect(pkg.devDependencies).toHaveProperty('babel-jest') - // babel-core 6 -> 7 shim - expect(pkg.devDependencies).toHaveProperty('babel-core') // eslint expect(files['tests/unit/.eslintrc.js']).toMatch('jest: true') diff --git a/packages/@vue/cli-plugin-unit-jest/generator/index.js b/packages/@vue/cli-plugin-unit-jest/generator/index.js index 634e75080..4bc05f7e1 100644 --- a/packages/@vue/cli-plugin-unit-jest/generator/index.js +++ b/packages/@vue/cli-plugin-unit-jest/generator/index.js @@ -54,22 +54,14 @@ module.exports = (api, _, __, invoking) => { if (api.hasPlugin('babel')) { api.extendPackage({ devDependencies: { - 'babel-jest': '^23.6.0', - // this is for now necessary to force babel-jest and vue-jest to use babel 7 - 'babel-core': '7.0.0-bridge.0' + 'babel-jest': '^24.7.1' } }) } else { - // Jest's shipped babel-jest still uses babel 6, - // so we cannot use extendPackage which renders babel.config.js. - api.render(files => { - files['.babelrc'] = JSON.stringify( - { - plugins: ['transform-es2015-modules-commonjs'] - }, - null, - 2 - ) + api.extendPackage({ + babel: { + plugins: ['transform-es2015-modules-commonjs'] + } }) } } else { diff --git a/packages/@vue/cli-plugin-unit-jest/package.json b/packages/@vue/cli-plugin-unit-jest/package.json index 019e885c2..1f3df7a75 100644 --- a/packages/@vue/cli-plugin-unit-jest/package.json +++ b/packages/@vue/cli-plugin-unit-jest/package.json @@ -23,9 +23,10 @@ "access": "public" }, "dependencies": { + "@babel/core": "^7.4.4", + "@babel/plugin-transform-modules-commonjs": "^7.4.4", "@vue/cli-shared-utils": "^3.6.0", "babel-jest": "^24.7.1", - "babel-plugin-transform-es2015-modules-commonjs": "^6.26.2", "jest": "^24.7.1", "jest-serializer-vue": "^2.0.2", "jest-transform-stub": "^2.0.0", diff --git a/scripts/release.js b/scripts/release.js index 0c8b7ebe9..a7d575f29 100644 --- a/scripts/release.js +++ b/scripts/release.js @@ -93,16 +93,24 @@ const release = async () => { } } - const lernaArgs = [ - 'publish', - version - ] const releaseType = semver.diff(curVersion, version) + let distTag = 'latest' + if (releaseType.startsWith('pre')) { + distTag = 'next' + } + + const lernaArgs = [ + 'publish', + version, + '--dist-tag', + distTag + ] // keep packages' minor version in sync if (releaseType !== 'patch') { lernaArgs.push('--force-publish') } + await execa(require.resolve('lerna/cli'), lernaArgs, { stdio: 'inherit' }) } diff --git a/yarn.lock b/yarn.lock index acbe29bb0..99bf116ac 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3507,7 +3507,7 @@ babel-plugin-syntax-object-rest-spread@^6.8.0: resolved "https://registry.yarnpkg.com/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz#fd6536f2bce13836ffa3a5458c4903a597bb3bf5" integrity sha1-/WU28rzhODb/o6VFjEkDpZe7O/U= -babel-plugin-transform-es2015-modules-commonjs@^6.26.0, babel-plugin-transform-es2015-modules-commonjs@^6.26.2: +babel-plugin-transform-es2015-modules-commonjs@^6.26.0: version "6.26.2" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.2.tgz#58a793863a9e7ca870bdc5a881117ffac27db6f3" integrity sha512-CV9ROOHEdrjcwhIaJNBGMBCodN+1cfkwtM1SbUHmvyy35KGT7fohbpOxkE2uLz1o6odKK2Ck/tz47z+VqQfi9Q==