Skip to content

Commit 6e1cc5a

Browse files
committed
workflow(dev): do not upgrade pnpm before installing anymore
1 parent 9fe3a08 commit 6e1cc5a

File tree

1 file changed

+24
-28
lines changed

1 file changed

+24
-28
lines changed

scripts/dev.mts

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
// pnpm i only-allow esno prompts cross-spawn kolorist magicast del -D -w
22

33
import fs from 'node:fs'
4-
import { execSync } from 'node:child_process'
54
import prompts from 'prompts'
65
import spawn from 'cross-spawn'
76
import { loadFile, writeFile } from 'magicast'
87
import type { ASTNode } from 'magicast'
98
import { cyan } from 'kolorist'
109
import { addVitePlugin } from 'magicast/helpers'
11-
import { deleteAsync } from 'del'
12-
13-
declare const process: NodeJS.Process
1410

1511
type VueVersion = '3' | '2.7' | '2.6'
1612

@@ -152,7 +148,7 @@ async function dev() {
152148
spawn.sync('npx', ['vite', '--open', '--force'], { stdio: 'inherit' })
153149

154150
async function installDependencies() {
155-
if (['darwin', 'linux'].includes(process.platform)) {
151+
/* if (['darwin', 'linux'].includes(process.platform)) {
156152
console.log(cyan('Checking pnpm version...'))
157153
const latestPNPMVersion = spawn.sync('npm', ['view', 'pnpm', 'version']).stdout.toString().trim()
158154
const currentPNPMVersion = spawn.sync('pnpm', ['-v']).stdout.toString().trim()
@@ -161,28 +157,28 @@ async function dev() {
161157
console.log(cyan('Upgrading pnpm...'))
162158
try {
163159
console.log(execSync(`curl -fsSL https://get.pnpm.io/install.sh | env PNPM_VERSION=${latestPNPMVersion} sh -`).toString())
164-
/* const curlProcess = spawn.sync('curl', ['-fsSL', 'https://get.pnpm.io/install.sh'], {
165-
env: { PNPM_VERSION: latestPNPMVersion },
166-
stdio: ['pipe', 'pipe', 'pipe'], // Redirect stdin, stdout, and stderr
167-
})
168-
if (curlProcess.status === 0) {
169-
// If curl was successful, execute the shell command
170-
const shCommand = 'sh'
171-
const shArgs = ['-']
172-
173-
const shProcess = spawn.sync(shCommand, shArgs, {
174-
input: curlProcess.stdout, // Pass the stdout of curl as input to sh
175-
stdio: ['pipe', 'inherit', 'inherit'], // Redirect stdin, inherit stdout and stderr
176-
})
177-
178-
if (shProcess.status === 0) {
179-
console.log('pnpm installation successful.')
180-
} else {
181-
console.error('pnpm installation failed.')
182-
}
183-
} else {
184-
console.error('curl command failed.')
185-
} */
160+
// const curlProcess = spawn.sync('curl', ['-fsSL', 'https://get.pnpm.io/install.sh'], {
161+
// env: { PNPM_VERSION: latestPNPMVersion },
162+
// stdio: ['pipe', 'pipe', 'pipe'], // Redirect stdin, stdout, and stderr
163+
// })
164+
// if (curlProcess.status === 0) {
165+
// // If curl was successful, execute the shell command
166+
// const shCommand = 'sh'
167+
// const shArgs = ['-']
168+
//
169+
// const shProcess = spawn.sync(shCommand, shArgs, {
170+
// input: curlProcess.stdout, // Pass the stdout of curl as input to sh
171+
// stdio: ['pipe', 'inherit', 'inherit'], // Redirect stdin, inherit stdout and stderr
172+
// })
173+
//
174+
// if (shProcess.status === 0) {
175+
// console.log('pnpm installation successful.')
176+
// } else {
177+
// console.error('pnpm installation failed.')
178+
// }
179+
// } else {
180+
// console.error('curl command failed.')
181+
// }
186182
console.log(cyan('Setting registry...'))
187183
spawn.sync('pnpm', ['config', 'set', 'registry', 'https://registry.npmmirror.com'], { stdio: 'inherit' })
188184
// console.log(cyan('Installing node lts...'))
@@ -195,7 +191,7 @@ async function dev() {
195191
196192
}
197193
}
198-
}
194+
} */
199195
console.log(cyan('Installing dependencies...'))
200196
spawn.sync('pnpm', ['i'], { stdio: 'inherit' })
201197
spawn.sync('npx', ['vue-demi-switch', targetVersion === '2.6' ? '2' : targetVersion], { stdio: 'inherit' })

0 commit comments

Comments
 (0)