@socketsecurity/cli 0.14.104 → 0.14.106
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/dist/module-sync/arborist-helpers.d.ts +1 -1
- package/dist/module-sync/cli.js +536 -209
- package/dist/module-sync/cli.js.map +1 -1
- package/dist/module-sync/shadow-npm-inject.js +18 -12
- package/dist/module-sync/shadow-npm-inject.js.map +1 -1
- package/dist/require/cli.js +536 -209
- package/dist/require/cli.js.map +1 -1
- package/dist/require/shadow-npm-inject.js +18 -12
- package/dist/require/shadow-npm-inject.js.map +1 -1
- package/package.json +4 -4
package/dist/require/cli.js
CHANGED
|
@@ -602,6 +602,8 @@ const commonFlags = {
|
|
|
602
602
|
dryRun: {
|
|
603
603
|
type: 'boolean',
|
|
604
604
|
default: false,
|
|
605
|
+
hidden: true,
|
|
606
|
+
// Only show in root command
|
|
605
607
|
description: 'Do input validation for a command and exit 0 when input is ok'
|
|
606
608
|
},
|
|
607
609
|
help: {
|
|
@@ -739,6 +741,21 @@ async function meowWithSubcommands(subcommands, options) {
|
|
|
739
741
|
...commonFlags,
|
|
740
742
|
...additionalOptions.flags
|
|
741
743
|
}
|
|
744
|
+
|
|
745
|
+
// No further args or first arg is a flag (shrug)
|
|
746
|
+
if (
|
|
747
|
+
name === 'socket' &&
|
|
748
|
+
(!commandOrAliasName || commandOrAliasName?.startsWith('-'))
|
|
749
|
+
) {
|
|
750
|
+
flags['dryRun'] = {
|
|
751
|
+
type: 'boolean',
|
|
752
|
+
default: false,
|
|
753
|
+
hidden: false,
|
|
754
|
+
// Only show on root
|
|
755
|
+
description:
|
|
756
|
+
'Do input validation for a command and exit 0 when input is ok. Every command should support this flag (not shown on help screens)'
|
|
757
|
+
}
|
|
758
|
+
}
|
|
742
759
|
const cli = vendor.meow(
|
|
743
760
|
`
|
|
744
761
|
Usage
|
|
@@ -900,7 +917,7 @@ function emitBanner(name) {
|
|
|
900
917
|
logger.logger.error(getAsciiHeader(name))
|
|
901
918
|
}
|
|
902
919
|
function getAsciiHeader(command) {
|
|
903
|
-
const cliVersion = '0.14.
|
|
920
|
+
const cliVersion = '0.14.106:968fc98:25a28d7a:pub' // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION_HASH']".
|
|
904
921
|
const nodeVersion = process$1.version
|
|
905
922
|
const apiToken = shadowNpmInject.getDefaultToken()
|
|
906
923
|
const shownToken = apiToken ? getLastFiveOfApiToken(apiToken) : 'no'
|
|
@@ -923,8 +940,8 @@ function getAsciiHeader(command) {
|
|
|
923
940
|
return ` ${body}\n`
|
|
924
941
|
}
|
|
925
942
|
|
|
926
|
-
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$
|
|
927
|
-
const config$
|
|
943
|
+
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$J } = constants
|
|
944
|
+
const config$M = {
|
|
928
945
|
commandName: 'analytics',
|
|
929
946
|
description: `Look up analytics data`,
|
|
930
947
|
hidden: false,
|
|
@@ -979,14 +996,14 @@ const config$L = {
|
|
|
979
996
|
`
|
|
980
997
|
}
|
|
981
998
|
const cmdAnalytics = {
|
|
982
|
-
description: config$
|
|
983
|
-
hidden: config$
|
|
984
|
-
run: run$
|
|
999
|
+
description: config$M.description,
|
|
1000
|
+
hidden: config$M.hidden,
|
|
1001
|
+
run: run$M
|
|
985
1002
|
}
|
|
986
|
-
async function run$
|
|
1003
|
+
async function run$M(argv, importMeta, { parentName }) {
|
|
987
1004
|
const cli = meowOrExit({
|
|
988
1005
|
argv,
|
|
989
|
-
config: config$
|
|
1006
|
+
config: config$M,
|
|
990
1007
|
importMeta,
|
|
991
1008
|
parentName
|
|
992
1009
|
})
|
|
@@ -1041,7 +1058,7 @@ async function run$L(argv, importMeta, { parentName }) {
|
|
|
1041
1058
|
return
|
|
1042
1059
|
}
|
|
1043
1060
|
if (cli.flags['dryRun']) {
|
|
1044
|
-
logger.logger.log(DRY_RUN_BAIL_TEXT$
|
|
1061
|
+
logger.logger.log(DRY_RUN_BAIL_TEXT$J)
|
|
1045
1062
|
return
|
|
1046
1063
|
}
|
|
1047
1064
|
assert(assertScope(scope))
|
|
@@ -1216,8 +1233,8 @@ async function handleAuditLog({ logType, orgSlug, outputKind, page, perPage }) {
|
|
|
1216
1233
|
})
|
|
1217
1234
|
}
|
|
1218
1235
|
|
|
1219
|
-
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$
|
|
1220
|
-
const config$
|
|
1236
|
+
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$I } = constants
|
|
1237
|
+
const config$L = {
|
|
1221
1238
|
commandName: 'audit-log',
|
|
1222
1239
|
description: 'Look up the audit log for an organization',
|
|
1223
1240
|
hidden: false,
|
|
@@ -1262,14 +1279,14 @@ const config$K = {
|
|
|
1262
1279
|
`
|
|
1263
1280
|
}
|
|
1264
1281
|
const cmdAuditLog = {
|
|
1265
|
-
description: config$
|
|
1266
|
-
hidden: config$
|
|
1267
|
-
run: run$
|
|
1282
|
+
description: config$L.description,
|
|
1283
|
+
hidden: config$L.hidden,
|
|
1284
|
+
run: run$L
|
|
1268
1285
|
}
|
|
1269
|
-
async function run$
|
|
1286
|
+
async function run$L(argv, importMeta, { parentName }) {
|
|
1270
1287
|
const cli = meowOrExit({
|
|
1271
1288
|
argv,
|
|
1272
|
-
config: config$
|
|
1289
|
+
config: config$L,
|
|
1273
1290
|
importMeta,
|
|
1274
1291
|
parentName
|
|
1275
1292
|
})
|
|
@@ -1306,7 +1323,7 @@ async function run$K(argv, importMeta, { parentName }) {
|
|
|
1306
1323
|
return
|
|
1307
1324
|
}
|
|
1308
1325
|
if (cli.flags['dryRun']) {
|
|
1309
|
-
logger.logger.log(DRY_RUN_BAIL_TEXT$
|
|
1326
|
+
logger.logger.log(DRY_RUN_BAIL_TEXT$I)
|
|
1310
1327
|
return
|
|
1311
1328
|
}
|
|
1312
1329
|
await handleAuditLog({
|
|
@@ -1436,7 +1453,7 @@ function isHelpFlag(cmdArg) {
|
|
|
1436
1453
|
}
|
|
1437
1454
|
|
|
1438
1455
|
// import { meowOrExit } from '../../utils/meow-with-subcommands'
|
|
1439
|
-
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$
|
|
1456
|
+
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$H } = constants
|
|
1440
1457
|
|
|
1441
1458
|
// TODO: convert yargs to meow. Or convert all the other things to yargs.
|
|
1442
1459
|
const toLower = arg => arg.toLowerCase()
|
|
@@ -1552,7 +1569,7 @@ const yargsConfig = {
|
|
|
1552
1569
|
'spec-version'
|
|
1553
1570
|
]
|
|
1554
1571
|
}
|
|
1555
|
-
const config$
|
|
1572
|
+
const config$K = {
|
|
1556
1573
|
commandName: 'cdxgen',
|
|
1557
1574
|
description: 'Create an SBOM with CycloneDX generator (cdxgen)',
|
|
1558
1575
|
hidden: false,
|
|
@@ -1568,16 +1585,16 @@ const config$J = {
|
|
|
1568
1585
|
`
|
|
1569
1586
|
}
|
|
1570
1587
|
const cmdCdxgen = {
|
|
1571
|
-
description: config$
|
|
1572
|
-
hidden: config$
|
|
1573
|
-
run: run$
|
|
1588
|
+
description: config$K.description,
|
|
1589
|
+
hidden: config$K.hidden,
|
|
1590
|
+
run: run$K
|
|
1574
1591
|
}
|
|
1575
|
-
async function run$
|
|
1592
|
+
async function run$K(argv, importMeta, { parentName }) {
|
|
1576
1593
|
const cli = meowOrExit({
|
|
1577
1594
|
allowUnknownFlags: true,
|
|
1578
1595
|
// Don't let meow take over --help.
|
|
1579
1596
|
argv: argv.filter(a => !isHelpFlag(a)),
|
|
1580
|
-
config: config$
|
|
1597
|
+
config: config$K,
|
|
1581
1598
|
importMeta,
|
|
1582
1599
|
parentName
|
|
1583
1600
|
})
|
|
@@ -1599,7 +1616,7 @@ async function run$J(argv, importMeta, { parentName }) {
|
|
|
1599
1616
|
return
|
|
1600
1617
|
}
|
|
1601
1618
|
if (cli.flags['dryRun']) {
|
|
1602
|
-
logger.logger.log(DRY_RUN_BAIL_TEXT$
|
|
1619
|
+
logger.logger.log(DRY_RUN_BAIL_TEXT$H)
|
|
1603
1620
|
return
|
|
1604
1621
|
}
|
|
1605
1622
|
if (yargv.output === undefined) {
|
|
@@ -2447,8 +2464,8 @@ async function handleCI() {
|
|
|
2447
2464
|
})
|
|
2448
2465
|
}
|
|
2449
2466
|
|
|
2450
|
-
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$
|
|
2451
|
-
const config$
|
|
2467
|
+
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$G } = constants
|
|
2468
|
+
const config$J = {
|
|
2452
2469
|
commandName: 'ci',
|
|
2453
2470
|
description:
|
|
2454
2471
|
'Create a new scan and report whether it passes your security policy',
|
|
@@ -2468,19 +2485,19 @@ const config$I = {
|
|
|
2468
2485
|
`
|
|
2469
2486
|
}
|
|
2470
2487
|
const cmdCI = {
|
|
2471
|
-
description: config$
|
|
2472
|
-
hidden: config$
|
|
2473
|
-
run: run$
|
|
2488
|
+
description: config$J.description,
|
|
2489
|
+
hidden: config$J.hidden,
|
|
2490
|
+
run: run$J
|
|
2474
2491
|
}
|
|
2475
|
-
async function run$
|
|
2492
|
+
async function run$J(argv, importMeta, { parentName }) {
|
|
2476
2493
|
const cli = meowOrExit({
|
|
2477
2494
|
argv,
|
|
2478
|
-
config: config$
|
|
2495
|
+
config: config$J,
|
|
2479
2496
|
importMeta,
|
|
2480
2497
|
parentName
|
|
2481
2498
|
})
|
|
2482
2499
|
if (cli.flags['dryRun']) {
|
|
2483
|
-
logger.logger.log(DRY_RUN_BAIL_TEXT$
|
|
2500
|
+
logger.logger.log(DRY_RUN_BAIL_TEXT$G)
|
|
2484
2501
|
return
|
|
2485
2502
|
}
|
|
2486
2503
|
await handleCI()
|
|
@@ -2727,8 +2744,8 @@ async function handleConfigAuto({ key, outputKind }) {
|
|
|
2727
2744
|
await outputConfigAuto(key, result, outputKind)
|
|
2728
2745
|
}
|
|
2729
2746
|
|
|
2730
|
-
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$
|
|
2731
|
-
const config$
|
|
2747
|
+
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$F } = constants
|
|
2748
|
+
const config$I = {
|
|
2732
2749
|
commandName: 'auto',
|
|
2733
2750
|
description: 'Automatically discover and set the correct value config item',
|
|
2734
2751
|
hidden: false,
|
|
@@ -2759,14 +2776,14 @@ ${Array.from(shadowNpmInject.supportedConfigKeys.entries())
|
|
|
2759
2776
|
`
|
|
2760
2777
|
}
|
|
2761
2778
|
const cmdConfigAuto = {
|
|
2762
|
-
description: config$
|
|
2763
|
-
hidden: config$
|
|
2764
|
-
run: run$
|
|
2779
|
+
description: config$I.description,
|
|
2780
|
+
hidden: config$I.hidden,
|
|
2781
|
+
run: run$I
|
|
2765
2782
|
}
|
|
2766
|
-
async function run$
|
|
2783
|
+
async function run$I(argv, importMeta, { parentName }) {
|
|
2767
2784
|
const cli = meowOrExit({
|
|
2768
2785
|
argv,
|
|
2769
|
-
config: config$
|
|
2786
|
+
config: config$I,
|
|
2770
2787
|
importMeta,
|
|
2771
2788
|
parentName
|
|
2772
2789
|
})
|
|
@@ -2792,7 +2809,7 @@ async function run$H(argv, importMeta, { parentName }) {
|
|
|
2792
2809
|
return
|
|
2793
2810
|
}
|
|
2794
2811
|
if (cli.flags['dryRun']) {
|
|
2795
|
-
logger.logger.log(DRY_RUN_BAIL_TEXT$
|
|
2812
|
+
logger.logger.log(DRY_RUN_BAIL_TEXT$F)
|
|
2796
2813
|
return
|
|
2797
2814
|
}
|
|
2798
2815
|
await handleConfigAuto({
|
|
@@ -2846,8 +2863,8 @@ async function handleConfigGet({ key, outputKind }) {
|
|
|
2846
2863
|
await outputConfigGet(key, value, readOnly, outputKind)
|
|
2847
2864
|
}
|
|
2848
2865
|
|
|
2849
|
-
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$
|
|
2850
|
-
const config$
|
|
2866
|
+
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$E } = constants
|
|
2867
|
+
const config$H = {
|
|
2851
2868
|
commandName: 'get',
|
|
2852
2869
|
description: 'Get the value of a local CLI config item',
|
|
2853
2870
|
hidden: false,
|
|
@@ -2873,14 +2890,14 @@ ${Array.from(shadowNpmInject.supportedConfigKeys.entries())
|
|
|
2873
2890
|
`
|
|
2874
2891
|
}
|
|
2875
2892
|
const cmdConfigGet = {
|
|
2876
|
-
description: config$
|
|
2877
|
-
hidden: config$
|
|
2878
|
-
run: run$
|
|
2893
|
+
description: config$H.description,
|
|
2894
|
+
hidden: config$H.hidden,
|
|
2895
|
+
run: run$H
|
|
2879
2896
|
}
|
|
2880
|
-
async function run$
|
|
2897
|
+
async function run$H(argv, importMeta, { parentName }) {
|
|
2881
2898
|
const cli = meowOrExit({
|
|
2882
2899
|
argv,
|
|
2883
|
-
config: config$
|
|
2900
|
+
config: config$H,
|
|
2884
2901
|
importMeta,
|
|
2885
2902
|
parentName
|
|
2886
2903
|
})
|
|
@@ -2906,7 +2923,7 @@ async function run$G(argv, importMeta, { parentName }) {
|
|
|
2906
2923
|
return
|
|
2907
2924
|
}
|
|
2908
2925
|
if (cli.flags['dryRun']) {
|
|
2909
|
-
logger.logger.log(DRY_RUN_BAIL_TEXT$
|
|
2926
|
+
logger.logger.log(DRY_RUN_BAIL_TEXT$E)
|
|
2910
2927
|
return
|
|
2911
2928
|
}
|
|
2912
2929
|
await handleConfigGet({
|
|
@@ -2968,8 +2985,8 @@ async function outputConfigList({ full, outputKind }) {
|
|
|
2968
2985
|
}
|
|
2969
2986
|
}
|
|
2970
2987
|
|
|
2971
|
-
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$
|
|
2972
|
-
const config$
|
|
2988
|
+
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$D } = constants
|
|
2989
|
+
const config$G = {
|
|
2973
2990
|
commandName: 'list',
|
|
2974
2991
|
description: 'Show all local CLI config items and their values',
|
|
2975
2992
|
hidden: false,
|
|
@@ -3000,14 +3017,14 @@ ${Array.from(shadowNpmInject.supportedConfigKeys.entries())
|
|
|
3000
3017
|
`
|
|
3001
3018
|
}
|
|
3002
3019
|
const cmdConfigList = {
|
|
3003
|
-
description: config$
|
|
3004
|
-
hidden: config$
|
|
3005
|
-
run: run$
|
|
3020
|
+
description: config$G.description,
|
|
3021
|
+
hidden: config$G.hidden,
|
|
3022
|
+
run: run$G
|
|
3006
3023
|
}
|
|
3007
|
-
async function run$
|
|
3024
|
+
async function run$G(argv, importMeta, { parentName }) {
|
|
3008
3025
|
const cli = meowOrExit({
|
|
3009
3026
|
argv,
|
|
3010
|
-
config: config$
|
|
3027
|
+
config: config$G,
|
|
3011
3028
|
importMeta,
|
|
3012
3029
|
parentName
|
|
3013
3030
|
})
|
|
@@ -3024,7 +3041,7 @@ async function run$F(argv, importMeta, { parentName }) {
|
|
|
3024
3041
|
return
|
|
3025
3042
|
}
|
|
3026
3043
|
if (cli.flags['dryRun']) {
|
|
3027
|
-
logger.logger.log(DRY_RUN_BAIL_TEXT$
|
|
3044
|
+
logger.logger.log(DRY_RUN_BAIL_TEXT$D)
|
|
3028
3045
|
return
|
|
3029
3046
|
}
|
|
3030
3047
|
await outputConfigList({
|
|
@@ -3069,8 +3086,8 @@ async function handleConfigSet({ key, outputKind, value }) {
|
|
|
3069
3086
|
await outputConfigSet(key, value, readOnly, outputKind)
|
|
3070
3087
|
}
|
|
3071
3088
|
|
|
3072
|
-
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$
|
|
3073
|
-
const config$
|
|
3089
|
+
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$C } = constants
|
|
3090
|
+
const config$F = {
|
|
3074
3091
|
commandName: 'set',
|
|
3075
3092
|
description: 'Update the value of a local CLI config item',
|
|
3076
3093
|
hidden: false,
|
|
@@ -3101,14 +3118,14 @@ ${Array.from(shadowNpmInject.supportedConfigKeys.entries())
|
|
|
3101
3118
|
`
|
|
3102
3119
|
}
|
|
3103
3120
|
const cmdConfigSet = {
|
|
3104
|
-
description: config$
|
|
3105
|
-
hidden: config$
|
|
3106
|
-
run: run$
|
|
3121
|
+
description: config$F.description,
|
|
3122
|
+
hidden: config$F.hidden,
|
|
3123
|
+
run: run$F
|
|
3107
3124
|
}
|
|
3108
|
-
async function run$
|
|
3125
|
+
async function run$F(argv, importMeta, { parentName }) {
|
|
3109
3126
|
const cli = meowOrExit({
|
|
3110
3127
|
argv,
|
|
3111
|
-
config: config$
|
|
3128
|
+
config: config$F,
|
|
3112
3129
|
importMeta,
|
|
3113
3130
|
parentName
|
|
3114
3131
|
})
|
|
@@ -3143,7 +3160,7 @@ async function run$E(argv, importMeta, { parentName }) {
|
|
|
3143
3160
|
return
|
|
3144
3161
|
}
|
|
3145
3162
|
if (cli.flags['dryRun']) {
|
|
3146
|
-
logger.logger.log(DRY_RUN_BAIL_TEXT$
|
|
3163
|
+
logger.logger.log(DRY_RUN_BAIL_TEXT$C)
|
|
3147
3164
|
return
|
|
3148
3165
|
}
|
|
3149
3166
|
await handleConfigSet({
|
|
@@ -3175,8 +3192,8 @@ async function handleConfigUnset({ key, outputKind }) {
|
|
|
3175
3192
|
await outputConfigUnset(key, outputKind)
|
|
3176
3193
|
}
|
|
3177
3194
|
|
|
3178
|
-
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$
|
|
3179
|
-
const config$
|
|
3195
|
+
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$B } = constants
|
|
3196
|
+
const config$E = {
|
|
3180
3197
|
commandName: 'unset',
|
|
3181
3198
|
description: 'Clear the value of a local CLI config item',
|
|
3182
3199
|
hidden: false,
|
|
@@ -3202,14 +3219,14 @@ ${Array.from(shadowNpmInject.supportedConfigKeys.entries())
|
|
|
3202
3219
|
`
|
|
3203
3220
|
}
|
|
3204
3221
|
const cmdConfigUnset = {
|
|
3205
|
-
description: config$
|
|
3206
|
-
hidden: config$
|
|
3207
|
-
run: run$
|
|
3222
|
+
description: config$E.description,
|
|
3223
|
+
hidden: config$E.hidden,
|
|
3224
|
+
run: run$E
|
|
3208
3225
|
}
|
|
3209
|
-
async function run$
|
|
3226
|
+
async function run$E(argv, importMeta, { parentName }) {
|
|
3210
3227
|
const cli = meowOrExit({
|
|
3211
3228
|
argv,
|
|
3212
|
-
config: config$
|
|
3229
|
+
config: config$E,
|
|
3213
3230
|
importMeta,
|
|
3214
3231
|
parentName
|
|
3215
3232
|
})
|
|
@@ -3235,7 +3252,7 @@ async function run$D(argv, importMeta, { parentName }) {
|
|
|
3235
3252
|
return
|
|
3236
3253
|
}
|
|
3237
3254
|
if (cli.flags['dryRun']) {
|
|
3238
|
-
logger.logger.log(DRY_RUN_BAIL_TEXT$
|
|
3255
|
+
logger.logger.log(DRY_RUN_BAIL_TEXT$B)
|
|
3239
3256
|
return
|
|
3240
3257
|
}
|
|
3241
3258
|
await handleConfigUnset({
|
|
@@ -3362,8 +3379,8 @@ async function handleDependencies({ limit, offset, outputKind }) {
|
|
|
3362
3379
|
})
|
|
3363
3380
|
}
|
|
3364
3381
|
|
|
3365
|
-
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$
|
|
3366
|
-
const config$
|
|
3382
|
+
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$A } = constants
|
|
3383
|
+
const config$D = {
|
|
3367
3384
|
commandName: 'dependencies',
|
|
3368
3385
|
description:
|
|
3369
3386
|
'Search for any dependency that is being used in your organization',
|
|
@@ -3400,14 +3417,14 @@ const config$C = {
|
|
|
3400
3417
|
`
|
|
3401
3418
|
}
|
|
3402
3419
|
const cmdScanCreate$1 = {
|
|
3403
|
-
description: config$
|
|
3404
|
-
hidden: config$
|
|
3405
|
-
run: run$
|
|
3420
|
+
description: config$D.description,
|
|
3421
|
+
hidden: config$D.hidden,
|
|
3422
|
+
run: run$D
|
|
3406
3423
|
}
|
|
3407
|
-
async function run$
|
|
3424
|
+
async function run$D(argv, importMeta, { parentName }) {
|
|
3408
3425
|
const cli = meowOrExit({
|
|
3409
3426
|
argv,
|
|
3410
|
-
config: config$
|
|
3427
|
+
config: config$D,
|
|
3411
3428
|
importMeta,
|
|
3412
3429
|
parentName
|
|
3413
3430
|
})
|
|
@@ -3435,7 +3452,7 @@ async function run$C(argv, importMeta, { parentName }) {
|
|
|
3435
3452
|
return
|
|
3436
3453
|
}
|
|
3437
3454
|
if (cli.flags['dryRun']) {
|
|
3438
|
-
logger.logger.log(DRY_RUN_BAIL_TEXT$
|
|
3455
|
+
logger.logger.log(DRY_RUN_BAIL_TEXT$A)
|
|
3439
3456
|
return
|
|
3440
3457
|
}
|
|
3441
3458
|
await handleDependencies({
|
|
@@ -3549,8 +3566,8 @@ async function handleDiffScan$1({
|
|
|
3549
3566
|
})
|
|
3550
3567
|
}
|
|
3551
3568
|
|
|
3552
|
-
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$
|
|
3553
|
-
const config$
|
|
3569
|
+
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$z } = constants
|
|
3570
|
+
const config$C = {
|
|
3554
3571
|
commandName: 'get',
|
|
3555
3572
|
description: 'Get a diff scan for an organization',
|
|
3556
3573
|
hidden: false,
|
|
@@ -3609,14 +3626,14 @@ const config$B = {
|
|
|
3609
3626
|
`
|
|
3610
3627
|
}
|
|
3611
3628
|
const cmdDiffScanGet = {
|
|
3612
|
-
description: config$
|
|
3613
|
-
hidden: config$
|
|
3614
|
-
run: run$
|
|
3629
|
+
description: config$C.description,
|
|
3630
|
+
hidden: config$C.hidden,
|
|
3631
|
+
run: run$C
|
|
3615
3632
|
}
|
|
3616
|
-
async function run$
|
|
3633
|
+
async function run$C(argv, importMeta, { parentName }) {
|
|
3617
3634
|
const cli = meowOrExit({
|
|
3618
3635
|
argv,
|
|
3619
|
-
config: config$
|
|
3636
|
+
config: config$C,
|
|
3620
3637
|
importMeta,
|
|
3621
3638
|
parentName
|
|
3622
3639
|
})
|
|
@@ -3668,7 +3685,7 @@ async function run$B(argv, importMeta, { parentName }) {
|
|
|
3668
3685
|
'Warning: this command is deprecated in favor of `socket scan diff` and will be removed in the next major bump.'
|
|
3669
3686
|
)
|
|
3670
3687
|
if (cli.flags['dryRun']) {
|
|
3671
|
-
logger.logger.log(DRY_RUN_BAIL_TEXT$
|
|
3688
|
+
logger.logger.log(DRY_RUN_BAIL_TEXT$z)
|
|
3672
3689
|
return
|
|
3673
3690
|
}
|
|
3674
3691
|
await handleDiffScan$1({
|
|
@@ -3798,9 +3815,17 @@ async function gitCreateAndPushBranchIfNeeded(
|
|
|
3798
3815
|
await spawn.spawn('git', ['checkout', '-b', branch], {
|
|
3799
3816
|
cwd
|
|
3800
3817
|
})
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3818
|
+
const relFilepaths = await vendor.distExports.glob(
|
|
3819
|
+
'**/{package.json,package-lock.json,pnpm-lock.yaml}',
|
|
3820
|
+
{
|
|
3821
|
+
cwd
|
|
3822
|
+
}
|
|
3823
|
+
)
|
|
3824
|
+
if (relFilepaths.length) {
|
|
3825
|
+
await spawn.spawn('git', ['add', ...relFilepaths], {
|
|
3826
|
+
cwd
|
|
3827
|
+
})
|
|
3828
|
+
}
|
|
3804
3829
|
await spawn.spawn('git', ['commit', '-m', commitMsg], {
|
|
3805
3830
|
cwd
|
|
3806
3831
|
})
|
|
@@ -4088,19 +4113,6 @@ async function npmFix(
|
|
|
4088
4113
|
)
|
|
4089
4114
|
const newSpec = `${name}@${newVersionRange}`
|
|
4090
4115
|
const newSpecKey = `${workspaceName ? `${workspaceName}>` : ''}${newSpec}`
|
|
4091
|
-
const branch = isCi
|
|
4092
|
-
? getSocketBranchName(oldPurl, newVersion, workspaceName)
|
|
4093
|
-
: ''
|
|
4094
|
-
const { owner, repo } = isCi
|
|
4095
|
-
? getGitHubEnvRepoInfo()
|
|
4096
|
-
: {
|
|
4097
|
-
owner: '',
|
|
4098
|
-
repo: ''
|
|
4099
|
-
}
|
|
4100
|
-
const shouldOpenPr = isCi
|
|
4101
|
-
? // eslint-disable-next-line no-await-in-loop
|
|
4102
|
-
!(await doesPullRequestExistForBranch(owner, repo, branch))
|
|
4103
|
-
: false
|
|
4104
4116
|
const revertData = {
|
|
4105
4117
|
...(editablePkgJson.content.dependencies
|
|
4106
4118
|
? {
|
|
@@ -4119,30 +4131,45 @@ async function npmFix(
|
|
|
4119
4131
|
}
|
|
4120
4132
|
: undefined)
|
|
4121
4133
|
}
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4134
|
+
const branch = isCi
|
|
4135
|
+
? getSocketBranchName(oldPurl, newVersion, workspaceName)
|
|
4136
|
+
: ''
|
|
4137
|
+
const baseBranch = isCi ? getBaseGitBranch() : ''
|
|
4138
|
+
const { owner, repo } = isCi
|
|
4139
|
+
? getGitHubEnvRepoInfo()
|
|
4140
|
+
: {
|
|
4141
|
+
owner: '',
|
|
4142
|
+
repo: ''
|
|
4143
|
+
}
|
|
4144
|
+
const shouldOpenPr = isCi
|
|
4145
|
+
? // eslint-disable-next-line no-await-in-loop
|
|
4146
|
+
!(await doesPullRequestExistForBranch(owner, repo, branch))
|
|
4147
|
+
: false
|
|
4148
|
+
if (isCi) {
|
|
4149
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4150
|
+
await gitCheckoutBaseBranchIfAvailable(baseBranch, cwd)
|
|
4125
4151
|
}
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4152
|
+
shadowNpmInject.updatePackageJsonFromNode(
|
|
4153
|
+
editablePkgJson,
|
|
4154
|
+
arb.idealTree,
|
|
4155
|
+
node,
|
|
4156
|
+
newVersion,
|
|
4157
|
+
rangeStyle
|
|
4158
|
+
)
|
|
4130
4159
|
let error
|
|
4131
4160
|
let errored = false
|
|
4132
4161
|
let installed = false
|
|
4133
4162
|
let saved = false
|
|
4163
|
+
|
|
4164
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4165
|
+
if (await editablePkgJson.save()) {
|
|
4166
|
+
saved = true
|
|
4167
|
+
}
|
|
4168
|
+
if (!installedSpecs.has(newSpecKey)) {
|
|
4169
|
+
testedSpecs.add(newSpecKey)
|
|
4170
|
+
spinner?.info(`Installing ${newSpec}${workspaceDetails}`)
|
|
4171
|
+
}
|
|
4134
4172
|
try {
|
|
4135
|
-
shadowNpmInject.updatePackageJsonFromNode(
|
|
4136
|
-
editablePkgJson,
|
|
4137
|
-
arb.idealTree,
|
|
4138
|
-
node,
|
|
4139
|
-
newVersion,
|
|
4140
|
-
rangeStyle
|
|
4141
|
-
)
|
|
4142
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4143
|
-
if (await editablePkgJson.save()) {
|
|
4144
|
-
saved = true
|
|
4145
|
-
}
|
|
4146
4173
|
// eslint-disable-next-line no-await-in-loop
|
|
4147
4174
|
await install$1(arb.idealTree, {
|
|
4148
4175
|
cwd
|
|
@@ -4509,20 +4536,6 @@ async function pnpmFix(
|
|
|
4509
4536
|
)
|
|
4510
4537
|
const newSpec = `${name}@${newVersionRange}`
|
|
4511
4538
|
const newSpecKey = `${workspaceName ? `${workspaceName}>` : ''}${newSpec}`
|
|
4512
|
-
const branch = isCi
|
|
4513
|
-
? getSocketBranchName(oldPurl, newVersion, workspaceName)
|
|
4514
|
-
: ''
|
|
4515
|
-
const baseBranch = isCi ? getBaseGitBranch() : ''
|
|
4516
|
-
const { owner, repo } = isCi
|
|
4517
|
-
? getGitHubEnvRepoInfo()
|
|
4518
|
-
: {
|
|
4519
|
-
owner: '',
|
|
4520
|
-
repo: ''
|
|
4521
|
-
}
|
|
4522
|
-
const shouldOpenPr = isCi
|
|
4523
|
-
? // eslint-disable-next-line no-await-in-loop
|
|
4524
|
-
!(await doesPullRequestExistForBranch(owner, repo, branch))
|
|
4525
|
-
: false
|
|
4526
4539
|
const updateData = isWorkspaceRoot
|
|
4527
4540
|
? {
|
|
4528
4541
|
[PNPM$8]: {
|
|
@@ -4533,7 +4546,7 @@ async function pnpmFix(
|
|
|
4533
4546
|
}
|
|
4534
4547
|
}
|
|
4535
4548
|
}
|
|
4536
|
-
:
|
|
4549
|
+
: undefined
|
|
4537
4550
|
const revertData = {
|
|
4538
4551
|
...(isWorkspaceRoot
|
|
4539
4552
|
? {
|
|
@@ -4568,32 +4581,47 @@ async function pnpmFix(
|
|
|
4568
4581
|
}
|
|
4569
4582
|
: undefined)
|
|
4570
4583
|
}
|
|
4584
|
+
const branch = isCi
|
|
4585
|
+
? getSocketBranchName(oldPurl, newVersion, workspaceName)
|
|
4586
|
+
: ''
|
|
4587
|
+
const baseBranch = isCi ? getBaseGitBranch() : ''
|
|
4588
|
+
const { owner, repo } = isCi
|
|
4589
|
+
? getGitHubEnvRepoInfo()
|
|
4590
|
+
: {
|
|
4591
|
+
owner: '',
|
|
4592
|
+
repo: ''
|
|
4593
|
+
}
|
|
4594
|
+
const shouldOpenPr = isCi
|
|
4595
|
+
? // eslint-disable-next-line no-await-in-loop
|
|
4596
|
+
!(await doesPullRequestExistForBranch(owner, repo, branch))
|
|
4597
|
+
: false
|
|
4598
|
+
if (isCi) {
|
|
4599
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4600
|
+
await gitCheckoutBaseBranchIfAvailable(baseBranch, cwd)
|
|
4601
|
+
}
|
|
4602
|
+
if (updateData) {
|
|
4603
|
+
editablePkgJson.update(updateData)
|
|
4604
|
+
}
|
|
4605
|
+
shadowNpmInject.updatePackageJsonFromNode(
|
|
4606
|
+
editablePkgJson,
|
|
4607
|
+
actualTree,
|
|
4608
|
+
node,
|
|
4609
|
+
newVersion,
|
|
4610
|
+
rangeStyle
|
|
4611
|
+
)
|
|
4612
|
+
let error
|
|
4613
|
+
let errored = false
|
|
4614
|
+
let installed = false
|
|
4615
|
+
|
|
4616
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4617
|
+
if (!(await editablePkgJson.save())) {
|
|
4618
|
+
continue
|
|
4619
|
+
}
|
|
4571
4620
|
if (!installedSpecs.has(newSpecKey)) {
|
|
4572
4621
|
installedSpecs.add(newSpecKey)
|
|
4573
4622
|
spinner?.info(`Installing ${newSpec}${workspaceDetails}`)
|
|
4574
4623
|
}
|
|
4575
|
-
if (isCi) {
|
|
4576
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4577
|
-
await gitCheckoutBaseBranchIfAvailable(baseBranch, cwd)
|
|
4578
|
-
}
|
|
4579
|
-
let error
|
|
4580
|
-
let errored = false
|
|
4581
|
-
let installed = false
|
|
4582
|
-
let saved = false
|
|
4583
4624
|
try {
|
|
4584
|
-
editablePkgJson.update(updateData)
|
|
4585
|
-
shadowNpmInject.updatePackageJsonFromNode(
|
|
4586
|
-
editablePkgJson,
|
|
4587
|
-
actualTree,
|
|
4588
|
-
node,
|
|
4589
|
-
newVersion,
|
|
4590
|
-
rangeStyle
|
|
4591
|
-
)
|
|
4592
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4593
|
-
if (!(await editablePkgJson.save())) {
|
|
4594
|
-
continue
|
|
4595
|
-
}
|
|
4596
|
-
saved = true
|
|
4597
4625
|
// eslint-disable-next-line no-await-in-loop
|
|
4598
4626
|
actualTree = await install(pkgEnvDetails, {
|
|
4599
4627
|
spinner
|
|
@@ -4651,21 +4679,15 @@ async function pnpmFix(
|
|
|
4651
4679
|
spinner?.error(`Reverting ${newSpec}${workspaceDetails}`, error)
|
|
4652
4680
|
}
|
|
4653
4681
|
}
|
|
4682
|
+
editablePkgJson.update(revertData)
|
|
4654
4683
|
if (isRepo) {
|
|
4655
4684
|
// eslint-disable-next-line no-await-in-loop
|
|
4656
4685
|
await gitHardReset(cwd)
|
|
4657
|
-
}
|
|
4658
|
-
if (saved) {
|
|
4659
|
-
editablePkgJson.update(revertData)
|
|
4660
|
-
if (!isRepo) {
|
|
4661
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4662
|
-
await editablePkgJson.save()
|
|
4663
|
-
}
|
|
4664
|
-
}
|
|
4665
|
-
if (isRepo) {
|
|
4666
4686
|
// eslint-disable-next-line no-await-in-loop
|
|
4667
4687
|
actualTree = await getActualTree(cwd)
|
|
4668
4688
|
} else if (installed) {
|
|
4689
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4690
|
+
await editablePkgJson.save()
|
|
4669
4691
|
// eslint-disable-next-line no-await-in-loop
|
|
4670
4692
|
actualTree = await install(pkgEnvDetails, {
|
|
4671
4693
|
spinner
|
|
@@ -4857,11 +4879,12 @@ async function detectPackageEnvironment({
|
|
|
4857
4879
|
editable: true
|
|
4858
4880
|
})
|
|
4859
4881
|
: undefined
|
|
4860
|
-
const pkgJson = editablePkgJson?.content
|
|
4861
4882
|
// Read Corepack `packageManager` field in package.json:
|
|
4862
4883
|
// https://nodejs.org/api/packages.html#packagemanager
|
|
4863
|
-
const pkgManager = strings.isNonEmptyString(
|
|
4864
|
-
|
|
4884
|
+
const pkgManager = strings.isNonEmptyString(
|
|
4885
|
+
editablePkgJson?.content?.packageManager
|
|
4886
|
+
)
|
|
4887
|
+
? editablePkgJson.content.packageManager
|
|
4865
4888
|
: undefined
|
|
4866
4889
|
let agent
|
|
4867
4890
|
let agentVersion
|
|
@@ -4909,8 +4932,8 @@ async function detectPackageEnvironment({
|
|
|
4909
4932
|
let pkgNodeRange
|
|
4910
4933
|
let pkgMinAgentVersion = minSupportedAgentVersion
|
|
4911
4934
|
let pkgMinNodeVersion = minSupportedNodeVersion
|
|
4912
|
-
if (
|
|
4913
|
-
const { engines } =
|
|
4935
|
+
if (editablePkgJson?.content) {
|
|
4936
|
+
const { engines } = editablePkgJson.content
|
|
4914
4937
|
const engineAgentRange = engines?.[agent]
|
|
4915
4938
|
const engineNodeRange = engines?.['node']
|
|
4916
4939
|
if (strings.isNonEmptyString(engineAgentRange)) {
|
|
@@ -4931,7 +4954,7 @@ async function detectPackageEnvironment({
|
|
|
4931
4954
|
pkgMinNodeVersion = coerced.version
|
|
4932
4955
|
}
|
|
4933
4956
|
}
|
|
4934
|
-
const browserslistQuery =
|
|
4957
|
+
const browserslistQuery = editablePkgJson.content['browserslist']
|
|
4935
4958
|
if (Array.isArray(browserslistQuery)) {
|
|
4936
4959
|
// List Node targets in ascending version order.
|
|
4937
4960
|
const browserslistNodeTargets = vendor
|
|
@@ -5132,8 +5155,8 @@ async function runFix(options_) {
|
|
|
5132
5155
|
}
|
|
5133
5156
|
}
|
|
5134
5157
|
|
|
5135
|
-
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$
|
|
5136
|
-
const config$
|
|
5158
|
+
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$y } = constants
|
|
5159
|
+
const config$B = {
|
|
5137
5160
|
commandName: 'fix',
|
|
5138
5161
|
description: 'Fix "fixable" Socket alerts',
|
|
5139
5162
|
hidden: true,
|
|
@@ -5190,14 +5213,14 @@ const config$A = {
|
|
|
5190
5213
|
`
|
|
5191
5214
|
}
|
|
5192
5215
|
const cmdFix = {
|
|
5193
|
-
description: config$
|
|
5194
|
-
hidden: config$
|
|
5195
|
-
run: run$
|
|
5216
|
+
description: config$B.description,
|
|
5217
|
+
hidden: config$B.hidden,
|
|
5218
|
+
run: run$B
|
|
5196
5219
|
}
|
|
5197
|
-
async function run$
|
|
5220
|
+
async function run$B(argv, importMeta, { parentName }) {
|
|
5198
5221
|
const cli = meowOrExit({
|
|
5199
5222
|
argv,
|
|
5200
|
-
config: config$
|
|
5223
|
+
config: config$B,
|
|
5201
5224
|
importMeta,
|
|
5202
5225
|
parentName
|
|
5203
5226
|
})
|
|
@@ -5211,7 +5234,7 @@ async function run$A(argv, importMeta, { parentName }) {
|
|
|
5211
5234
|
return
|
|
5212
5235
|
}
|
|
5213
5236
|
if (cli.flags['dryRun']) {
|
|
5214
|
-
logger.logger.log(DRY_RUN_BAIL_TEXT$
|
|
5237
|
+
logger.logger.log(DRY_RUN_BAIL_TEXT$y)
|
|
5215
5238
|
return
|
|
5216
5239
|
}
|
|
5217
5240
|
|
|
@@ -5414,8 +5437,8 @@ async function handlePackageInfo({
|
|
|
5414
5437
|
}
|
|
5415
5438
|
}
|
|
5416
5439
|
|
|
5417
|
-
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$
|
|
5418
|
-
const config$
|
|
5440
|
+
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$x } = constants
|
|
5441
|
+
const config$A = {
|
|
5419
5442
|
commandName: 'info',
|
|
5420
5443
|
description: 'Look up info regarding a package',
|
|
5421
5444
|
hidden: true,
|
|
@@ -5440,14 +5463,14 @@ const config$z = {
|
|
|
5440
5463
|
`
|
|
5441
5464
|
}
|
|
5442
5465
|
const cmdInfo = {
|
|
5443
|
-
description: config$
|
|
5444
|
-
hidden: config$
|
|
5445
|
-
run: run$
|
|
5466
|
+
description: config$A.description,
|
|
5467
|
+
hidden: config$A.hidden,
|
|
5468
|
+
run: run$A
|
|
5446
5469
|
}
|
|
5447
|
-
async function run$
|
|
5470
|
+
async function run$A(argv, importMeta, { parentName }) {
|
|
5448
5471
|
const cli = meowOrExit({
|
|
5449
5472
|
argv,
|
|
5450
|
-
config: config$
|
|
5473
|
+
config: config$A,
|
|
5451
5474
|
importMeta,
|
|
5452
5475
|
parentName
|
|
5453
5476
|
})
|
|
@@ -5485,11 +5508,11 @@ async function run$z(argv, importMeta, { parentName }) {
|
|
|
5485
5508
|
const pkgVersion =
|
|
5486
5509
|
versionSeparator < 1 ? 'latest' : rawPkgName.slice(versionSeparator + 1)
|
|
5487
5510
|
if (cli.flags['dryRun']) {
|
|
5488
|
-
logger.logger.log(DRY_RUN_BAIL_TEXT$
|
|
5511
|
+
logger.logger.log(DRY_RUN_BAIL_TEXT$x)
|
|
5489
5512
|
return
|
|
5490
5513
|
}
|
|
5491
5514
|
await handlePackageInfo({
|
|
5492
|
-
commandName: `${parentName} ${config$
|
|
5515
|
+
commandName: `${parentName} ${config$A.commandName}`,
|
|
5493
5516
|
includeAllIssues: Boolean(all),
|
|
5494
5517
|
outputKind: json ? 'json' : markdown ? 'markdown' : 'print',
|
|
5495
5518
|
pkgName,
|
|
@@ -5576,8 +5599,8 @@ async function attemptLogin(apiBaseUrl, apiProxy) {
|
|
|
5576
5599
|
}
|
|
5577
5600
|
}
|
|
5578
5601
|
|
|
5579
|
-
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$
|
|
5580
|
-
const config$
|
|
5602
|
+
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$w } = constants
|
|
5603
|
+
const config$z = {
|
|
5581
5604
|
commandName: 'login',
|
|
5582
5605
|
description: 'Socket API login',
|
|
5583
5606
|
hidden: false,
|
|
@@ -5610,21 +5633,21 @@ const config$y = {
|
|
|
5610
5633
|
`
|
|
5611
5634
|
}
|
|
5612
5635
|
const cmdLogin = {
|
|
5613
|
-
description: config$
|
|
5614
|
-
hidden: config$
|
|
5615
|
-
run: run$
|
|
5636
|
+
description: config$z.description,
|
|
5637
|
+
hidden: config$z.hidden,
|
|
5638
|
+
run: run$z
|
|
5616
5639
|
}
|
|
5617
|
-
async function run$
|
|
5640
|
+
async function run$z(argv, importMeta, { parentName }) {
|
|
5618
5641
|
const cli = meowOrExit({
|
|
5619
5642
|
argv,
|
|
5620
|
-
config: config$
|
|
5643
|
+
config: config$z,
|
|
5621
5644
|
importMeta,
|
|
5622
5645
|
parentName
|
|
5623
5646
|
})
|
|
5624
5647
|
const apiBaseUrl = cli.flags['apiBaseUrl']
|
|
5625
5648
|
const apiProxy = cli.flags['apiProxy']
|
|
5626
5649
|
if (cli.flags['dryRun']) {
|
|
5627
|
-
logger.logger.log(DRY_RUN_BAIL_TEXT$
|
|
5650
|
+
logger.logger.log(DRY_RUN_BAIL_TEXT$w)
|
|
5628
5651
|
return
|
|
5629
5652
|
}
|
|
5630
5653
|
if (!isInteractive()) {
|
|
@@ -5657,8 +5680,8 @@ function attemptLogout() {
|
|
|
5657
5680
|
}
|
|
5658
5681
|
}
|
|
5659
5682
|
|
|
5660
|
-
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$
|
|
5661
|
-
const config$
|
|
5683
|
+
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$v } = constants
|
|
5684
|
+
const config$y = {
|
|
5662
5685
|
commandName: 'logout',
|
|
5663
5686
|
description: 'Socket API logout',
|
|
5664
5687
|
hidden: false,
|
|
@@ -5673,6 +5696,247 @@ const config$x = {
|
|
|
5673
5696
|
`
|
|
5674
5697
|
}
|
|
5675
5698
|
const cmdLogout = {
|
|
5699
|
+
description: config$y.description,
|
|
5700
|
+
hidden: config$y.hidden,
|
|
5701
|
+
run: run$y
|
|
5702
|
+
}
|
|
5703
|
+
async function run$y(argv, importMeta, { parentName }) {
|
|
5704
|
+
const cli = meowOrExit({
|
|
5705
|
+
argv,
|
|
5706
|
+
config: config$y,
|
|
5707
|
+
importMeta,
|
|
5708
|
+
parentName
|
|
5709
|
+
})
|
|
5710
|
+
if (cli.flags['dryRun']) {
|
|
5711
|
+
logger.logger.log(DRY_RUN_BAIL_TEXT$v)
|
|
5712
|
+
return
|
|
5713
|
+
}
|
|
5714
|
+
attemptLogout()
|
|
5715
|
+
}
|
|
5716
|
+
|
|
5717
|
+
async function convertCondaToRequirements(target, cwd, verbose) {
|
|
5718
|
+
let contents
|
|
5719
|
+
if (target === '-') {
|
|
5720
|
+
if (verbose) {
|
|
5721
|
+
logger.logger.error(`[VERBOSE] reading input from stdin`)
|
|
5722
|
+
}
|
|
5723
|
+
const buf = []
|
|
5724
|
+
contents = await new Promise((resolve, reject) => {
|
|
5725
|
+
process.stdin.on('data', chunk => {
|
|
5726
|
+
const input = chunk.toString()
|
|
5727
|
+
buf.push(input)
|
|
5728
|
+
})
|
|
5729
|
+
process.stdin.on('end', () => {
|
|
5730
|
+
resolve(buf.join(''))
|
|
5731
|
+
})
|
|
5732
|
+
process.stdin.on('error', e => {
|
|
5733
|
+
if (verbose) {
|
|
5734
|
+
logger.logger.error('Unexpected error while reading from stdin:', e)
|
|
5735
|
+
}
|
|
5736
|
+
reject(e)
|
|
5737
|
+
})
|
|
5738
|
+
process.stdin.on('close', () => {
|
|
5739
|
+
if (buf.length === 0) {
|
|
5740
|
+
if (verbose) {
|
|
5741
|
+
logger.logger.error('stdin closed explicitly without data received')
|
|
5742
|
+
}
|
|
5743
|
+
reject(new Error('No data received from stdin'))
|
|
5744
|
+
} else {
|
|
5745
|
+
if (verbose) {
|
|
5746
|
+
logger.logger.error(
|
|
5747
|
+
'warning: stdin closed explicitly with some data received'
|
|
5748
|
+
)
|
|
5749
|
+
}
|
|
5750
|
+
resolve(buf.join(''))
|
|
5751
|
+
}
|
|
5752
|
+
})
|
|
5753
|
+
})
|
|
5754
|
+
if (!contents) {
|
|
5755
|
+
return {
|
|
5756
|
+
ok: false,
|
|
5757
|
+
message: 'No data received from stdin',
|
|
5758
|
+
data: undefined
|
|
5759
|
+
}
|
|
5760
|
+
}
|
|
5761
|
+
} else {
|
|
5762
|
+
const f = path$1.resolve(cwd, target)
|
|
5763
|
+
if (verbose) {
|
|
5764
|
+
logger.logger.error(`[VERBOSE] target file: ${f}`)
|
|
5765
|
+
}
|
|
5766
|
+
if (!fs$1.existsSync(f)) {
|
|
5767
|
+
return {
|
|
5768
|
+
ok: false,
|
|
5769
|
+
message: `Input file not found at ${f}`,
|
|
5770
|
+
data: undefined
|
|
5771
|
+
}
|
|
5772
|
+
}
|
|
5773
|
+
contents = fs$1.readFileSync(target, 'utf8')
|
|
5774
|
+
if (!contents) {
|
|
5775
|
+
return {
|
|
5776
|
+
ok: false,
|
|
5777
|
+
message: 'File is empty',
|
|
5778
|
+
data: undefined
|
|
5779
|
+
}
|
|
5780
|
+
}
|
|
5781
|
+
}
|
|
5782
|
+
return {
|
|
5783
|
+
ok: true,
|
|
5784
|
+
message: '',
|
|
5785
|
+
data: {
|
|
5786
|
+
contents,
|
|
5787
|
+
pip: convertCondaToRequirementsFromInput(contents)
|
|
5788
|
+
}
|
|
5789
|
+
}
|
|
5790
|
+
}
|
|
5791
|
+
|
|
5792
|
+
// Just extract the first pip block, if one exists at all.
|
|
5793
|
+
function convertCondaToRequirementsFromInput(input) {
|
|
5794
|
+
const keeping = []
|
|
5795
|
+
let collecting = false
|
|
5796
|
+
let delim = '-'
|
|
5797
|
+
let indent = ''
|
|
5798
|
+
input.split('\n').some(line => {
|
|
5799
|
+
if (!line) {
|
|
5800
|
+
// Ignore empty lines
|
|
5801
|
+
return
|
|
5802
|
+
}
|
|
5803
|
+
if (collecting) {
|
|
5804
|
+
if (line.startsWith('#')) {
|
|
5805
|
+
// Ignore comment lines (keep?)
|
|
5806
|
+
return
|
|
5807
|
+
}
|
|
5808
|
+
if (line.startsWith(delim)) {
|
|
5809
|
+
// In this case we have a line with the same indentation as the
|
|
5810
|
+
// `- pip:` line, so we have reached the end of the pip block.
|
|
5811
|
+
return true // the end
|
|
5812
|
+
} else {
|
|
5813
|
+
if (!indent) {
|
|
5814
|
+
// Store the indentation of the block
|
|
5815
|
+
if (line.trim().startsWith('-')) {
|
|
5816
|
+
indent = line.split('-')[0] + '-'
|
|
5817
|
+
if (indent.length <= delim.length) {
|
|
5818
|
+
// The first line after the `pip:` line does not indent further
|
|
5819
|
+
// than that so the block is empty?
|
|
5820
|
+
return true
|
|
5821
|
+
}
|
|
5822
|
+
}
|
|
5823
|
+
}
|
|
5824
|
+
if (line.startsWith(indent)) {
|
|
5825
|
+
keeping.push(line.slice(indent.length).trim())
|
|
5826
|
+
} else {
|
|
5827
|
+
// Unexpected input. bail.
|
|
5828
|
+
return true
|
|
5829
|
+
}
|
|
5830
|
+
}
|
|
5831
|
+
} else {
|
|
5832
|
+
// Note: the line may end with a line comment so don't === it.
|
|
5833
|
+
if (line.trim().startsWith('- pip:')) {
|
|
5834
|
+
delim = line.split('-')[0] + '-'
|
|
5835
|
+
collecting = true
|
|
5836
|
+
}
|
|
5837
|
+
}
|
|
5838
|
+
})
|
|
5839
|
+
return keeping.join('\n')
|
|
5840
|
+
}
|
|
5841
|
+
|
|
5842
|
+
async function outputRequirements(data, outputKind, out) {
|
|
5843
|
+
if (outputKind === 'json') {
|
|
5844
|
+
const json = JSON.stringify(
|
|
5845
|
+
{
|
|
5846
|
+
ok: true,
|
|
5847
|
+
data: {
|
|
5848
|
+
pip: data.pip
|
|
5849
|
+
}
|
|
5850
|
+
},
|
|
5851
|
+
undefined,
|
|
5852
|
+
2
|
|
5853
|
+
)
|
|
5854
|
+
if (out === '-') {
|
|
5855
|
+
logger.logger.log(json)
|
|
5856
|
+
} else {
|
|
5857
|
+
fs$1.writeFileSync(out, json, 'utf8')
|
|
5858
|
+
}
|
|
5859
|
+
return
|
|
5860
|
+
}
|
|
5861
|
+
if (outputKind === 'markdown') {
|
|
5862
|
+
const arr = []
|
|
5863
|
+
arr.push('# Converted Conda file')
|
|
5864
|
+
arr.push('')
|
|
5865
|
+
arr.push(
|
|
5866
|
+
'This is the Conda `environment.yml` file converted to python `requirements.txt`:'
|
|
5867
|
+
)
|
|
5868
|
+
arr.push('')
|
|
5869
|
+
arr.push('```file=requirements.txt')
|
|
5870
|
+
arr.push(data.pip)
|
|
5871
|
+
arr.push('```')
|
|
5872
|
+
arr.push('')
|
|
5873
|
+
const md = arr.join('\n')
|
|
5874
|
+
if (out === '-') {
|
|
5875
|
+
logger.logger.log(md)
|
|
5876
|
+
} else {
|
|
5877
|
+
fs$1.writeFileSync(out, md, 'utf8')
|
|
5878
|
+
}
|
|
5879
|
+
return
|
|
5880
|
+
}
|
|
5881
|
+
if (out === '-') {
|
|
5882
|
+
logger.logger.log(data.pip)
|
|
5883
|
+
logger.logger.log('')
|
|
5884
|
+
} else {
|
|
5885
|
+
fs$1.writeFileSync(out, data.pip, 'utf8')
|
|
5886
|
+
}
|
|
5887
|
+
}
|
|
5888
|
+
|
|
5889
|
+
async function handleManifestConda(target, out, outputKind, cwd, verbose) {
|
|
5890
|
+
const data = await convertCondaToRequirements(target, cwd, verbose)
|
|
5891
|
+
if (!data) {
|
|
5892
|
+
return
|
|
5893
|
+
}
|
|
5894
|
+
if (!data.ok) {
|
|
5895
|
+
logger.logger.fail(data.message)
|
|
5896
|
+
return
|
|
5897
|
+
}
|
|
5898
|
+
await outputRequirements(data.data, outputKind, out)
|
|
5899
|
+
}
|
|
5900
|
+
|
|
5901
|
+
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$u } = constants
|
|
5902
|
+
const config$x = {
|
|
5903
|
+
commandName: 'conda',
|
|
5904
|
+
description:
|
|
5905
|
+
'[beta] Convert a Conda environment.yml file to a python requirements.txt',
|
|
5906
|
+
hidden: false,
|
|
5907
|
+
flags: {
|
|
5908
|
+
...commonFlags,
|
|
5909
|
+
...outputFlags,
|
|
5910
|
+
cwd: {
|
|
5911
|
+
type: 'string',
|
|
5912
|
+
description: 'Set the cwd, defaults to process.cwd()'
|
|
5913
|
+
},
|
|
5914
|
+
out: {
|
|
5915
|
+
type: 'string',
|
|
5916
|
+
default: '-',
|
|
5917
|
+
description: 'Output target (use `-` or omit to print to stdout)'
|
|
5918
|
+
},
|
|
5919
|
+
verbose: {
|
|
5920
|
+
type: 'boolean',
|
|
5921
|
+
description: 'Print debug messages'
|
|
5922
|
+
}
|
|
5923
|
+
},
|
|
5924
|
+
help: (command, config) => `
|
|
5925
|
+
Usage
|
|
5926
|
+
$ ${command} FILE
|
|
5927
|
+
|
|
5928
|
+
Note: FILE can be a dash (-) to indicate stdin. This way you can pipe the
|
|
5929
|
+
contents of a file to have it processed.
|
|
5930
|
+
|
|
5931
|
+
Options
|
|
5932
|
+
${getFlagListOutput(config.flags, 6)}
|
|
5933
|
+
|
|
5934
|
+
Examples
|
|
5935
|
+
|
|
5936
|
+
$ ${command} ./environment.yml
|
|
5937
|
+
`
|
|
5938
|
+
}
|
|
5939
|
+
const cmdManifestConda = {
|
|
5676
5940
|
description: config$x.description,
|
|
5677
5941
|
hidden: config$x.hidden,
|
|
5678
5942
|
run: run$x
|
|
@@ -5684,11 +5948,59 @@ async function run$x(argv, importMeta, { parentName }) {
|
|
|
5684
5948
|
importMeta,
|
|
5685
5949
|
parentName
|
|
5686
5950
|
})
|
|
5951
|
+
const {
|
|
5952
|
+
cwd = process.cwd(),
|
|
5953
|
+
json = false,
|
|
5954
|
+
markdown = false,
|
|
5955
|
+
out = '-',
|
|
5956
|
+
verbose = false
|
|
5957
|
+
} = cli.flags
|
|
5958
|
+
const [target = ''] = cli.input
|
|
5959
|
+
if (verbose) {
|
|
5960
|
+
logger.logger.group('- ', parentName, config$x.commandName, ':')
|
|
5961
|
+
logger.logger.group('- flags:', cli.flags)
|
|
5962
|
+
logger.logger.groupEnd()
|
|
5963
|
+
logger.logger.log('- target:', target)
|
|
5964
|
+
logger.logger.log('- output:', out)
|
|
5965
|
+
logger.logger.groupEnd()
|
|
5966
|
+
}
|
|
5967
|
+
const wasBadInput = handleBadInput(
|
|
5968
|
+
{
|
|
5969
|
+
test: !!target,
|
|
5970
|
+
message: 'The FILE arg is required',
|
|
5971
|
+
pass: 'ok',
|
|
5972
|
+
fail: 'missing'
|
|
5973
|
+
},
|
|
5974
|
+
{
|
|
5975
|
+
nook: true,
|
|
5976
|
+
test: cli.input.length <= 1,
|
|
5977
|
+
message: 'Can only accept one DIR (make sure to escape spaces!)',
|
|
5978
|
+
pass: 'ok',
|
|
5979
|
+
fail: 'received ' + cli.input.length
|
|
5980
|
+
},
|
|
5981
|
+
{
|
|
5982
|
+
nook: true,
|
|
5983
|
+
test: !json || !markdown,
|
|
5984
|
+
message:
|
|
5985
|
+
'The `--json` and `--markdown` flags can not be used at the same time',
|
|
5986
|
+
pass: 'ok',
|
|
5987
|
+
fail: 'bad'
|
|
5988
|
+
}
|
|
5989
|
+
)
|
|
5990
|
+
if (wasBadInput) {
|
|
5991
|
+
return
|
|
5992
|
+
}
|
|
5687
5993
|
if (cli.flags['dryRun']) {
|
|
5688
5994
|
logger.logger.log(DRY_RUN_BAIL_TEXT$u)
|
|
5689
5995
|
return
|
|
5690
5996
|
}
|
|
5691
|
-
|
|
5997
|
+
await handleManifestConda(
|
|
5998
|
+
target,
|
|
5999
|
+
String(out || ''),
|
|
6000
|
+
json ? 'json' : markdown ? 'markdown' : 'text',
|
|
6001
|
+
String(cwd),
|
|
6002
|
+
Boolean(verbose)
|
|
6003
|
+
)
|
|
5692
6004
|
}
|
|
5693
6005
|
|
|
5694
6006
|
async function convertGradleToMaven(target, bin, cwd, verbose, gradleOpts) {
|
|
@@ -6294,6 +6606,25 @@ async function run$u(argv, importMeta, { parentName }) {
|
|
|
6294
6606
|
})
|
|
6295
6607
|
return
|
|
6296
6608
|
}
|
|
6609
|
+
const envyml = path$1.join(dir, 'environment.yml')
|
|
6610
|
+
const hasEnvyml = fs$1.existsSync(envyml)
|
|
6611
|
+
const envyaml = path$1.join(dir, 'environment.yaml')
|
|
6612
|
+
const hasEnvyaml = !hasEnvyml && fs$1.existsSync(envyaml)
|
|
6613
|
+
if (hasEnvyml || hasEnvyaml) {
|
|
6614
|
+
logger.logger.log(
|
|
6615
|
+
'Detected an environment.yml file, running default Conda generator...'
|
|
6616
|
+
)
|
|
6617
|
+
// This command takes the TARGET as first arg.
|
|
6618
|
+
subArgs.push(hasEnvyml ? envyml : hasEnvyaml ? envyaml : '')
|
|
6619
|
+
if (cli.flags['dryRun']) {
|
|
6620
|
+
logger.logger.log(DRY_RUN_BAIL_TEXT$r)
|
|
6621
|
+
return
|
|
6622
|
+
}
|
|
6623
|
+
await cmdManifestConda.run(subArgs, importMeta, {
|
|
6624
|
+
parentName
|
|
6625
|
+
})
|
|
6626
|
+
return
|
|
6627
|
+
}
|
|
6297
6628
|
if (cli.flags['dryRun']) {
|
|
6298
6629
|
logger.logger.log(DRY_RUN_BAIL_TEXT$r)
|
|
6299
6630
|
return
|
|
@@ -6484,6 +6815,7 @@ async function run$s(argv, importMeta, { parentName }) {
|
|
|
6484
6815
|
await meowWithSubcommands(
|
|
6485
6816
|
{
|
|
6486
6817
|
auto: cmdManifestAuto,
|
|
6818
|
+
conda: cmdManifestConda,
|
|
6487
6819
|
scala: cmdManifestScala,
|
|
6488
6820
|
gradle: cmdManifestGradle,
|
|
6489
6821
|
kotlin: cmdManifestKotlin
|
|
@@ -9927,11 +10259,6 @@ const config$8 = {
|
|
|
9927
10259
|
description:
|
|
9928
10260
|
'Set the default branch of the repository to the branch of this full-scan. Should only need to be done once, for example for the "main" or "master" branch.'
|
|
9929
10261
|
},
|
|
9930
|
-
dryRun: {
|
|
9931
|
-
type: 'boolean',
|
|
9932
|
-
description:
|
|
9933
|
-
'Run input validation part of command without any concrete side effects'
|
|
9934
|
-
},
|
|
9935
10262
|
pendingHead: {
|
|
9936
10263
|
type: 'boolean',
|
|
9937
10264
|
default: true,
|
|
@@ -11936,7 +12263,7 @@ void (async () => {
|
|
|
11936
12263
|
await vendor.updater({
|
|
11937
12264
|
name: SOCKET_CLI_BIN_NAME,
|
|
11938
12265
|
// The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
|
|
11939
|
-
version: '0.14.
|
|
12266
|
+
version: '0.14.106',
|
|
11940
12267
|
ttl: 86_400_000 /* 24 hours in milliseconds */
|
|
11941
12268
|
})
|
|
11942
12269
|
try {
|
|
@@ -12004,5 +12331,5 @@ void (async () => {
|
|
|
12004
12331
|
await shadowNpmInject.captureException(e)
|
|
12005
12332
|
}
|
|
12006
12333
|
})()
|
|
12007
|
-
//# debugId=
|
|
12334
|
+
//# debugId=1552d26d-87c3-4aa3-acbf-2a7c3d0deb6e
|
|
12008
12335
|
//# sourceMappingURL=cli.js.map
|