Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions .github/workflows/canary-minor.yml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/canary.yml

This file was deleted.

8 changes: 2 additions & 6 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,7 @@ function createConfig(format, output, plugins = []) {
const isServerRenderer = name === 'server-renderer'
const isCJSBuild = format === 'cjs'
const isGlobalBuild = /global/.test(format)
const isCompatPackage =
pkg.name === '@vue/compat' || pkg.name === '@vue/compat-canary'
const isCompatPackage = pkg.name === '@vue/compat'
const isCompatBuild = !!packageOptions.compat
const isBrowserBuild =
(isGlobalBuild || isBrowserESMBuild || isBundlerESMBuild) &&
Expand Down Expand Up @@ -288,10 +287,7 @@ function createConfig(format, output, plugins = []) {
// requires a ton of template engines which should be ignored.
/** @type {ReadonlyArray<string>} */
let cjsIgnores = []
if (
pkg.name === '@vue/compiler-sfc' ||
pkg.name === '@vue/compiler-sfc-canary'
) {
if (pkg.name === '@vue/compiler-sfc') {
cjsIgnores = [
...Object.keys(consolidatePkg.devDependencies),
'vm',
Expand Down
119 changes: 8 additions & 111 deletions scripts/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ const { values: args, positionals } = parseArgs({
tag: {
type: 'string',
},
canary: {
type: 'boolean',
},
skipBuild: {
type: 'boolean',
},
Expand Down Expand Up @@ -69,9 +66,8 @@ const isDryRun = args.dry
/** @type {boolean | undefined} */
let skipTests = args.skipTests
const skipBuild = args.skipBuild
const isCanary = args.canary
const skipPrompts = args.skipPrompts || args.canary
const skipGit = args.skipGit || args.canary
const skipPrompts = args.skipPrompts
const skipGit = args.skipGit

const packages = fs
.readdirSync(path.resolve(__dirname, '../packages'))
Expand All @@ -98,18 +94,6 @@ const isCorePackage = (/** @type {string} */ pkgName) => {
)
}

const renamePackageToCanary = (/** @type {string} */ pkgName) => {
if (pkgName === 'vue') {
return '@vue/canary'
}

if (isCorePackage(pkgName)) {
return `${pkgName}-canary`
}

return pkgName
}

const keepThePackageName = (/** @type {string} */ pkgName) => pkgName

/** @type {string[]} */
Expand Down Expand Up @@ -151,57 +135,6 @@ async function main() {

let targetVersion = positionals[0]

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 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 = 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}`)
)

canaryVersion = /** @type {string} */ (
semver.inc(latestSameDayPatch, 'patch')
)
if (args.tag && args.tag !== 'latest') {
canaryVersion = /** @type {string} */ (
semver.inc(latestSameDayPatch, 'prerelease', args.tag)
)
}
} catch (/** @type {any} */ e) {
if (/E404/.test(e.message)) {
// the first patch version on that day
} else {
throw e
}
}

targetVersion = canaryVersion
}

if (!targetVersion) {
// no explicit version, offer suggestions
/** @type {{ release: string }} */
Expand Down Expand Up @@ -239,11 +172,7 @@ async function main() {
}

if (skipPrompts) {
step(
isCanary
? `Releasing canary version v${targetVersion}...`
: `Releasing v${targetVersion}...`,
)
step(`Releasing v${targetVersion}...`)
} else {
/** @type {{ yes: boolean }} */
const { yes: confirmRelease } = await prompt({
Expand All @@ -261,10 +190,7 @@ async function main() {

// update all package versions and inter-dependencies
step('\nUpdating cross dependencies...')
updateVersions(
targetVersion,
isCanary ? renamePackageToCanary : keepThePackageName,
)
updateVersions(targetVersion, keepThePackageName)
versionUpdated = true

// generate changelog
Expand All @@ -285,11 +211,8 @@ async function main() {
}

// update pnpm-lock.yaml
// skipped during canary release because the package names changed and installing with `workspace:*` would fail
if (!isCanary) {
step('\nUpdating lockfile...')
await run(`pnpm`, ['install', '--prefer-offline'])
}
step('\nUpdating lockfile...')
await run(`pnpm`, ['install', '--prefer-offline'])

if (!skipGit) {
const { stdout } = await run('git', ['diff'], { stdio: 'pipe' })
Expand Down Expand Up @@ -457,34 +380,9 @@ function updatePackage(pkgRoot, version, getNewPackageName) {
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'))
pkg.name = getNewPackageName(pkg.name)
pkg.version = version
if (isCanary) {
updateDeps(pkg, 'dependencies', version, getNewPackageName)
updateDeps(pkg, 'peerDependencies', version, getNewPackageName)
}
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n')
}

/**
* @param {Package} pkg
* @param {'dependencies' | 'peerDependencies'} depType
* @param {string} version
* @param {(pkgName: string) => string} getNewPackageName
*/
function updateDeps(pkg, depType, version, getNewPackageName) {
const deps = pkg[depType]
if (!deps) return
Object.keys(deps).forEach(dep => {
if (isCorePackage(dep)) {
const newName = getNewPackageName(dep)
const newVersion = newName === dep ? version : `npm:${newName}@${version}`
console.log(
pico.yellow(`${pkg.name} -> ${depType} -> ${dep}@${newVersion}`),
)
deps[dep] = newVersion
}
})
}

async function buildPackages() {
step('\nBuilding all packages...')
if (!skipBuild) {
Expand All @@ -509,9 +407,8 @@ async function publishPackages(version) {
additionalPublishFlags.push('--no-git-checks')
}
// add provenance metadata when releasing from CI
// canary release commits are not pushed therefore we don't need to add provenance
// also skip provenance if not publishing to actual npm
if (process.env.CI && !isCanary && !args.registry) {
// skip provenance if not publishing to actual npm
if (process.env.CI && !args.registry) {
additionalPublishFlags.push('--provenance')
}

Expand Down
Loading