From fe19e5dbe00cde29aac94eddfb912c32976ef138 Mon Sep 17 00:00:00 2001 From: mathuraditya724 Date: Mon, 23 Mar 2026 20:39:56 +0530 Subject: [PATCH 1/4] fix(cli): avoid DEP0190 warning by removing shell-based npm execution on Windows --- cli/src/cli.ts | 4 ++-- cli/src/npm-client.ts | 16 +++++++--------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/cli/src/cli.ts b/cli/src/cli.ts index e122cec9f..823656bbc 100644 --- a/cli/src/cli.ts +++ b/cli/src/cli.ts @@ -12,12 +12,12 @@ import { initLogger, showToken, logInfo, logWarning, logError } from './logger.t const DEFAULT_PORT = 31415 const DEFAULT_FRONTEND_URL = 'https://npmx.dev/' const DEV_FRONTEND_URL = 'http://127.0.0.1:3000/' +const NPM_COMMAND = process.platform === 'win32' ? 'npm.cmd' : 'npm' async function runNpmLogin(): Promise { return new Promise(resolve => { - const child = spawn('npm', ['login', `--registry=${NPM_REGISTRY_URL}`], { + const child = spawn(NPM_COMMAND, ['login', `--registry=${NPM_REGISTRY_URL}`], { stdio: 'inherit', - shell: true, }) child.on('close', code => { diff --git a/cli/src/npm-client.ts b/cli/src/npm-client.ts index 8448413b5..6b70484f8 100644 --- a/cli/src/npm-client.ts +++ b/cli/src/npm-client.ts @@ -11,6 +11,7 @@ import { logCommand, logSuccess, logError, logDebug } from './logger.ts' const execFileAsync = promisify(execFile) export const NPM_REGISTRY_URL = 'https://registry.npmjs.org/' +const NPM_COMMAND = process.platform === 'win32' ? 'npm.cmd' : 'npm' function createNpmEnv(overrides: Record = {}): Record { return { @@ -209,7 +210,7 @@ async function execNpmInteractive( env.npm_config_browser = 'false' } - const child = pty.spawn('npm', npmArgs, { + const child = pty.spawn(NPM_COMMAND, npmArgs, { name: 'xterm-256color', cols: 120, rows: 30, @@ -331,14 +332,12 @@ async function execNpm(args: string[], options: ExecNpmOptions = {}): Promise Date: Tue, 24 Mar 2026 15:59:26 +0530 Subject: [PATCH 2/4] fix(cli): centralize cross-platform npm process execution without shell --- cli/src/cli.ts | 10 +++++++--- cli/src/npm-client.ts | 14 +++++++------- cli/src/npm-process.ts | 24 ++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 cli/src/npm-process.ts diff --git a/cli/src/cli.ts b/cli/src/cli.ts index 823656bbc..1ddc2c688 100644 --- a/cli/src/cli.ts +++ b/cli/src/cli.ts @@ -8,15 +8,19 @@ import { serve } from 'srvx' import { createConnectorApp, generateToken, CONNECTOR_VERSION } from './server.ts' import { getNpmUser, NPM_REGISTRY_URL } from './npm-client.ts' import { initLogger, showToken, logInfo, logWarning, logError } from './logger.ts' +import { resolveNpmProcessCommand } from './npm-process.ts' const DEFAULT_PORT = 31415 const DEFAULT_FRONTEND_URL = 'https://npmx.dev/' const DEV_FRONTEND_URL = 'http://127.0.0.1:3000/' -const NPM_COMMAND = process.platform === 'win32' ? 'npm.cmd' : 'npm' - async function runNpmLogin(): Promise { return new Promise(resolve => { - const child = spawn(NPM_COMMAND, ['login', `--registry=${NPM_REGISTRY_URL}`], { + const { command, args } = resolveNpmProcessCommand([ + 'login', + `--registry=${NPM_REGISTRY_URL}`, + ]) + + const child = spawn(command, args, { stdio: 'inherit', }) diff --git a/cli/src/npm-client.ts b/cli/src/npm-client.ts index 6b70484f8..076ff5a18 100644 --- a/cli/src/npm-client.ts +++ b/cli/src/npm-client.ts @@ -8,10 +8,10 @@ import { join } from 'node:path' import * as v from 'valibot' import { PackageNameSchema, UsernameSchema, OrgNameSchema, ScopeTeamSchema } from './schemas.ts' import { logCommand, logSuccess, logError, logDebug } from './logger.ts' +import { resolveNpmProcessCommand } from './npm-process.ts' const execFileAsync = promisify(execFile) export const NPM_REGISTRY_URL = 'https://registry.npmjs.org/' -const NPM_COMMAND = process.platform === 'win32' ? 'npm.cmd' : 'npm' function createNpmEnv(overrides: Record = {}): Record { return { @@ -210,7 +210,7 @@ async function execNpmInteractive( env.npm_config_browser = 'false' } - const child = pty.spawn(NPM_COMMAND, npmArgs, { + const child = pty.spawn('npm', npmArgs, { name: 'xterm-256color', cols: 120, rows: 30, @@ -332,10 +332,9 @@ async function execNpm(args: string[], options: ExecNpmOptions = {}): Promise Date: Tue, 24 Mar 2026 10:30:53 +0000 Subject: [PATCH 3/4] [autofix.ci] apply automated fixes --- cli/src/cli.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cli/src/cli.ts b/cli/src/cli.ts index 1ddc2c688..1b64b8a04 100644 --- a/cli/src/cli.ts +++ b/cli/src/cli.ts @@ -15,10 +15,7 @@ const DEFAULT_FRONTEND_URL = 'https://npmx.dev/' const DEV_FRONTEND_URL = 'http://127.0.0.1:3000/' async function runNpmLogin(): Promise { return new Promise(resolve => { - const { command, args } = resolveNpmProcessCommand([ - 'login', - `--registry=${NPM_REGISTRY_URL}`, - ]) + const { command, args } = resolveNpmProcessCommand(['login', `--registry=${NPM_REGISTRY_URL}`]) const child = spawn(command, args, { stdio: 'inherit', From ac648f1a926d964b6b70e20c26bdda28bdb58274 Mon Sep 17 00:00:00 2001 From: mathuraditya724 Date: Tue, 24 Mar 2026 16:07:28 +0530 Subject: [PATCH 4/4] chore: minor changes --- cli/src/npm-process.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/src/npm-process.ts b/cli/src/npm-process.ts index 8dd796e81..44cb6ebfb 100644 --- a/cli/src/npm-process.ts +++ b/cli/src/npm-process.ts @@ -1,6 +1,6 @@ import process from 'node:process' -export interface NpmProcessCommand { +interface NpmProcessCommand { command: string args: string[] }