Skip to content
Open
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
32 changes: 20 additions & 12 deletions cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ const main = defineCommand({
description: 'Port to listen on',
default: String(DEFAULT_PORT),
},
yes: {
type: 'boolean',
description: 'Skip warning message and accept prompt',
default: false,
alias: ['y'],
},
},
async run({ args }) {
const port = Number.parseInt(args.port as string, 10) || DEFAULT_PORT
Expand All @@ -51,18 +57,20 @@ const main = defineCommand({

initLogger()

// Warning message and accept prompt
logWarning(
`This allows ${styleText('underline', 'npmx.dev')} to access your npm cli and any authenticated contexts.`,
)
const accept = await p.confirm({
message: 'Do you accept?',
initialValue: true,
})

if (!accept || p.isCancel(accept)) {
logError('Connector setup cancelled.')
process.exit(0)
if (!args.yes) {
// Warning message and accept prompt
logWarning(
`This allows ${styleText('underline', 'npmx.dev')} to access your npm cli and any authenticated contexts.`,
)
const accept = await p.confirm({
message: 'Do you accept?',
initialValue: true,
})

if (!accept || p.isCancel(accept)) {
logError('Connector setup cancelled.')
process.exit(0)
}
}

// Check npm authentication before starting
Expand Down
Loading