Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 6 additions & 1 deletion packages/nuxi/src/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ export default defineCommand({
options: packageManagerOptions,
})

if (!packageManagerOptions.includes(selectedPackageManager)) {
logger.error('Invalid package manager selected.')
process.exit(1)
}

// Install project dependencies
// or skip installation based on the '--no-install' flag
if (ctx.args.install === false) {
Expand Down Expand Up @@ -183,7 +188,7 @@ export default defineCommand({
if (ctx.args.gitInit === undefined) {
ctx.args.gitInit = await logger.prompt('Initialize git repository?', {
type: 'confirm',
})
}) === true
}
if (ctx.args.gitInit) {
logger.info('Initializing git repository...\n')
Expand Down
5 changes: 4 additions & 1 deletion packages/nuxi/src/commands/module/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ async function addModules(modules: ResolvedModule[], { skipInstall, skipConfig,
},
)

if (res === false) {
if (res !== true) {
return
}
}
Expand Down Expand Up @@ -268,6 +268,9 @@ async function resolveModule(moduleName: string, cwd: string): Promise<ModuleRes
type: 'select',
options: [_moduleVersion, pkgVersion],
})
if (typeof pkgVersion !== 'string') {
return false
}
}
break
}
Expand Down
6 changes: 3 additions & 3 deletions packages/nuxi/src/commands/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ async function getNightlyVersion(packageNames: string[]): Promise<{ npmPackages:
'Which nightly Nuxt release channel do you want to install? (3.x or 4.x)',
{
type: 'select',
options: ['3.x', '4.x'],
options: ['3.x', '4.x'] as const,
default: '3.x',
},
) as '3.x' | '4.x'
)

const nuxtVersion = typeof result === 'string' ? result : '3.x'

Expand Down Expand Up @@ -138,7 +138,7 @@ export default defineCommand({
type: 'confirm',
default: true,
},
)
) === true
}
if (ctx.args.force) {
logger.info(
Expand Down
Loading