workflow!: vue-cli-version-marker's version now only syncs with @vue/cli

This breaks @vue/cli 3.1.2 and 3.1.3 but it's a necessary change to
simplify the release workflow
This commit is contained in:
Haoqun Jiang
2019-05-31 18:21:16 +08:00
parent 47d56e998d
commit 2fa9f5bf6f
5 changed files with 4 additions and 79 deletions

View File

@@ -1,37 +0,0 @@
const fs = require('fs')
const path = require('path')
const execa = require('execa')
const semver = require('semver')
// TODO:
// in v4 we don't need version marker's package.json to store all the versions
// so this logic can be removed
async function markVersions () {
const packages = JSON.parse(
(await execa(require.resolve('lerna/cli'), ['list', '--json'])).stdout
).filter(p => !p.private)
const markerPath = path.resolve(__dirname, '../packages/vue-cli-version-marker/package.json')
const marker = JSON.parse(fs.readFileSync(markerPath))
const curVersion = marker.version
const mainVersion = require('../lerna.json').version
if (semver.prerelease(mainVersion)) {
marker.version = mainVersion
} else {
const releaseType = semver.diff(curVersion, mainVersion) || 'patch'
marker.version = semver.inc(marker.version, releaseType)
}
marker.devDependencies = packages.reduce((prev, pkg) => {
prev[pkg.name] = pkg.version
return prev
}, {})
fs.writeFileSync(markerPath, JSON.stringify(marker, null, 2))
}
markVersions().catch(err => {
console.error(err)
process.exit(1)
})

View File

@@ -112,26 +112,6 @@ const release = async () => {
}
await execa(require.resolve('lerna/cli'), lernaArgs, { stdio: 'inherit' })
// publish version marker after all other packages are published
await execa(
'npm',
[
'publish',
'--tag',
distTag,
// must specify registry url: https://github.com/lerna/lerna/issues/896#issuecomment-311894609
'--registry',
'https://registry.npmjs.org/'
],
{
stdio: 'inherit',
cwd: require('path').resolve(
__dirname,
'../packages/vue-cli-version-marker'
)
}
)
}
release().catch(err => {