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