Skip to content

Commit

Permalink
chore: fix create-vite bumping script (vitejs#6881)
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Feb 12, 2022
1 parent 8e923fa commit 254cc45
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion scripts/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ async function main(): Promise<void> {

step('\nUpdating package version...')
updateVersion(pkgPath, targetVersion)
if (pkgName === 'create-vite') updateTemplateVersions(targetVersion)
if (pkgName === 'create-vite') updateTemplateVersions()

step('\nGenerating changelog...')
const changelogArgs = [
Expand Down
7 changes: 4 additions & 3 deletions scripts/releaseUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,9 @@ export async function logRecentCommits(pkgName: string) {
console.log()
}

export async function updateTemplateVersions(version: string) {
if (/beta|alpha|rc/.test(version)) return
export async function updateTemplateVersions() {
const viteVersion = require('../packages/vite/package.json').version
if (/beta|alpha|rc/.test(viteVersion)) return

const dir = path.resolve(__dirname, '../packages/create-vite')

Expand All @@ -205,7 +206,7 @@ export async function updateTemplateVersions(version: string) {
for (const template of templates) {
const pkgPath = path.join(dir, template, `package.json`)
const pkg = require(pkgPath)
pkg.devDependencies.vite = `^` + version
pkg.devDependencies.vite = `^` + viteVersion
if (template.startsWith('template-vue')) {
pkg.devDependencies['@vitejs/plugin-vue'] =
`^` + require('../packages/plugin-vue/package.json').version
Expand Down

0 comments on commit 254cc45

Please sign in to comment.