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: update command descriptions and defaults #601

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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: 4 additions & 3 deletions src/commands/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,19 @@ export default defineCommand({
...logLevelArgs,
force: {
type: 'boolean',
description: 'Override existing file',
description: 'Force override file if it already exists',
default: false,
},
template: {
type: 'positional',
required: true,
valueHint: Object.keys(templates).join('|'),
description: `Template type to scaffold`,
description: `Specify which template to generate`,
},
name: {
type: 'positional',
required: true,
description: 'Generated file name',
description: 'Specify name of the generated file',
},
},
async run(ctx) {
Expand Down
2 changes: 2 additions & 0 deletions src/commands/analyze.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ export default defineCommand({
type: 'string',
description: 'Name of the analysis',
default: 'default',
valueHint: 'name',
},
serve: {
type: 'boolean',
description: 'Serve the analysis results',
negativeDescription: 'Skip serving the analysis results',
default: true,
},
},
Expand Down
8 changes: 8 additions & 0 deletions src/commands/build-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,25 @@ export default defineCommand({
...cwdArgs,
...logLevelArgs,
...legacyRootDirArgs,
build: {
type: 'boolean',
description: 'Build module for distribution',
default: false,
},
stub: {
type: 'boolean',
description: 'Stub dist instead of actually building it for development',
default: false,
},
sourcemap: {
type: 'boolean',
description: 'Generate sourcemaps',
default: false,
},
prepare: {
type: 'boolean',
description: 'Prepare module for local development',
default: false,
},
},
async run(ctx) {
Expand Down
40 changes: 37 additions & 3 deletions src/commands/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import type { NuxtDevContext, NuxtDevIPCMessage } from '../utils/dev'
import { envNameArgs, legacyRootDirArgs, dotEnvArgs, cwdArgs, logLevelArgs } from './_shared'

const forkSupported = !isBun && !isTest
const listhenArgs = getListhenArgs()

const command = defineCommand({
meta: {
Expand All @@ -29,18 +30,51 @@ const command = defineCommand({
args: {
...cwdArgs,
...logLevelArgs,
...envNameArgs,
...legacyRootDirArgs,
...getListhenArgs(),
...dotEnvArgs,
...legacyRootDirArgs,
...envNameArgs,
clear: {
type: 'boolean',
description: 'Clear console on restart',
negativeDescription: 'Disable clear console on restart',
},
fork: {
type: 'boolean',
description: forkSupported ? 'Disable forked mode' : 'Enable forked mode',
negativeDescription: 'Disable forked mode',
default: forkSupported,
alias: ['f'],
},
...{
...listhenArgs,
'port': {
...listhenArgs.port,
description: 'Port to listen on (default: `NUXT_PORT || NITRO_PORT || PORT || nuxtOptions.devServer.port`)',
alias: ['p'],
},
'open': {
...listhenArgs.open,
alias: ['o'],
default: false,
},
'host': {
...listhenArgs.host,
alias: ['h'],
description: 'Host to listen on (default: `NUXT_HOST || NITRO_HOST || HOST || nuxtOptions._layers?.[0]?.devServer?.host`)',
},
'clipboard': { ...listhenArgs.clipboard, default: false },
'https.domains': {
...listhenArgs['https.domains'],
description: 'Comma separated list of domains and IPs, the autogenerated certificate should be valid for (https: true)',
},
},
sslCert: {
type: 'string',
description: '(DEPRECATED) Use `--https.cert` instead.',
},
sslKey: {
type: 'string',
description: '(DEPRECATED) Use `--https.key` instead.',
},
},
async run(ctx) {
Expand Down
6 changes: 5 additions & 1 deletion src/commands/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ export default defineCommand({
args: {
...cwdArgs,
...logLevelArgs,
preset: {
type: 'string',
description: 'Nitro server preset',
},
...dotEnvArgs,
...envNameArgs,
...legacyRootDirArgs,
...dotEnvArgs,
},
async run(ctx) {
ctx.args.prerender = true
Expand Down
1 change: 1 addition & 0 deletions src/commands/module/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default defineCommand({
description:
'Filter by Nuxt version and list compatible modules only (auto detected by default)',
required: false,
valueHint: '2|3',
},
},
async setup(ctx) {
Expand Down
3 changes: 2 additions & 1 deletion src/commands/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ export default defineCommand({
type: 'string',
alias: 'ch',
default: 'stable',
description: 'Specify a channel to install from (nightly or stable)',
description: 'Specify a channel to install from (default: stable)',
valueHint: 'stable|nightly',
},
},
async run(ctx) {
Expand Down
6 changes: 3 additions & 3 deletions src/utils/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ export interface NuxtDevContext {

export interface NuxtDevServerOptions {
cwd: string
logLevel: 'silent' | 'info' | 'verbose'
logLevel?: 'silent' | 'info' | 'verbose'
dotenv: boolean
envName: string
clear: boolean
envName?: string
clear?: boolean
overrides: NuxtConfig
port?: string | number
loadingTemplate?: ({ loading }: { loading: string }) => string
Expand Down
Loading