mirror of https://github.com/vuejs/core.git
chore: revert release script for vapor
This commit is contained in:
parent
25f8502546
commit
16ea5ff2d6
|
@ -51,9 +51,6 @@ const { values: args, positionals } = parseArgs({
|
|||
skipPrompts: {
|
||||
type: 'boolean',
|
||||
},
|
||||
vapor: {
|
||||
type: 'boolean',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -63,9 +60,8 @@ const isDryRun = args.dry
|
|||
let skipTests = args.skipTests
|
||||
const skipBuild = args.skipBuild
|
||||
const isCanary = args.canary
|
||||
const isVapor = args.vapor
|
||||
const skipPrompts = args.skipPrompts || args.canary || args.vapor
|
||||
const skipGit = args.skipGit || args.canary || args.vapor
|
||||
const skipPrompts = args.skipPrompts || args.canary
|
||||
const skipGit = args.skipGit || args.canary
|
||||
|
||||
const packages = fs
|
||||
.readdirSync(path.resolve(__dirname, '../packages'))
|
||||
|
@ -82,11 +78,7 @@ const packages = fs
|
|||
const isCorePackage = (/** @type {string} */ pkgName) => {
|
||||
if (!pkgName) return
|
||||
|
||||
if (
|
||||
pkgName === 'vue' ||
|
||||
pkgName === '@vue/compat' ||
|
||||
pkgName === '@vue/vapor'
|
||||
) {
|
||||
if (pkgName === 'vue' || pkgName === '@vue/compat') {
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -108,18 +100,6 @@ const renamePackageToCanary = (/** @type {string} */ pkgName) => {
|
|||
return pkgName
|
||||
}
|
||||
|
||||
const renamePackageToVapor = (/** @type {string} */ pkgName) => {
|
||||
if (pkgName === 'vue') {
|
||||
return '@vue-vapor/vue'
|
||||
}
|
||||
|
||||
if (isCorePackage(pkgName)) {
|
||||
return pkgName.replace(/^@vue\//, '@vue-vapor/')
|
||||
}
|
||||
|
||||
return pkgName
|
||||
}
|
||||
|
||||
const keepThePackageName = (/** @type {string} */ pkgName) => pkgName
|
||||
|
||||
/** @type {string[]} */
|
||||
|
@ -161,53 +141,45 @@ async function main() {
|
|||
|
||||
let targetVersion = positionals[0]
|
||||
|
||||
if (isCanary || isVapor) {
|
||||
const major = semver.major(currentVersion)
|
||||
let newVersion
|
||||
|
||||
if (isCanary) {
|
||||
// The canary version string format is `3.yyyyMMdd.0` (or `3.yyyyMMdd.0-minor.0` for minor)
|
||||
// Use UTC date so that it's consistent across CI and maintainers' machines
|
||||
const date = new Date()
|
||||
const yyyy = date.getUTCFullYear()
|
||||
const MM = (date.getUTCMonth() + 1).toString().padStart(2, '0')
|
||||
const dd = date.getUTCDate().toString().padStart(2, '0')
|
||||
const datestamp = `${yyyy}${MM}${dd}`
|
||||
|
||||
if (isCanary) {
|
||||
newVersion = `${major}.${datestamp}.0`
|
||||
if (args.tag && args.tag !== 'latest') {
|
||||
newVersion = `${major}.${datestamp}.0-${args.tag}.0`
|
||||
}
|
||||
} else {
|
||||
newVersion = `${major}.${datestamp}.0-${await getSha(true)}`
|
||||
const major = semver.major(currentVersion)
|
||||
const datestamp = `${yyyy}${MM}${dd}`
|
||||
let canaryVersion
|
||||
|
||||
canaryVersion = `${major}.${datestamp}.0`
|
||||
if (args.tag && args.tag !== 'latest') {
|
||||
canaryVersion = `${major}.${datestamp}.0-${args.tag}.0`
|
||||
}
|
||||
|
||||
// check the registry to avoid version collision
|
||||
// in case we need to publish more than one canary versions in a day
|
||||
try {
|
||||
const pkgName = isCanary
|
||||
? renamePackageToCanary('vue')
|
||||
: renamePackageToVapor('vue')
|
||||
if (isCanary) {
|
||||
const { stdout } = await run(
|
||||
'pnpm',
|
||||
['view', `${pkgName}@~${newVersion}`, 'version', '--json'],
|
||||
{ stdio: 'pipe' },
|
||||
)
|
||||
let versions = JSON.parse(/** @type {string} */ (stdout))
|
||||
versions = Array.isArray(versions) ? versions : [versions]
|
||||
const latestSameDayPatch = /** @type {string} */ (
|
||||
semver.maxSatisfying(versions, `~${newVersion}`)
|
||||
)
|
||||
const pkgName = renamePackageToCanary('vue')
|
||||
const { stdout } = await run(
|
||||
'pnpm',
|
||||
['view', `${pkgName}@~${canaryVersion}`, 'version', '--json'],
|
||||
{ stdio: 'pipe' },
|
||||
)
|
||||
let versions = JSON.parse(/** @type {string} */ (stdout))
|
||||
versions = Array.isArray(versions) ? versions : [versions]
|
||||
const latestSameDayPatch = /** @type {string} */ (
|
||||
semver.maxSatisfying(versions, `~${canaryVersion}`)
|
||||
)
|
||||
|
||||
newVersion = /** @type {string} */ (
|
||||
semver.inc(latestSameDayPatch, 'patch')
|
||||
canaryVersion = /** @type {string} */ (
|
||||
semver.inc(latestSameDayPatch, 'patch')
|
||||
)
|
||||
if (args.tag && args.tag !== 'latest') {
|
||||
canaryVersion = /** @type {string} */ (
|
||||
semver.inc(latestSameDayPatch, 'prerelease', args.tag)
|
||||
)
|
||||
if (args.tag && args.tag !== 'latest') {
|
||||
newVersion = /** @type {string} */ (
|
||||
semver.inc(latestSameDayPatch, 'prerelease', args.tag)
|
||||
)
|
||||
}
|
||||
}
|
||||
} catch (/** @type {any} */ e) {
|
||||
if (/E404/.test(e.message)) {
|
||||
|
@ -217,7 +189,7 @@ async function main() {
|
|||
}
|
||||
}
|
||||
|
||||
targetVersion = newVersion
|
||||
targetVersion = canaryVersion
|
||||
}
|
||||
|
||||
if (!targetVersion) {
|
||||
|
@ -252,8 +224,8 @@ async function main() {
|
|||
|
||||
if (skipPrompts) {
|
||||
step(
|
||||
isCanary || isVapor
|
||||
? `Releasing ${isCanary ? 'canary' : 'vapor'} version v${targetVersion}...`
|
||||
isCanary
|
||||
? `Releasing canary version v${targetVersion}...`
|
||||
: `Releasing v${targetVersion}...`,
|
||||
)
|
||||
} else {
|
||||
|
@ -301,11 +273,7 @@ async function main() {
|
|||
step('\nUpdating cross dependencies...')
|
||||
updateVersions(
|
||||
targetVersion,
|
||||
isCanary
|
||||
? renamePackageToCanary
|
||||
: isVapor
|
||||
? renamePackageToVapor
|
||||
: keepThePackageName,
|
||||
isCanary ? renamePackageToCanary : keepThePackageName,
|
||||
)
|
||||
versionUpdated = true
|
||||
|
||||
|
@ -338,7 +306,7 @@ async function main() {
|
|||
|
||||
// update pnpm-lock.yaml
|
||||
// skipped during canary release because the package names changed and installing with `workspace:*` would fail
|
||||
if (!isCanary && !isVapor) {
|
||||
if (!isCanary) {
|
||||
step('\nUpdating lockfile...')
|
||||
await run(`pnpm`, ['install', '--prefer-offline'])
|
||||
}
|
||||
|
@ -403,7 +371,7 @@ async function getCIResult() {
|
|||
try {
|
||||
const sha = await getSha()
|
||||
const res = await fetch(
|
||||
`https://api.github.com/repos/vuejs/core-vapor/actions/runs?head_sha=${sha}` +
|
||||
`https://api.github.com/repos/vuejs/core/actions/runs?head_sha=${sha}` +
|
||||
`&status=success&exclude_pull_requests=true`,
|
||||
)
|
||||
/** @type {{ workflow_runs: ({ name: string, conclusion: string })[] }} */
|
||||
|
@ -421,7 +389,7 @@ async function isInSyncWithRemote() {
|
|||
try {
|
||||
const branch = await getBranch()
|
||||
const res = await fetch(
|
||||
`https://api.github.com/repos/vuejs/core-vapor/commits/${branch}?per_page=1`,
|
||||
`https://api.github.com/repos/vuejs/core/commits/${branch}?per_page=1`,
|
||||
)
|
||||
const data = await res.json()
|
||||
if (data.sha === (await getSha())) {
|
||||
|
@ -473,7 +441,7 @@ function updatePackage(pkgRoot, version, getNewPackageName) {
|
|||
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'))
|
||||
pkg.name = getNewPackageName(pkg.name)
|
||||
pkg.version = version
|
||||
if (isCanary || isVapor) {
|
||||
if (isCanary) {
|
||||
updateDeps(pkg, 'dependencies', version, getNewPackageName)
|
||||
updateDeps(pkg, 'peerDependencies', version, getNewPackageName)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue