Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use -w arg for pnpm root workspace #449

Merged
merged 2 commits into from
Aug 23, 2024
Merged
Changes from 1 commit
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
8 changes: 7 additions & 1 deletion src/commands/upgrade.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { execSync } from 'node:child_process'
import { existsSync } from 'node:fs'
import { consola } from 'consola'
import { colors } from 'consola/utils'
import { relative, resolve } from 'pathe'
Expand Down Expand Up @@ -27,6 +28,11 @@ async function getNuxtVersion(path: string): Promise<string | null> {
}
}

function hasPnpmWorkspaceFile(): boolean {
const pnpmWorkspaceFilePath = `${process.cwd()}/pnpm-workspace.yaml`
return existsSync(pnpmWorkspaceFilePath)
}
danielroe marked this conversation as resolved.
Show resolved Hide resolved

export default defineCommand({
meta: {
name: 'upgrade',
Expand Down Expand Up @@ -88,7 +94,7 @@ export default defineCommand({
execSync(
`${packageManager} ${
packageManager === 'yarn' ? 'add' : 'install'
} -D nuxt`,
} -D nuxt ${packageManager === 'pnpm' && hasPnpmWorkspaceFile() ? '-w' : ''}`,
danielroe marked this conversation as resolved.
Show resolved Hide resolved
{ stdio: 'inherit', cwd },
)

Expand Down