File tree Expand file tree Collapse file tree 2 files changed +10
-66
lines changed Expand file tree Collapse file tree 2 files changed +10
-66
lines changed Original file line number Diff line number Diff line change 1- import path from 'node:path'
2-
3- import spawn from '@npmcli/promise-spawn'
4-
51import constants from '../constants'
62
73import type { CliSubcommand } from '../utils/meow-with-subcommands'
84
9- const { abortSignal, execPath, rootBinPath } = constants
10-
11- const description = 'npm wrapper functionality'
12-
135export const npm : CliSubcommand = {
14- description,
15- async run ( argv , _importMeta , _ctx ) {
16- const wrapperPath = path . join ( rootBinPath , 'npm-cli.js' )
17- process . exitCode = 1
18- const spawnPromise = spawn (
19- execPath ,
20- [
21- // Lazily access constants.nodeNoWarningsFlags.
22- ...constants . nodeNoWarningsFlags ,
23- wrapperPath ,
24- ...argv
25- ] ,
26- {
27- signal : abortSignal ,
28- stdio : 'inherit'
29- }
30- )
31- spawnPromise . process . on ( 'exit' , ( code , signal ) => {
32- if ( signal ) {
33- process . kill ( process . pid , signal )
34- } else if ( code !== null ) {
35- process . exit ( code )
36- }
37- } )
38- await spawnPromise
6+ description : 'npm wrapper functionality' ,
7+ async run ( argv ) {
8+ // Lazily access constants.DIST_TYPE.
9+ const shadowBin = require ( `../dist/${ constants . DIST_TYPE } /shadow-bin.js` )
10+ await shadowBin ( 'npm' , argv )
3911 }
4012}
Original file line number Diff line number Diff line change 1- import path from 'node:path'
2-
3- import spawn from '@npmcli/promise-spawn'
4-
51import constants from '../constants'
62
73import type { CliSubcommand } from '../utils/meow-with-subcommands'
84
9- const { abortSignal, execPath, rootBinPath } = constants
10-
11- const description = 'npx wrapper functionality'
12-
135export const npx : CliSubcommand = {
14- description,
15- async run ( argv , _importMeta , _ctx ) {
16- const wrapperPath = path . join ( rootBinPath , 'npx-cli.js' )
17- process . exitCode = 1
18- const spawnPromise = spawn (
19- execPath ,
20- [
21- // Lazily access constants.nodeNoWarningsFlags.
22- ...constants . nodeNoWarningsFlags ,
23- wrapperPath ,
24- ...argv
25- ] ,
26- {
27- abortSignal,
28- stdio : 'inherit'
29- }
30- )
31- spawnPromise . process . on ( 'exit' , ( code , signal ) => {
32- if ( signal ) {
33- process . kill ( process . pid , signal )
34- } else if ( code !== null ) {
35- process . exit ( code )
36- }
37- } )
38- await spawnPromise
6+ description : 'npx wrapper functionality' ,
7+ async run ( argv ) {
8+ // Lazily access constants.DIST_TYPE.
9+ const shadowBin = require ( `../dist/${ constants . DIST_TYPE } /shadow-bin.js` )
10+ await shadowBin ( 'npx' , argv )
3911 }
4012}
You can’t perform that action at this time.
0 commit comments