Skip to content

Commit 01ca983

Browse files
committed
fix(upgrade): clean lockfile in workspace dir
1 parent 5278c9e commit 01ca983

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/nuxi/src/commands/upgrade.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { defineCommand } from 'citty'
88
import { colors } from 'consola/utils'
99
import { addDependency, dedupeDependencies, detectPackageManager } from 'nypm'
1010
import { resolve } from 'pathe'
11-
import { readPackageJSON } from 'pkg-types'
11+
import { findWorkspaceDir, readPackageJSON } from 'pkg-types'
1212

1313
import { loadKit } from '../utils/kit'
1414
import { logger } from '../utils/logger'
@@ -108,7 +108,7 @@ export default defineCommand({
108108
const cwd = resolve(ctx.args.cwd || ctx.args.rootDir)
109109

110110
// Check package manager
111-
const packageManager = await detectPackageManager(cwd)
111+
const [packageManager, workspaceDir = cwd] = await Promise.all([detectPackageManager(cwd), findWorkspaceDir(cwd, { try: true })])
112112
if (!packageManager) {
113113
logger.error(
114114
`Unable to determine the package manager used by this project.\n\nNo lock files found in \`${cwd}\`, and no \`packageManager\` field specified in \`package.json\`.\n\nPlease either add the \`packageManager\` field to \`package.json\` or execute the installation command for your package manager. For example, you can use \`pnpm i\`, \`npm i\`, \`bun i\`, or \`yarn i\`, and then try again.`,
@@ -137,7 +137,7 @@ export default defineCommand({
137137
// Force install
138138
const toRemove = ['node_modules']
139139

140-
const lockFile = normaliseLockFile(cwd, lockFileCandidates)
140+
const lockFile = normaliseLockFile(workspaceDir, lockFileCandidates)
141141
if (lockFile) {
142142
toRemove.push(lockFile)
143143
}

0 commit comments

Comments
 (0)