Skip to content

Commit 16ea5ff

Browse files
committed
chore: revert release script for vapor
1 parent 25f8502 commit 16ea5ff

File tree

1 file changed

+35
-67
lines changed

1 file changed

+35
-67
lines changed

scripts/release.js

Lines changed: 35 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ const { values: args, positionals } = parseArgs({
5151
skipPrompts: {
5252
type: 'boolean',
5353
},
54-
vapor: {
55-
type: 'boolean',
56-
},
5754
},
5855
})
5956

@@ -63,9 +60,8 @@ const isDryRun = args.dry
6360
let skipTests = args.skipTests
6461
const skipBuild = args.skipBuild
6562
const isCanary = args.canary
66-
const isVapor = args.vapor
67-
const skipPrompts = args.skipPrompts || args.canary || args.vapor
68-
const skipGit = args.skipGit || args.canary || args.vapor
63+
const skipPrompts = args.skipPrompts || args.canary
64+
const skipGit = args.skipGit || args.canary
6965

7066
const packages = fs
7167
.readdirSync(path.resolve(__dirname, '../packages'))
@@ -82,11 +78,7 @@ const packages = fs
8278
const isCorePackage = (/** @type {string} */ pkgName) => {
8379
if (!pkgName) return
8480

85-
if (
86-
pkgName === 'vue' ||
87-
pkgName === '@vue/compat' ||
88-
pkgName === '@vue/vapor'
89-
) {
81+
if (pkgName === 'vue' || pkgName === '@vue/compat') {
9082
return true
9183
}
9284

@@ -108,18 +100,6 @@ const renamePackageToCanary = (/** @type {string} */ pkgName) => {
108100
return pkgName
109101
}
110102

111-
const renamePackageToVapor = (/** @type {string} */ pkgName) => {
112-
if (pkgName === 'vue') {
113-
return '@vue-vapor/vue'
114-
}
115-
116-
if (isCorePackage(pkgName)) {
117-
return pkgName.replace(/^@vue\//, '@vue-vapor/')
118-
}
119-
120-
return pkgName
121-
}
122-
123103
const keepThePackageName = (/** @type {string} */ pkgName) => pkgName
124104

125105
/** @type {string[]} */
@@ -161,53 +141,45 @@ async function main() {
161141

162142
let targetVersion = positionals[0]
163143

164-
if (isCanary || isVapor) {
165-
const major = semver.major(currentVersion)
166-
let newVersion
167-
144+
if (isCanary) {
168145
// The canary version string format is `3.yyyyMMdd.0` (or `3.yyyyMMdd.0-minor.0` for minor)
169146
// Use UTC date so that it's consistent across CI and maintainers' machines
170147
const date = new Date()
171148
const yyyy = date.getUTCFullYear()
172149
const MM = (date.getUTCMonth() + 1).toString().padStart(2, '0')
173150
const dd = date.getUTCDate().toString().padStart(2, '0')
151+
152+
const major = semver.major(currentVersion)
174153
const datestamp = `${yyyy}${MM}${dd}`
154+
let canaryVersion
175155

176-
if (isCanary) {
177-
newVersion = `${major}.${datestamp}.0`
178-
if (args.tag && args.tag !== 'latest') {
179-
newVersion = `${major}.${datestamp}.0-${args.tag}.0`
180-
}
181-
} else {
182-
newVersion = `${major}.${datestamp}.0-${await getSha(true)}`
156+
canaryVersion = `${major}.${datestamp}.0`
157+
if (args.tag && args.tag !== 'latest') {
158+
canaryVersion = `${major}.${datestamp}.0-${args.tag}.0`
183159
}
184160

185161
// check the registry to avoid version collision
186162
// in case we need to publish more than one canary versions in a day
187163
try {
188-
const pkgName = isCanary
189-
? renamePackageToCanary('vue')
190-
: renamePackageToVapor('vue')
191-
if (isCanary) {
192-
const { stdout } = await run(
193-
'pnpm',
194-
['view', `${pkgName}@~${newVersion}`, 'version', '--json'],
195-
{ stdio: 'pipe' },
196-
)
197-
let versions = JSON.parse(/** @type {string} */ (stdout))
198-
versions = Array.isArray(versions) ? versions : [versions]
199-
const latestSameDayPatch = /** @type {string} */ (
200-
semver.maxSatisfying(versions, `~${newVersion}`)
201-
)
164+
const pkgName = renamePackageToCanary('vue')
165+
const { stdout } = await run(
166+
'pnpm',
167+
['view', `${pkgName}@~${canaryVersion}`, 'version', '--json'],
168+
{ stdio: 'pipe' },
169+
)
170+
let versions = JSON.parse(/** @type {string} */ (stdout))
171+
versions = Array.isArray(versions) ? versions : [versions]
172+
const latestSameDayPatch = /** @type {string} */ (
173+
semver.maxSatisfying(versions, `~${canaryVersion}`)
174+
)
202175

203-
newVersion = /** @type {string} */ (
204-
semver.inc(latestSameDayPatch, 'patch')
176+
canaryVersion = /** @type {string} */ (
177+
semver.inc(latestSameDayPatch, 'patch')
178+
)
179+
if (args.tag && args.tag !== 'latest') {
180+
canaryVersion = /** @type {string} */ (
181+
semver.inc(latestSameDayPatch, 'prerelease', args.tag)
205182
)
206-
if (args.tag && args.tag !== 'latest') {
207-
newVersion = /** @type {string} */ (
208-
semver.inc(latestSameDayPatch, 'prerelease', args.tag)
209-
)
210-
}
211183
}
212184
} catch (/** @type {any} */ e) {
213185
if (/E404/.test(e.message)) {
@@ -217,7 +189,7 @@ async function main() {
217189
}
218190
}
219191

220-
targetVersion = newVersion
192+
targetVersion = canaryVersion
221193
}
222194

223195
if (!targetVersion) {
@@ -252,8 +224,8 @@ async function main() {
252224

253225
if (skipPrompts) {
254226
step(
255-
isCanary || isVapor
256-
? `Releasing ${isCanary ? 'canary' : 'vapor'} version v${targetVersion}...`
227+
isCanary
228+
? `Releasing canary version v${targetVersion}...`
257229
: `Releasing v${targetVersion}...`,
258230
)
259231
} else {
@@ -301,11 +273,7 @@ async function main() {
301273
step('\nUpdating cross dependencies...')
302274
updateVersions(
303275
targetVersion,
304-
isCanary
305-
? renamePackageToCanary
306-
: isVapor
307-
? renamePackageToVapor
308-
: keepThePackageName,
276+
isCanary ? renamePackageToCanary : keepThePackageName,
309277
)
310278
versionUpdated = true
311279

@@ -338,7 +306,7 @@ async function main() {
338306

339307
// update pnpm-lock.yaml
340308
// skipped during canary release because the package names changed and installing with `workspace:*` would fail
341-
if (!isCanary && !isVapor) {
309+
if (!isCanary) {
342310
step('\nUpdating lockfile...')
343311
await run(`pnpm`, ['install', '--prefer-offline'])
344312
}
@@ -403,7 +371,7 @@ async function getCIResult() {
403371
try {
404372
const sha = await getSha()
405373
const res = await fetch(
406-
`https://api.github.com/repos/vuejs/core-vapor/actions/runs?head_sha=${sha}` +
374+
`https://api.github.com/repos/vuejs/core/actions/runs?head_sha=${sha}` +
407375
`&status=success&exclude_pull_requests=true`,
408376
)
409377
/** @type {{ workflow_runs: ({ name: string, conclusion: string })[] }} */
@@ -421,7 +389,7 @@ async function isInSyncWithRemote() {
421389
try {
422390
const branch = await getBranch()
423391
const res = await fetch(
424-
`https://api.github.com/repos/vuejs/core-vapor/commits/${branch}?per_page=1`,
392+
`https://api.github.com/repos/vuejs/core/commits/${branch}?per_page=1`,
425393
)
426394
const data = await res.json()
427395
if (data.sha === (await getSha())) {
@@ -473,7 +441,7 @@ function updatePackage(pkgRoot, version, getNewPackageName) {
473441
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'))
474442
pkg.name = getNewPackageName(pkg.name)
475443
pkg.version = version
476-
if (isCanary || isVapor) {
444+
if (isCanary) {
477445
updateDeps(pkg, 'dependencies', version, getNewPackageName)
478446
updateDeps(pkg, 'peerDependencies', version, getNewPackageName)
479447
}

0 commit comments

Comments
 (0)