Skip to content

Commit 2071495

Browse files
committed
workflow(dev): performance enhancement
1 parent d81a890 commit 2071495

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

scripts/dev.mts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ async function dev() {
5656
return
5757
}
5858

59+
console.log(cyan('Fetching origin...'))
60+
spawn('git', ['pull'], { stdio: 'inherit' })
61+
5962
console.log(cyan(`Switching to Vue ${targetVersion}...`))
6063
const mod = await loadFile('./vite.config.ts')
6164

@@ -101,7 +104,7 @@ async function dev() {
101104
}
102105

103106
await writeFile(mod as unknown as ASTNode, './vite.config.ts')
104-
spawn.sync('npx', ['eslint', './vite.config.ts', '--fix'], { stdio: 'inherit' })
107+
spawn('npx', ['eslint', './vite.config.ts', '--fix'], { stdio: 'inherit' })
105108

106109
let isDepsChanged = false
107110

@@ -131,7 +134,7 @@ async function dev() {
131134
if (isDepsChanged) {
132135
fs.writeFileSync('./package.json', JSON.stringify(pkg, null, 2))
133136
console.log(cyan('Linting package.json...'))
134-
spawn.sync('npx', ['eslint', './package.json', '--fix'], { stdio: 'inherit' })
137+
spawn('npx', ['eslint', './package.json', '--fix'], { stdio: 'inherit' })
135138
await installDependencies()
136139
}
137140

@@ -174,14 +177,14 @@ async function dev() {
174177
console.log(cyan('Installing node lts...'))
175178
spawn.sync('pnpm', ['env', 'use', '-g', 'lts'], { stdio: 'inherit' })
176179
console.log(cyan('Installing global packages...'))
177-
spawn.sync('pnpm', ['add', 'cnpm', '@antfu/ni', 'only-allow', '-g'], { stdio: 'inherit' })
180+
spawn('pnpm', ['add', 'cnpm', '@antfu/ni', 'only-allow', '-g'], { stdio: 'inherit' })
178181
} catch (e) {
179182

180183
}
181184
}
182185
}
183-
console.log(cyan('Upgrading dependencies...'))
184-
spawn.sync('pnpm', ['up'], { stdio: 'inherit' })
186+
console.log(cyan('Installing dependencies...'))
187+
spawn.sync('pnpm', ['i'], { stdio: 'inherit' })
185188
spawn.sync('npx', ['vue-demi-switch', targetVersion === '2.6' ? '2' : targetVersion], { stdio: 'inherit' })
186189
}
187190
}

0 commit comments

Comments
 (0)