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
1 change: 0 additions & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"citty": "^0.2.0",
"h3-next": "npm:h3@^2.0.1-rc.11",
"obug": "^2.1.1",
"picocolors": "^1.1.1",
"srvx": "^0.10.1",
"valibot": "^1.2.0",
"validate-npm-package-name": "^7.0.2"
Expand Down
4 changes: 2 additions & 2 deletions cli/src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env node
import process from 'node:process'
import { spawn } from 'node:child_process'
import { styleText } from 'node:util'
import * as p from '@clack/prompts'
import pc from 'picocolors'
import { defineCommand, runMain } from 'citty'
import { serve } from 'srvx'
import { createConnectorApp, generateToken, CONNECTOR_VERSION } from './server.ts'
Expand Down Expand Up @@ -52,7 +52,7 @@ const main = defineCommand({

// Warning message and accept prompt
logWarning(
`This allows ${pc.underline('npmx.dev')} to access your npm cli and any authenticated contexts.`,
`This allows ${styleText('underline', 'npmx.dev')} to access your npm cli and any authenticated contexts.`,
)
const accept = await p.confirm({
message: 'Do you accept?',
Expand Down
16 changes: 8 additions & 8 deletions cli/src/logger.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { styleText } from 'node:util'
import * as p from '@clack/prompts'
import pc from 'picocolors'
import { createDebug } from 'obug'

let isInitialized = false
Expand All @@ -10,35 +10,35 @@ let isInitialized = false
export function initLogger(): void {
if (isInitialized) return
isInitialized = true
p.intro(pc.bgCyan(pc.black(' npmx connector ')))
p.intro(styleText(['bgCyan', 'black'], ' npmx connector '))
}

/**
* Log when starting to execute a command
*/
export function logCommand(command: string): void {
p.log.step(pc.dim('$ ') + pc.cyan(command))
p.log.step(`${styleText('dim', '$ ')}${styleText('cyan', command)}`)
}

/**
* Log successful command completion
*/
export function logSuccess(message: string): void {
p.log.success(pc.green(message))
p.log.success(styleText('green', message))
}

/**
* Log command failure
*/
export function logError(message: string): void {
p.log.error(pc.red(message))
p.log.error(styleText('red', message))
}

/**
* Log warning
*/
export function logWarning(message: string): void {
p.log.warn(pc.yellow(message))
p.log.warn(styleText('yellow', message))
}

/**
Expand All @@ -61,9 +61,9 @@ export function showToken(token: string, port: number, frontendUrl: string): voi

p.note(
[
`Open: ${pc.bold(pc.underline(pc.cyan(connectUrl)))}`,
`Open: ${styleText(['bold', 'underline', 'cyan'], connectUrl)}`,
'',
pc.dim(`Or paste token manually: ${token}`),
styleText('dim', `Or paste token manually: ${token}`),
].join('\n'),
'Click to connect',
)
Expand Down
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading