Skip to content

Commit d0d4811

Browse files
authored
feat: use UTC dates for create-vue releases (#1183)
* feat: use UTC dates for create-vue releases * fix: derive the UTC release date from the create-vue version * fix: label the CLI banner date as the release date * chore: replace semver with verkit in release scripts
1 parent 9fc5f50 commit d0d4811

14 files changed

Lines changed: 249 additions & 191 deletions

‎.github/MAINTENANCE.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ Anyone with write access to the main branch of both this repository and [create-
66

77
To do so, follow these steps:
88

9-
1. Run `pnpm release <patch|minor|major|x.y.z>` locally and follow the prompts. The release script will bump the version number, create the release commit / tag, and push the changes to the repository.
9+
1. Run `pnpm release` locally. The script keeps the current major and uses the UTC date for the minor version. The first release on November 11, 2026 would be `3.20261111.0`, and a second release that day would be `3.20261111.1`. The script commits the release and pushes the same version tag to both repositories. To set an exact version, run `pnpm release <version>`.
1010
2. The release will be automatically published to npm by GitHub Actions once approved by an _administrator_.
1111
3. Go to <https://github.com/vuejs/create-vue/releases/new> and create a new release with the tag that was just created. Describe the notable changes in the release notes.

‎__test__/releaseVersion.spec.ts‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { describe, expect, it } from 'vite-plus/test'
2+
import { nextReleaseVersion } from '../scripts/release-version.mjs'
3+
4+
describe('nextReleaseVersion', () => {
5+
const now = new Date('2026-11-12T08:59:59+09:00')
6+
7+
it('uses the UTC date when migrating from the previous version scheme', () => {
8+
expect(nextReleaseVersion('3.24.0', now)).toBe('3.20261111.0')
9+
})
10+
11+
it('increments the revision for another release on the same UTC day', () => {
12+
expect(nextReleaseVersion('3.20261111.9', now)).toBe('3.20261111.10')
13+
})
14+
15+
it('resets the revision at midnight UTC and keeps the major', () => {
16+
const midnight = new Date('2026-11-12T09:00:00+09:00')
17+
expect(nextReleaseVersion('4.20261111.2', midnight)).toBe('4.20261112.0')
18+
})
19+
20+
it.each(['3.20261111.0-beta.1', '3.20261111.0--canary'])(
21+
'promotes %s to its stable version on the same date',
22+
(prerelease) => {
23+
expect(nextReleaseVersion(prerelease, now)).toBe('3.20261111.0')
24+
},
25+
)
26+
27+
it('rejects a UTC date earlier than the current release', () => {
28+
expect(() => nextReleaseVersion('3.20261112.0', now)).toThrow(/ahead of the UTC release date/)
29+
})
30+
})

‎index.ts‎

Lines changed: 64 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import {
3030
} from './utils/directoryTraverse'
3131
import generateReadme from './utils/generateReadme'
3232
import getCommand from './utils/getCommand'
33-
import getLanguage from './utils/getLanguage'
33+
import { detectLocale, loadMessages } from './utils/locale'
3434
import { trimBoilerplate, removeCSSImport, emptyRouterConfig } from './utils/trimBoilerplate'
3535
import applyOverrides from './utils/applyOverrides'
3636
import {
@@ -42,7 +42,9 @@ import { resolveNeedsTypeScript } from './utils/resolveFeatures'
4242

4343
import cliPackageJson from './package.json' with { type: 'json' }
4444

45-
const language = await getLanguage(fileURLToPath(new URL('./locales', import.meta.url)))
45+
const versionInfo = `${cliPackageJson.name} v${cliPackageJson.version}`
46+
const locale = detectLocale()
47+
const messages = await loadMessages(fileURLToPath(new URL('./locales', import.meta.url)), locale)
4648

4749
const FEATURE_FLAGS = [
4850
'default',
@@ -71,45 +73,45 @@ const FEATURE_FLAGS = [
7173
const FEATURE_OPTIONS = [
7274
{
7375
value: 'jsx',
74-
label: language.needsJsx.message,
76+
label: messages.needsJsx.message,
7577
},
7678
{
7779
value: 'router',
78-
label: language.needsRouter.message,
80+
label: messages.needsRouter.message,
7981
},
8082
{
8183
value: 'pinia',
82-
label: language.needsPinia.message,
84+
label: messages.needsPinia.message,
8385
},
8486
{
8587
value: 'vitest',
86-
label: language.needsVitest.message,
88+
label: messages.needsVitest.message,
8789
},
8890
{
8991
value: 'e2e',
90-
label: language.needsE2eTesting.message,
92+
label: messages.needsE2eTesting.message,
9193
},
9294
{
9395
value: 'eslint',
94-
label: language.needsEslint.message,
96+
label: messages.needsEslint.message,
9597
},
9698
{
9799
value: 'prettier',
98-
label: language.needsPrettier.message,
100+
label: messages.needsPrettier.message,
99101
},
100102
] as const
101103
const EXPERIMENTAL_FEATURE_OPTIONS = [
102104
{
103105
value: 'oxfmt',
104-
label: language.needsOxfmt.message,
106+
label: messages.needsOxfmt.message,
105107
},
106108
{
107109
value: 'vue-rc',
108-
label: language.needsVueRc.message,
110+
label: messages.needsVueRc.message,
109111
},
110112
{
111113
value: 'tsgo',
112-
label: language.needsTsgo.message,
114+
label: messages.needsTsgo.message,
113115
},
114116
] as const
115117

@@ -171,7 +173,7 @@ async function unwrapPrompt<T>(maybeCancelPromise: Promise<T | typeof CANCEL_SYM
171173
const result = await maybeCancelPromise
172174

173175
if (isCancel(result)) {
174-
cancel(red('✖') + ` ${language.errors.operationCancelled}`)
176+
cancel(red('✖') + ` ${messages.errors.operationCancelled}`)
175177
process.exit(0)
176178
}
177179

@@ -236,6 +238,27 @@ Deprecated feature flags:
236238
Oxlint is now always included when ESLint is selected.
237239
`
238240

241+
function formatReleaseInfo() {
242+
const match = /^\d+\.(\d{4})(\d{2})(\d{2})\./.exec(cliPackageJson.version)
243+
if (!match) return versionInfo
244+
245+
const [, year, month, day] = match
246+
const date = new Date(`${year}-${month}-${day}`)
247+
// Explicit versions can have an eight-digit minor that isn't a calendar date.
248+
if (date.getUTCDate() !== Number(day)) return versionInfo
249+
250+
try {
251+
const formattedDate = new Intl.DateTimeFormat(locale, {
252+
dateStyle: 'medium',
253+
timeZone: 'UTC',
254+
}).format(date)
255+
return messages.infos.released.replace('{date}', `${formattedDate} (UTC)`)
256+
} catch {
257+
// Some runtimes ship without locale-aware date formatting.
258+
return versionInfo
259+
}
260+
}
261+
239262
async function init() {
240263
const cwd = process.cwd()
241264
const args = process.argv.slice(2)
@@ -260,7 +283,7 @@ async function init() {
260283
}
261284

262285
if (argv.version) {
263-
console.log(`${cliPackageJson.name} v${cliPackageJson.version}`)
286+
console.log(versionInfo)
264287
process.exit(0)
265288
}
266289

@@ -292,16 +315,16 @@ async function init() {
292315
? banners.gradientBanner
293316
: banners.defaultBanner,
294317
)
295-
log.message(dim(`${cliPackageJson.name} v${cliPackageJson.version}`), { spacing: 0 })
318+
log.message(dim(formatReleaseInfo()), { spacing: 0 })
296319

297320
if (!targetDir) {
298321
const _result = await unwrapPrompt(
299322
text({
300-
message: language.projectName.message,
323+
message: messages.projectName.message,
301324
placeholder: defaultProjectName,
302325
defaultValue: defaultProjectName,
303326
validate: (value) =>
304-
!value || value.trim().length > 0 ? undefined : language.projectName.invalidMessage,
327+
!value || value.trim().length > 0 ? undefined : messages.projectName.invalidMessage,
305328
}),
306329
)
307330
const projectName = _result?.trim() || defaultProjectName
@@ -313,19 +336,19 @@ async function init() {
313336
select({
314337
message: `${
315338
targetDir === '.'
316-
? language.shouldOverwrite.dirForPrompts.current
317-
: `${language.shouldOverwrite.dirForPrompts.target} "${targetDir}"`
318-
} ${language.shouldOverwrite.message}`,
339+
? messages.shouldOverwrite.dirForPrompts.current
340+
: `${messages.shouldOverwrite.dirForPrompts.target} "${targetDir}"`
341+
} ${messages.shouldOverwrite.message}`,
319342
options: [
320-
{ value: 'remove', label: language.shouldOverwrite.selectOptions!.remove.title },
321-
{ value: 'cancel', label: language.shouldOverwrite.selectOptions!.cancel.title },
322-
{ value: 'ignore', label: language.shouldOverwrite.selectOptions!.ignore.title },
343+
{ value: 'remove', label: messages.shouldOverwrite.selectOptions!.remove.title },
344+
{ value: 'cancel', label: messages.shouldOverwrite.selectOptions!.cancel.title },
345+
{ value: 'ignore', label: messages.shouldOverwrite.selectOptions!.ignore.title },
323346
],
324347
}),
325348
)
326349

327350
if (overwrite === 'cancel') {
328-
cancel(red('✖') + ` ${language.errors.operationCancelled}`)
351+
cancel(red('✖') + ` ${messages.errors.operationCancelled}`)
329352
process.exit(0)
330353
}
331354

@@ -336,10 +359,10 @@ async function init() {
336359
if (!isValidPackageName(defaultPackageName)) {
337360
result.packageName = await unwrapPrompt(
338361
text({
339-
message: language.packageName.message,
362+
message: messages.packageName.message,
340363
initialValue: toValidPackageName(defaultPackageName),
341364
validate: (value) =>
342-
isValidPackageName(value) ? undefined : language.packageName.invalidMessage,
365+
isValidPackageName(value) ? undefined : messages.packageName.invalidMessage,
343366
}),
344367
)
345368
} else {
@@ -349,15 +372,14 @@ async function init() {
349372
if (!isFeatureFlagsUsed) {
350373
result.needsTypeScript = await unwrapPrompt(
351374
confirm({
352-
message: language.needsTypeScript.message,
375+
message: messages.needsTypeScript.message,
353376
initialValue: true,
354377
}),
355378
)
356379

357380
result.features = await unwrapPrompt(
358381
multiselect({
359-
message: `${language.featureSelection.message} ${dim(language.featureSelection.hint)}`,
360-
// @ts-expect-error @clack/prompt's type doesn't support readonly array yet
382+
message: `${messages.featureSelection.message} ${dim(messages.featureSelection.hint)}`,
361383
options: FEATURE_OPTIONS,
362384
required: false,
363385
}),
@@ -367,19 +389,19 @@ async function init() {
367389
const hasVitest = result.features.includes('vitest')
368390
result.e2eFramework = await unwrapPrompt(
369391
select({
370-
message: `${language.e2eSelection.message} ${dim(language.e2eSelection.hint)}`,
392+
message: `${messages.e2eSelection.message} ${dim(messages.e2eSelection.hint)}`,
371393
options: [
372394
{
373395
value: 'playwright',
374-
label: language.e2eSelection.selectOptions.playwright.title,
375-
hint: language.e2eSelection.selectOptions.playwright.desc,
396+
label: messages.e2eSelection.selectOptions.playwright.title,
397+
hint: messages.e2eSelection.selectOptions.playwright.desc,
376398
},
377399
{
378400
value: 'cypress',
379-
label: language.e2eSelection.selectOptions.cypress.title,
401+
label: messages.e2eSelection.selectOptions.cypress.title,
380402
hint: hasVitest
381-
? language.e2eSelection.selectOptions.cypress.desc
382-
: language.e2eSelection.selectOptions.cypress.hintOnComponentTesting!,
403+
? messages.e2eSelection.selectOptions.cypress.desc
404+
: messages.e2eSelection.selectOptions.cypress.hintOnComponentTesting!,
383405
},
384406
],
385407
}),
@@ -391,8 +413,7 @@ async function init() {
391413
: EXPERIMENTAL_FEATURE_OPTIONS.filter(({ value }) => value !== 'tsgo')
392414
result.experimentFeatures = await unwrapPrompt(
393415
multiselect({
394-
message: `${language.needsExperimentalFeatures.message} ${dim(language.needsExperimentalFeatures.hint)}`,
395-
// @ts-expect-error @clack/prompt's type doesn't support readonly array yet
416+
message: `${messages.needsExperimentalFeatures.message} ${dim(messages.needsExperimentalFeatures.hint)}`,
396417
options: experimentalFeatureOptions,
397418
required: false,
398419
}),
@@ -410,7 +431,7 @@ async function init() {
410431

411432
result.packageManager = await unwrapPrompt(
412433
select({
413-
message: `${language.packageManagerSelection.message} ${dim(language.packageManagerSelection.hint)}`,
434+
message: `${messages.packageManagerSelection.message} ${dim(messages.packageManagerSelection.hint)}`,
414435
options: packageManagerOptions,
415436
}),
416437
)
@@ -422,7 +443,7 @@ async function init() {
422443
} else if (!isFeatureFlagsUsed) {
423444
result.needsBareboneTemplates = await unwrapPrompt(
424445
confirm({
425-
message: language.needsBareboneTemplates.message,
446+
message: messages.needsBareboneTemplates.message,
426447
// TODO: default to true sometime in the future
427448
initialValue: false,
428449
}),
@@ -458,7 +479,7 @@ async function init() {
458479
fs.mkdirSync(root)
459480
}
460481

461-
console.log(`\n${language.infos.scaffolding} ${root}...`)
482+
console.log(`\n${messages.infos.scaffolding} ${root}...`)
462483

463484
const pkg = { name: result.packageName, version: '0.0.0' }
464485
fs.writeFileSync(path.resolve(root, 'package.json'), JSON.stringify(pkg, null, 2))
@@ -728,7 +749,7 @@ async function init() {
728749
}),
729750
)
730751

731-
let outroMessage = `${language.infos.done}\n\n`
752+
let outroMessage = `${messages.infos.done}\n\n`
732753
if (root !== cwd) {
733754
const cdProjectName = path.relative(cwd, root)
734755
outroMessage += ` ${bold(green(`cd ${cdProjectName.includes(' ') ? `"${cdProjectName}"` : cdProjectName}`))}\n`
@@ -741,13 +762,13 @@ async function init() {
741762

742763
if (needsTsgo && packageManager === 'nub') {
743764
outroMessage += `
744-
${dim('|')} ${language.warnings.tsgoNubReleaseAge}
765+
${dim('|')} ${messages.warnings.tsgoNubReleaseAge}
745766
`
746767
}
747768

748769
if (!dotGitDirectoryState.hasDotGitDirectory) {
749770
outroMessage += `
750-
${dim('|')} ${language.infos.optionalGitCommand}
771+
${dim('|')} ${messages.infos.optionalGitCommand}
751772
752773
${bold(green('git init && git add -A && git commit -m "initial commit"'))}`
753774
}

‎locales/en-US.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
"inactive": "No"
9494
},
9595
"infos": {
96+
"released": "Released {date}",
9697
"scaffolding": "Scaffolding project in",
9798
"done": "Done. Now run:",
9899
"optionalGitCommand": "Optional: Initialize Git in your project directory with:"

‎locales/fr-FR.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
"inactive": "Non"
9494
},
9595
"infos": {
96+
"released": "Publié le {date}",
9697
"scaffolding": "Génération du projet dans",
9798
"done": "Terminé. Exécutez maintenant\u00a0:",
9899
"optionalGitCommand": "Optionnel\u00a0: Initialisez Git dans votre répertoire de projet avec\u00a0:"

‎locales/tr-TR.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
"inactive": "Hayır"
9494
},
9595
"infos": {
96+
"released": "Yayın tarihi: {date}",
9697
"scaffolding": "İskele projesi",
9798
"done": "Tamamlandı. Şimdi bunu çalıştır:",
9899
"optionalGitCommand": "İsteğe bağlı: Proje dizininizde Git'i şununla başlatın:"

‎locales/zh-Hans.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
"inactive": "否"
9494
},
9595
"infos": {
96+
"released": "发布于 {date}",
9697
"scaffolding": "正在初始化项目",
9798
"done": "项目初始化完成,可执行以下命令:",
9899
"optionalGitCommand": "可选:使用以下命令在项目目录中初始化 Git:"

‎locales/zh-Hant.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
"inactive": "否"
9494
},
9595
"infos": {
96+
"released": "發布於 {date}",
9697
"scaffolding": "正在建置專案",
9798
"done": "專案建置完成,可執行以下命令:",
9899
"optionalGitCommand": "可選:使用以下命令在專案目錄中初始化 Git:"

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"picocolors": "^1.1.1",
5050
"rolldown": "1.3.1",
5151
"rollup-plugin-license": "^3.7.2",
52+
"verkit": "^0.5.0",
5253
"vite-plus": "catalog:",
5354
"zx": "^8.8.5"
5455
},

0 commit comments

Comments
 (0)