@@ -36,9 +36,6 @@ const { values: args, positionals } = parseArgs({
3636 tag : {
3737 type : 'string' ,
3838 } ,
39- canary : {
40- type : 'boolean' ,
41- } ,
4239 skipBuild : {
4340 type : 'boolean' ,
4441 } ,
@@ -69,9 +66,8 @@ const isDryRun = args.dry
6966/** @type {boolean | undefined } */
7067let skipTests = args . skipTests
7168const skipBuild = args . skipBuild
72- const isCanary = args . canary
73- const skipPrompts = args . skipPrompts || args . canary
74- const skipGit = args . skipGit || args . canary
69+ const skipPrompts = args . skipPrompts
70+ const skipGit = args . skipGit
7571
7672const packages = fs
7773 . readdirSync ( path . resolve ( __dirname , '../packages' ) )
@@ -98,18 +94,6 @@ const isCorePackage = (/** @type {string} */ pkgName) => {
9894 )
9995}
10096
101- const renamePackageToCanary = ( /** @type {string } */ pkgName ) => {
102- if ( pkgName === 'vue' ) {
103- return '@vue/canary'
104- }
105-
106- if ( isCorePackage ( pkgName ) ) {
107- return `${ pkgName } -canary`
108- }
109-
110- return pkgName
111- }
112-
11397const keepThePackageName = ( /** @type {string } */ pkgName ) => pkgName
11498
11599/** @type {string[] } */
@@ -151,57 +135,6 @@ async function main() {
151135
152136 let targetVersion = positionals [ 0 ]
153137
154- if ( isCanary ) {
155- // The canary version string format is `3.yyyyMMdd.0` (or `3.yyyyMMdd.0-minor.0` for minor)
156- // Use UTC date so that it's consistent across CI and maintainers' machines
157- const date = new Date ( )
158- const yyyy = date . getUTCFullYear ( )
159- const MM = ( date . getUTCMonth ( ) + 1 ) . toString ( ) . padStart ( 2 , '0' )
160- const dd = date . getUTCDate ( ) . toString ( ) . padStart ( 2 , '0' )
161-
162- const major = semver . major ( currentVersion )
163- const datestamp = `${ yyyy } ${ MM } ${ dd } `
164- let canaryVersion
165-
166- canaryVersion = `${ major } .${ datestamp } .0`
167- if ( args . tag && args . tag !== 'latest' ) {
168- canaryVersion = `${ major } .${ datestamp } .0-${ args . tag } .0`
169- }
170-
171- // check the registry to avoid version collision
172- // in case we need to publish more than one canary versions in a day
173- try {
174- const pkgName = renamePackageToCanary ( 'vue' )
175- const { stdout } = await run (
176- 'pnpm' ,
177- [ 'view' , `${ pkgName } @~${ canaryVersion } ` , 'version' , '--json' ] ,
178- { stdio : 'pipe' } ,
179- )
180- let versions = JSON . parse ( /** @type {string } */ ( stdout ) )
181- versions = Array . isArray ( versions ) ? versions : [ versions ]
182- const latestSameDayPatch = /** @type {string } */ (
183- semver . maxSatisfying ( versions , `~${ canaryVersion } ` )
184- )
185-
186- canaryVersion = /** @type {string } */ (
187- semver . inc ( latestSameDayPatch , 'patch' )
188- )
189- if ( args . tag && args . tag !== 'latest' ) {
190- canaryVersion = /** @type {string } */ (
191- semver . inc ( latestSameDayPatch , 'prerelease' , args . tag )
192- )
193- }
194- } catch ( /** @type {any } */ e ) {
195- if ( / E 4 0 4 / . test ( e . message ) ) {
196- // the first patch version on that day
197- } else {
198- throw e
199- }
200- }
201-
202- targetVersion = canaryVersion
203- }
204-
205138 if ( ! targetVersion ) {
206139 // no explicit version, offer suggestions
207140 /** @type {{ release: string } } */
@@ -239,11 +172,7 @@ async function main() {
239172 }
240173
241174 if ( skipPrompts ) {
242- step (
243- isCanary
244- ? `Releasing canary version v${ targetVersion } ...`
245- : `Releasing v${ targetVersion } ...` ,
246- )
175+ step ( `Releasing v${ targetVersion } ...` )
247176 } else {
248177 /** @type {{ yes: boolean } } */
249178 const { yes : confirmRelease } = await prompt ( {
@@ -261,10 +190,7 @@ async function main() {
261190
262191 // update all package versions and inter-dependencies
263192 step ( '\nUpdating cross dependencies...' )
264- updateVersions (
265- targetVersion ,
266- isCanary ? renamePackageToCanary : keepThePackageName ,
267- )
193+ updateVersions ( targetVersion , keepThePackageName )
268194 versionUpdated = true
269195
270196 // generate changelog
@@ -285,11 +211,8 @@ async function main() {
285211 }
286212
287213 // update pnpm-lock.yaml
288- // skipped during canary release because the package names changed and installing with `workspace:*` would fail
289- if ( ! isCanary ) {
290- step ( '\nUpdating lockfile...' )
291- await run ( `pnpm` , [ 'install' , '--prefer-offline' ] )
292- }
214+ step ( '\nUpdating lockfile...' )
215+ await run ( `pnpm` , [ 'install' , '--prefer-offline' ] )
293216
294217 if ( ! skipGit ) {
295218 const { stdout } = await run ( 'git' , [ 'diff' ] , { stdio : 'pipe' } )
@@ -457,34 +380,9 @@ function updatePackage(pkgRoot, version, getNewPackageName) {
457380 const pkg = JSON . parse ( fs . readFileSync ( pkgPath , 'utf-8' ) )
458381 pkg . name = getNewPackageName ( pkg . name )
459382 pkg . version = version
460- if ( isCanary ) {
461- updateDeps ( pkg , 'dependencies' , version , getNewPackageName )
462- updateDeps ( pkg , 'peerDependencies' , version , getNewPackageName )
463- }
464383 fs . writeFileSync ( pkgPath , JSON . stringify ( pkg , null , 2 ) + '\n' )
465384}
466385
467- /**
468- * @param {Package } pkg
469- * @param {'dependencies' | 'peerDependencies' } depType
470- * @param {string } version
471- * @param {(pkgName: string) => string } getNewPackageName
472- */
473- function updateDeps ( pkg , depType , version , getNewPackageName ) {
474- const deps = pkg [ depType ]
475- if ( ! deps ) return
476- Object . keys ( deps ) . forEach ( dep => {
477- if ( isCorePackage ( dep ) ) {
478- const newName = getNewPackageName ( dep )
479- const newVersion = newName === dep ? version : `npm:${ newName } @${ version } `
480- console . log (
481- pico . yellow ( `${ pkg . name } -> ${ depType } -> ${ dep } @${ newVersion } ` ) ,
482- )
483- deps [ dep ] = newVersion
484- }
485- } )
486- }
487-
488386async function buildPackages ( ) {
489387 step ( '\nBuilding all packages...' )
490388 if ( ! skipBuild ) {
@@ -509,9 +407,8 @@ async function publishPackages(version) {
509407 additionalPublishFlags . push ( '--no-git-checks' )
510408 }
511409 // add provenance metadata when releasing from CI
512- // canary release commits are not pushed therefore we don't need to add provenance
513- // also skip provenance if not publishing to actual npm
514- if ( process . env . CI && ! isCanary && ! args . registry ) {
410+ // skip provenance if not publishing to actual npm
411+ if ( process . env . CI && ! args . registry ) {
515412 additionalPublishFlags . push ( '--provenance' )
516413 }
517414
0 commit comments