@socketsecurity/cli 0.4.2-provenance → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commands/index.js +2 -0
- package/lib/commands/npm/index.js +22 -0
- package/lib/commands/npx/index.js +22 -0
- package/lib/shadow/npm-cli.cjs +27 -0
- package/lib/shadow/npx-cli.cjs +27 -0
- package/package.json +12 -5
package/lib/commands/index.js
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { spawn } from 'child_process'
|
|
2
|
+
import { fileURLToPath } from 'url'
|
|
3
|
+
|
|
4
|
+
const description = 'npm wrapper functionality'
|
|
5
|
+
|
|
6
|
+
/** @type {import('../../utils/meow-with-subcommands').CliSubcommand} */
|
|
7
|
+
export const npm = {
|
|
8
|
+
description,
|
|
9
|
+
run: async (argv, _importMeta, _ctx) => {
|
|
10
|
+
const wrapperPath = fileURLToPath(new URL('../../shadow/npm-cli.cjs', import.meta.url))
|
|
11
|
+
process.exitCode = 1
|
|
12
|
+
spawn(process.execPath, [wrapperPath, ...argv], {
|
|
13
|
+
stdio: 'inherit'
|
|
14
|
+
}).on('exit', (code, signal) => {
|
|
15
|
+
if (signal) {
|
|
16
|
+
process.kill(process.pid, signal)
|
|
17
|
+
} else if (code !== null) {
|
|
18
|
+
process.exit(code)
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { spawn } from 'child_process'
|
|
2
|
+
import { fileURLToPath } from 'url'
|
|
3
|
+
|
|
4
|
+
const description = 'npx wrapper functionality'
|
|
5
|
+
|
|
6
|
+
/** @type {import('../../utils/meow-with-subcommands').CliSubcommand} */
|
|
7
|
+
export const npx = {
|
|
8
|
+
description,
|
|
9
|
+
run: async (argv, _importMeta, _ctx) => {
|
|
10
|
+
const wrapperPath = fileURLToPath(new URL('../../shadow/npx-cli.cjs', import.meta.url))
|
|
11
|
+
process.exitCode = 1
|
|
12
|
+
spawn(process.execPath, [wrapperPath, ...argv], {
|
|
13
|
+
stdio: 'inherit'
|
|
14
|
+
}).on('exit', (code, signal) => {
|
|
15
|
+
if (signal) {
|
|
16
|
+
process.kill(process.pid, signal)
|
|
17
|
+
} else if (code !== null) {
|
|
18
|
+
process.exit(code)
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// THIS FILE USES .cjs to get around the extension-free entrypoint problem with ESM
|
|
3
|
+
'use strict'
|
|
4
|
+
const { spawn } = require('child_process')
|
|
5
|
+
const { realpathSync } = require('fs')
|
|
6
|
+
const path = require('path')
|
|
7
|
+
|
|
8
|
+
const realFilename = realpathSync(__filename)
|
|
9
|
+
const realDirname = path.dirname(realFilename)
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
*/
|
|
13
|
+
async function main () {
|
|
14
|
+
const npmpath = await require('./link.cjs')(path.join(realDirname, 'bin'), 'npm')
|
|
15
|
+
process.exitCode = 1
|
|
16
|
+
const injectionpath = path.join(realDirname, 'npm-injection.cjs')
|
|
17
|
+
spawn(process.execPath, ['--require', injectionpath, npmpath, ...process.argv.slice(2)], {
|
|
18
|
+
stdio: 'inherit'
|
|
19
|
+
}).on('exit', (code, signal) => {
|
|
20
|
+
if (signal) {
|
|
21
|
+
process.kill(process.pid, signal)
|
|
22
|
+
} else if (code !== null) {
|
|
23
|
+
process.exit(code)
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
main()
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// THIS FILE USES .cjs to get around the extension-free entrypoint problem with ESM
|
|
3
|
+
'use strict'
|
|
4
|
+
const { spawn } = require('child_process')
|
|
5
|
+
const { realpathSync } = require('fs')
|
|
6
|
+
const path = require('path')
|
|
7
|
+
|
|
8
|
+
const realFilename = realpathSync(__filename)
|
|
9
|
+
const realDirname = path.dirname(realFilename)
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
*/
|
|
13
|
+
async function main () {
|
|
14
|
+
const npxpath = await require('./link.cjs')(path.join(realDirname, 'bin'), 'npx')
|
|
15
|
+
process.exitCode = 1
|
|
16
|
+
const injectionpath = path.join(realDirname, 'npm-injection.cjs')
|
|
17
|
+
spawn(process.execPath, ['--require', injectionpath, npxpath, ...process.argv.slice(2)], {
|
|
18
|
+
stdio: 'inherit'
|
|
19
|
+
}).on('exit', (code, signal) => {
|
|
20
|
+
if (signal) {
|
|
21
|
+
process.kill(process.pid, signal)
|
|
22
|
+
} else if (code !== null) {
|
|
23
|
+
process.exit(code)
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
main()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@socketsecurity/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "CLI tool for Socket.dev",
|
|
5
5
|
"homepage": "http://github.com/SocketDev/socket-cli-js",
|
|
6
6
|
"repository": {
|
|
@@ -15,18 +15,21 @@
|
|
|
15
15
|
},
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"engines": {
|
|
18
|
-
"node": "^14.18.0 ||
|
|
18
|
+
"node": "^14.18.0 || ^16.13.0 || >=18.0.0"
|
|
19
19
|
},
|
|
20
20
|
"type": "module",
|
|
21
21
|
"bin": {
|
|
22
|
-
"socket": "cli.js"
|
|
22
|
+
"socket": "cli.js",
|
|
23
|
+
"socket-npm": "lib/shadow/npm-cli.cjs",
|
|
24
|
+
"socket-npx": "lib/shadow/npx-cli.cjs"
|
|
23
25
|
},
|
|
24
26
|
"files": [
|
|
25
27
|
"cli.js",
|
|
26
28
|
"lib/**/*.js"
|
|
27
29
|
],
|
|
28
30
|
"scripts": {
|
|
29
|
-
"
|
|
31
|
+
"echo": "echo $PATH",
|
|
32
|
+
"check:dependency-check": "dependency-check '*.js' 'lib/shadow/*.cjs' '*.mjs' 'test/**/*.js' --no-dev",
|
|
30
33
|
"check:installed-check": "installed-check -i eslint-plugin-jsdoc",
|
|
31
34
|
"check:lint": "eslint --report-unused-disable-directives .",
|
|
32
35
|
"check:tsc": "tsc",
|
|
@@ -45,8 +48,11 @@
|
|
|
45
48
|
"@types/mocha": "^10.0.0",
|
|
46
49
|
"@types/mock-fs": "^4.13.1",
|
|
47
50
|
"@types/node": "^14.18.31",
|
|
51
|
+
"@types/npm": "^7.19.0",
|
|
52
|
+
"@types/npmcli__arborist": "^5.6.1",
|
|
48
53
|
"@types/prompts": "^2.4.1",
|
|
49
54
|
"@types/update-notifier": "^6.0.2",
|
|
55
|
+
"@types/which": "^2.0.2",
|
|
50
56
|
"@typescript-eslint/eslint-plugin": "^5.51.0",
|
|
51
57
|
"@typescript-eslint/parser": "^5.51.0",
|
|
52
58
|
"c8": "^7.12.0",
|
|
@@ -89,6 +95,7 @@
|
|
|
89
95
|
"pony-cause": "^2.1.8",
|
|
90
96
|
"prompts": "^2.4.2",
|
|
91
97
|
"terminal-link": "^3.0.0",
|
|
92
|
-
"update-notifier": "^6.0.2"
|
|
98
|
+
"update-notifier": "^6.0.2",
|
|
99
|
+
"which": "^3.0.0"
|
|
93
100
|
}
|
|
94
101
|
}
|