@@ -7,63 +7,72 @@ import { cmdit, invokeNpm } from '../../../test/utils'
77
88const { CLI } = constants
99
10- describe ( 'socket package score ' , async ( ) => {
10+ describe ( 'socket package shallow ' , async ( ) => {
1111 // Lazily access constants.rootBinPath.
1212 const entryPath = path . join ( constants . rootBinPath , `${ CLI } .js` )
1313
14- cmdit ( [ 'package' , 'score' , '--help' ] , 'should support --help' , async cmd => {
15- const { code, stderr, stdout } = await invokeNpm ( entryPath , cmd )
16- expect ( stdout ) . toMatchInlineSnapshot (
17- `
18- "Look up info regarding a package
14+ cmdit (
15+ [ 'package' , 'shallow' , '--help' ] ,
16+ 'should support --help' ,
17+ async cmd => {
18+ const { code, stderr, stdout } = await invokeNpm ( entryPath , cmd )
19+ expect ( stdout ) . toMatchInlineSnapshot (
20+ `
21+ "Look up info regarding one or more packages but not their transitives
1922
2023 Usage
21- $ socket package score <<ecosystem> <name> [<name> ...] | <purl> [<purl> ...]>
24+ $ socket package shallow <<ecosystem> <name> [<name> ...] | <purl> [<purl> ...]>
2225
2326 Options
2427 --dryRun Do input validation for a command and exit 0 when input is ok
2528 --help Print this help.
2629 --json Output result as json
2730 --markdown Output result as markdown
2831
29- Show scoring details for one or more packages.
32+ Requirements
33+ - quota: 100
34+ - scope: \`packages:list\`
35+
36+ Show scoring details for one or more packages purely based on their own package.
37+ This means that any dependency scores are not reflected by the score. You can
38+ use the \`socket package score <pkg>\` command to get its full transitive score.
39+
3040 Only a few ecosystems are supported like npm, golang, and maven.
3141
32- A "purl" is a standard package formatting: \`pkg:eco/name@version\`
33- The "pkg:" prefix is automatically prepended when not present.
42+ A "purl" is a standard package name formatting: \`pkg:eco/name@version\`
43+ This command will automatically prepend "pkg:" when not present.
3444
3545 If the first arg is an ecosystem, remaining args that are not a purl are
36- assumed to be scoped in that ecosystem or to be purls.
37-
38- This command takes 100 quota units (regardless of arg count).
39- This command requires \`packages:list\` scope access on your API token.
46+ assumed to be scoped to that ecosystem.
4047
4148 Examples
42- $ socket package score npm webtorrent
43- $ socket package score npm webtorrent@1.9.1
44- $ socket package score npm/webtorrent@1.9.1
45- $ socket package score pkg:npm/webtorrent@1.9.1
46- $ socket package score maven webtorrent babel
47- $ socket package score npm/webtorrent golang/babel
48- $ socket package score npm npm/webtorrent@1.0.1 babel"
49+ $ socket package shallow npm webtorrent
50+ $ socket package shallow npm webtorrent@1.9.1
51+ $ socket package shallow npm/webtorrent@1.9.1
52+ $ socket package shallow pkg:npm/webtorrent@1.9.1
53+ $ socket package shallow maven webtorrent babel
54+ $ socket package shallow npm/webtorrent golang/babel
55+ $ socket package shallow npm npm/webtorrent@1.0.1 babel"
4956 `
50- )
51- expect ( `\n ${ stderr } ` ) . toMatchInlineSnapshot ( `
57+ )
58+ expect ( `\n ${ stderr } ` ) . toMatchInlineSnapshot ( `
5259 "
5360 _____ _ _ /---------------
5461 | __|___ ___| |_ ___| |_ | Socket.dev CLI ver <redacted>
5562 |__ | . | _| '_| -_| _| | Node: <redacted>, API token set: <redacted>
56- |_____|___|___|_,_|___|_|.dev | Command: \`socket package score \`, cwd: <redacted>"
63+ |_____|___|___|_,_|___|_|.dev | Command: \`socket package shallow \`, cwd: <redacted>"
5764 ` )
5865
59- expect ( code , 'help should exit with code 2' ) . toBe ( 2 )
60- expect ( stderr , 'header should include command (without params)' ) . toContain (
61- '`socket package score`'
62- )
63- } )
66+ expect ( code , 'help should exit with code 2' ) . toBe ( 2 )
67+ expect (
68+ stderr ,
69+ 'header should include command (without params)'
70+ ) . toContain ( '`socket package shallow`' )
71+ }
72+ )
6473
6574 cmdit (
66- [ 'package' , 'score ' , '--dry-run' ] ,
75+ [ 'package' , 'shallow ' , '--dry-run' ] ,
6776 'should require args with just dry-run' ,
6877 async cmd => {
6978 const { code, stderr, stdout } = await invokeNpm ( entryPath , cmd )
@@ -73,7 +82,7 @@ describe('socket package score', async () => {
7382 _____ _ _ /---------------
7483 | __|___ ___| |_ ___| |_ | Socket.dev CLI ver <redacted>
7584 |__ | . | _| '_| -_| _| | Node: <redacted>, API token set: <redacted>
76- |_____|___|___|_,_|___|_|.dev | Command: \`socket package score \`, cwd: <redacted>
85+ |_____|___|___|_,_|___|_|.dev | Command: \`socket package shallow \`, cwd: <redacted>
7786
7887 \\x1b[31m\\xd7\\x1b[39m \\x1b[41m\\x1b[37mInput error\\x1b[39m\\x1b[49m: Please provide the required fields:
7988
@@ -87,7 +96,7 @@ describe('socket package score', async () => {
8796 )
8897
8998 cmdit (
90- [ 'package' , 'score ' , 'npm' , 'babel' , '--dry-run' ] ,
99+ [ 'package' , 'shallow ' , 'npm' , 'babel' , '--dry-run' ] ,
91100 'should require args with just dry-run' ,
92101 async cmd => {
93102 const { code, stderr, stdout } = await invokeNpm ( entryPath , cmd )
@@ -97,7 +106,7 @@ describe('socket package score', async () => {
97106 _____ _ _ /---------------
98107 | __|___ ___| |_ ___| |_ | Socket.dev CLI ver <redacted>
99108 |__ | . | _| '_| -_| _| | Node: <redacted>, API token set: <redacted>
100- |_____|___|___|_,_|___|_|.dev | Command: \`socket package score \`, cwd: <redacted>"
109+ |_____|___|___|_,_|___|_|.dev | Command: \`socket package shallow \`, cwd: <redacted>"
101110 ` )
102111
103112 expect ( code , 'dry-run should exit with code 0 if input ok' ) . toBe ( 0 )
0 commit comments