-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
87faa04
commit b44930b
Showing
6 changed files
with
154 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ socket --help | |
socket info [email protected] | ||
socket report create package.json --view | ||
socket report view QXU8PmK7LfH608RAwfIKdbcHgwEd_ZeWJ9QEGv05FJUQ | ||
socket wrapper --enable | ||
``` | ||
|
||
## Commands | ||
|
@@ -35,6 +36,10 @@ socket report view QXU8PmK7LfH608RAwfIKdbcHgwEd_ZeWJ9QEGv05FJUQ | |
|
||
* `socket report view <report-id>` - looks up issues and scores from a report | ||
|
||
* `socket wrapper --enable` and `socket wrapper --disable` - Enables and disables the Socket 'safe-npm' wrapper. | ||
|
||
* `socket raw-npm` and `socket raw-npx` - Temporarily disables the Socket 'safe-npm' wrapper. | ||
|
||
## Aliases | ||
|
||
All aliases supports flags and arguments of the commands they alias. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { spawn } from 'child_process' | ||
|
||
import meow from 'meow' | ||
|
||
import { validationFlags } from '../../flags/index.js' | ||
import { printFlagList } from '../../utils/formatting.js' | ||
|
||
/** @type {import('../../utils/meow-with-subcommands.js').CliSubcommand} */ | ||
export const rawNpm = { | ||
description: 'Temporarily disable the Socket npm wrapper', | ||
async run (argv, importMeta, { parentName }) { | ||
const name = parentName + ' raw-npm' | ||
|
||
setupCommand(name, rawNpm.description, argv, importMeta) | ||
} | ||
} | ||
|
||
/** | ||
* @param {string} name | ||
* @param {string} description | ||
* @param {readonly string[]} argv | ||
* @param {ImportMeta} importMeta | ||
* @returns {void} | ||
*/ | ||
function setupCommand (name, description, argv, importMeta) { | ||
const flags = validationFlags | ||
|
||
const cli = meow(` | ||
Usage | ||
$ ${name} <npm command> | ||
Options | ||
${printFlagList(flags, 6)} | ||
Examples | ||
$ ${name} install | ||
`, { | ||
argv, | ||
description, | ||
importMeta, | ||
flags | ||
}) | ||
|
||
if (!argv[0]) { | ||
cli.showHelp() | ||
return | ||
} | ||
|
||
spawn('npm', [argv.join(' ')], { | ||
stdio: 'inherit', | ||
shell: true | ||
}).on('exit', (code, signal) => { | ||
if (signal) { | ||
process.kill(process.pid, signal) | ||
} else if (code !== null) { | ||
process.exit(code) | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { spawn } from 'child_process' | ||
|
||
import meow from 'meow' | ||
|
||
import { validationFlags } from '../../flags/index.js' | ||
import { printFlagList } from '../../utils/formatting.js' | ||
|
||
/** @type {import('../../utils/meow-with-subcommands.js').CliSubcommand} */ | ||
export const rawNpx = { | ||
description: 'Temporarily disable the Socket npm/npx wrapper', | ||
async run (argv, importMeta, { parentName }) { | ||
const name = parentName + ' raw-npx' | ||
|
||
setupCommand(name, rawNpx.description, argv, importMeta) | ||
} | ||
} | ||
|
||
/** | ||
* @param {string} name | ||
* @param {string} description | ||
* @param {readonly string[]} argv | ||
* @param {ImportMeta} importMeta | ||
* @returns {void} | ||
*/ | ||
function setupCommand (name, description, argv, importMeta) { | ||
const flags = validationFlags | ||
|
||
const cli = meow(` | ||
Usage | ||
$ ${name} <npx command> | ||
Options | ||
${printFlagList(flags, 6)} | ||
Examples | ||
$ ${name} install | ||
`, { | ||
argv, | ||
description, | ||
importMeta, | ||
flags | ||
}) | ||
|
||
if (!argv[0]) { | ||
cli.showHelp() | ||
return | ||
} | ||
|
||
spawn('npx', [argv.join(' ')], { | ||
stdio: 'inherit', | ||
shell: true | ||
}).on('exit', (code, signal) => { | ||
if (signal) { | ||
process.kill(process.pid, signal) | ||
} else if (code !== null) { | ||
process.exit(code) | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters