@socketsecurity/cli-with-sentry 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/instrument-with-sentry.js +2 -2
- package/dist/instrument-with-sentry.js.map +1 -1
- 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:d6f1d87a: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
|
|
@@ -4513,20 +4540,6 @@ async function pnpmFix(
|
|
|
4513
4540
|
)
|
|
4514
4541
|
const newSpec = `${name}@${newVersionRange}`
|
|
4515
4542
|
const newSpecKey = `${workspaceName ? `${workspaceName}>` : ''}${newSpec}`
|
|
4516
|
-
const branch = isCi
|
|
4517
|
-
? getSocketBranchName(oldPurl, newVersion, workspaceName)
|
|
4518
|
-
: ''
|
|
4519
|
-
const baseBranch = isCi ? getBaseGitBranch() : ''
|
|
4520
|
-
const { owner, repo } = isCi
|
|
4521
|
-
? getGitHubEnvRepoInfo()
|
|
4522
|
-
: {
|
|
4523
|
-
owner: '',
|
|
4524
|
-
repo: ''
|
|
4525
|
-
}
|
|
4526
|
-
const shouldOpenPr = isCi
|
|
4527
|
-
? // eslint-disable-next-line no-await-in-loop
|
|
4528
|
-
!(await doesPullRequestExistForBranch(owner, repo, branch))
|
|
4529
|
-
: false
|
|
4530
4543
|
const updateData = isWorkspaceRoot
|
|
4531
4544
|
? {
|
|
4532
4545
|
[PNPM$8]: {
|
|
@@ -4537,7 +4550,7 @@ async function pnpmFix(
|
|
|
4537
4550
|
}
|
|
4538
4551
|
}
|
|
4539
4552
|
}
|
|
4540
|
-
:
|
|
4553
|
+
: undefined
|
|
4541
4554
|
const revertData = {
|
|
4542
4555
|
...(isWorkspaceRoot
|
|
4543
4556
|
? {
|
|
@@ -4572,32 +4585,47 @@ async function pnpmFix(
|
|
|
4572
4585
|
}
|
|
4573
4586
|
: undefined)
|
|
4574
4587
|
}
|
|
4588
|
+
const branch = isCi
|
|
4589
|
+
? getSocketBranchName(oldPurl, newVersion, workspaceName)
|
|
4590
|
+
: ''
|
|
4591
|
+
const baseBranch = isCi ? getBaseGitBranch() : ''
|
|
4592
|
+
const { owner, repo } = isCi
|
|
4593
|
+
? getGitHubEnvRepoInfo()
|
|
4594
|
+
: {
|
|
4595
|
+
owner: '',
|
|
4596
|
+
repo: ''
|
|
4597
|
+
}
|
|
4598
|
+
const shouldOpenPr = isCi
|
|
4599
|
+
? // eslint-disable-next-line no-await-in-loop
|
|
4600
|
+
!(await doesPullRequestExistForBranch(owner, repo, branch))
|
|
4601
|
+
: false
|
|
4602
|
+
if (isCi) {
|
|
4603
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4604
|
+
await gitCheckoutBaseBranchIfAvailable(baseBranch, cwd)
|
|
4605
|
+
}
|
|
4606
|
+
if (updateData) {
|
|
4607
|
+
editablePkgJson.update(updateData)
|
|
4608
|
+
}
|
|
4609
|
+
shadowNpmInject.updatePackageJsonFromNode(
|
|
4610
|
+
editablePkgJson,
|
|
4611
|
+
actualTree,
|
|
4612
|
+
node,
|
|
4613
|
+
newVersion,
|
|
4614
|
+
rangeStyle
|
|
4615
|
+
)
|
|
4616
|
+
let error
|
|
4617
|
+
let errored = false
|
|
4618
|
+
let installed = false
|
|
4619
|
+
|
|
4620
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4621
|
+
if (!(await editablePkgJson.save())) {
|
|
4622
|
+
continue
|
|
4623
|
+
}
|
|
4575
4624
|
if (!installedSpecs.has(newSpecKey)) {
|
|
4576
4625
|
installedSpecs.add(newSpecKey)
|
|
4577
4626
|
spinner?.info(`Installing ${newSpec}${workspaceDetails}`)
|
|
4578
4627
|
}
|
|
4579
|
-
if (isCi) {
|
|
4580
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4581
|
-
await gitCheckoutBaseBranchIfAvailable(baseBranch, cwd)
|
|
4582
|
-
}
|
|
4583
|
-
let error
|
|
4584
|
-
let errored = false
|
|
4585
|
-
let installed = false
|
|
4586
|
-
let saved = false
|
|
4587
4628
|
try {
|
|
4588
|
-
editablePkgJson.update(updateData)
|
|
4589
|
-
shadowNpmInject.updatePackageJsonFromNode(
|
|
4590
|
-
editablePkgJson,
|
|
4591
|
-
actualTree,
|
|
4592
|
-
node,
|
|
4593
|
-
newVersion,
|
|
4594
|
-
rangeStyle
|
|
4595
|
-
)
|
|
4596
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4597
|
-
if (!(await editablePkgJson.save())) {
|
|
4598
|
-
continue
|
|
4599
|
-
}
|
|
4600
|
-
saved = true
|
|
4601
4629
|
// eslint-disable-next-line no-await-in-loop
|
|
4602
4630
|
actualTree = await install(pkgEnvDetails, {
|
|
4603
4631
|
spinner
|
|
@@ -4655,21 +4683,15 @@ async function pnpmFix(
|
|
|
4655
4683
|
spinner?.error(`Reverting ${newSpec}${workspaceDetails}`, error)
|
|
4656
4684
|
}
|
|
4657
4685
|
}
|
|
4686
|
+
editablePkgJson.update(revertData)
|
|
4658
4687
|
if (isRepo) {
|
|
4659
4688
|
// eslint-disable-next-line no-await-in-loop
|
|
4660
4689
|
await gitHardReset(cwd)
|
|
4661
|
-
}
|
|
4662
|
-
if (saved) {
|
|
4663
|
-
editablePkgJson.update(revertData)
|
|
4664
|
-
if (!isRepo) {
|
|
4665
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4666
|
-
await editablePkgJson.save()
|
|
4667
|
-
}
|
|
4668
|
-
}
|
|
4669
|
-
if (isRepo) {
|
|
4670
4690
|
// eslint-disable-next-line no-await-in-loop
|
|
4671
4691
|
actualTree = await getActualTree(cwd)
|
|
4672
4692
|
} else if (installed) {
|
|
4693
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4694
|
+
await editablePkgJson.save()
|
|
4673
4695
|
// eslint-disable-next-line no-await-in-loop
|
|
4674
4696
|
actualTree = await install(pkgEnvDetails, {
|
|
4675
4697
|
spinner
|
|
@@ -4861,11 +4883,12 @@ async function detectPackageEnvironment({
|
|
|
4861
4883
|
editable: true
|
|
4862
4884
|
})
|
|
4863
4885
|
: undefined
|
|
4864
|
-
const pkgJson = editablePkgJson?.content
|
|
4865
4886
|
// Read Corepack `packageManager` field in package.json:
|
|
4866
4887
|
// https://nodejs.org/api/packages.html#packagemanager
|
|
4867
|
-
const pkgManager = strings.isNonEmptyString(
|
|
4868
|
-
|
|
4888
|
+
const pkgManager = strings.isNonEmptyString(
|
|
4889
|
+
editablePkgJson?.content?.packageManager
|
|
4890
|
+
)
|
|
4891
|
+
? editablePkgJson.content.packageManager
|
|
4869
4892
|
: undefined
|
|
4870
4893
|
let agent
|
|
4871
4894
|
let agentVersion
|
|
@@ -4913,8 +4936,8 @@ async function detectPackageEnvironment({
|
|
|
4913
4936
|
let pkgNodeRange
|
|
4914
4937
|
let pkgMinAgentVersion = minSupportedAgentVersion
|
|
4915
4938
|
let pkgMinNodeVersion = minSupportedNodeVersion
|
|
4916
|
-
if (
|
|
4917
|
-
const { engines } =
|
|
4939
|
+
if (editablePkgJson?.content) {
|
|
4940
|
+
const { engines } = editablePkgJson.content
|
|
4918
4941
|
const engineAgentRange = engines?.[agent]
|
|
4919
4942
|
const engineNodeRange = engines?.['node']
|
|
4920
4943
|
if (strings.isNonEmptyString(engineAgentRange)) {
|
|
@@ -4935,7 +4958,7 @@ async function detectPackageEnvironment({
|
|
|
4935
4958
|
pkgMinNodeVersion = coerced.version
|
|
4936
4959
|
}
|
|
4937
4960
|
}
|
|
4938
|
-
const browserslistQuery =
|
|
4961
|
+
const browserslistQuery = editablePkgJson.content['browserslist']
|
|
4939
4962
|
if (Array.isArray(browserslistQuery)) {
|
|
4940
4963
|
// List Node targets in ascending version order.
|
|
4941
4964
|
const browserslistNodeTargets = vendor
|
|
@@ -5136,8 +5159,8 @@ async function runFix(options_) {
|
|
|
5136
5159
|
}
|
|
5137
5160
|
}
|
|
5138
5161
|
|
|
5139
|
-
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$
|
|
5140
|
-
const config$
|
|
5162
|
+
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$y } = constants
|
|
5163
|
+
const config$B = {
|
|
5141
5164
|
commandName: 'fix',
|
|
5142
5165
|
description: 'Fix "fixable" Socket alerts',
|
|
5143
5166
|
hidden: true,
|
|
@@ -5194,14 +5217,14 @@ const config$A = {
|
|
|
5194
5217
|
`
|
|
5195
5218
|
}
|
|
5196
5219
|
const cmdFix = {
|
|
5197
|
-
description: config$
|
|
5198
|
-
hidden: config$
|
|
5199
|
-
run: run$
|
|
5220
|
+
description: config$B.description,
|
|
5221
|
+
hidden: config$B.hidden,
|
|
5222
|
+
run: run$B
|
|
5200
5223
|
}
|
|
5201
|
-
async function run$
|
|
5224
|
+
async function run$B(argv, importMeta, { parentName }) {
|
|
5202
5225
|
const cli = meowOrExit({
|
|
5203
5226
|
argv,
|
|
5204
|
-
config: config$
|
|
5227
|
+
config: config$B,
|
|
5205
5228
|
importMeta,
|
|
5206
5229
|
parentName
|
|
5207
5230
|
})
|
|
@@ -5215,7 +5238,7 @@ async function run$A(argv, importMeta, { parentName }) {
|
|
|
5215
5238
|
return
|
|
5216
5239
|
}
|
|
5217
5240
|
if (cli.flags['dryRun']) {
|
|
5218
|
-
logger.logger.log(DRY_RUN_BAIL_TEXT$
|
|
5241
|
+
logger.logger.log(DRY_RUN_BAIL_TEXT$y)
|
|
5219
5242
|
return
|
|
5220
5243
|
}
|
|
5221
5244
|
|
|
@@ -5418,8 +5441,8 @@ async function handlePackageInfo({
|
|
|
5418
5441
|
}
|
|
5419
5442
|
}
|
|
5420
5443
|
|
|
5421
|
-
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$
|
|
5422
|
-
const config$
|
|
5444
|
+
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$x } = constants
|
|
5445
|
+
const config$A = {
|
|
5423
5446
|
commandName: 'info',
|
|
5424
5447
|
description: 'Look up info regarding a package',
|
|
5425
5448
|
hidden: true,
|
|
@@ -5444,14 +5467,14 @@ const config$z = {
|
|
|
5444
5467
|
`
|
|
5445
5468
|
}
|
|
5446
5469
|
const cmdInfo = {
|
|
5447
|
-
description: config$
|
|
5448
|
-
hidden: config$
|
|
5449
|
-
run: run$
|
|
5470
|
+
description: config$A.description,
|
|
5471
|
+
hidden: config$A.hidden,
|
|
5472
|
+
run: run$A
|
|
5450
5473
|
}
|
|
5451
|
-
async function run$
|
|
5474
|
+
async function run$A(argv, importMeta, { parentName }) {
|
|
5452
5475
|
const cli = meowOrExit({
|
|
5453
5476
|
argv,
|
|
5454
|
-
config: config$
|
|
5477
|
+
config: config$A,
|
|
5455
5478
|
importMeta,
|
|
5456
5479
|
parentName
|
|
5457
5480
|
})
|
|
@@ -5489,11 +5512,11 @@ async function run$z(argv, importMeta, { parentName }) {
|
|
|
5489
5512
|
const pkgVersion =
|
|
5490
5513
|
versionSeparator < 1 ? 'latest' : rawPkgName.slice(versionSeparator + 1)
|
|
5491
5514
|
if (cli.flags['dryRun']) {
|
|
5492
|
-
logger.logger.log(DRY_RUN_BAIL_TEXT$
|
|
5515
|
+
logger.logger.log(DRY_RUN_BAIL_TEXT$x)
|
|
5493
5516
|
return
|
|
5494
5517
|
}
|
|
5495
5518
|
await handlePackageInfo({
|
|
5496
|
-
commandName: `${parentName} ${config$
|
|
5519
|
+
commandName: `${parentName} ${config$A.commandName}`,
|
|
5497
5520
|
includeAllIssues: Boolean(all),
|
|
5498
5521
|
outputKind: json ? 'json' : markdown ? 'markdown' : 'print',
|
|
5499
5522
|
pkgName,
|
|
@@ -5580,8 +5603,8 @@ async function attemptLogin(apiBaseUrl, apiProxy) {
|
|
|
5580
5603
|
}
|
|
5581
5604
|
}
|
|
5582
5605
|
|
|
5583
|
-
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$
|
|
5584
|
-
const config$
|
|
5606
|
+
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$w } = constants
|
|
5607
|
+
const config$z = {
|
|
5585
5608
|
commandName: 'login',
|
|
5586
5609
|
description: 'Socket API login',
|
|
5587
5610
|
hidden: false,
|
|
@@ -5614,21 +5637,21 @@ const config$y = {
|
|
|
5614
5637
|
`
|
|
5615
5638
|
}
|
|
5616
5639
|
const cmdLogin = {
|
|
5617
|
-
description: config$
|
|
5618
|
-
hidden: config$
|
|
5619
|
-
run: run$
|
|
5640
|
+
description: config$z.description,
|
|
5641
|
+
hidden: config$z.hidden,
|
|
5642
|
+
run: run$z
|
|
5620
5643
|
}
|
|
5621
|
-
async function run$
|
|
5644
|
+
async function run$z(argv, importMeta, { parentName }) {
|
|
5622
5645
|
const cli = meowOrExit({
|
|
5623
5646
|
argv,
|
|
5624
|
-
config: config$
|
|
5647
|
+
config: config$z,
|
|
5625
5648
|
importMeta,
|
|
5626
5649
|
parentName
|
|
5627
5650
|
})
|
|
5628
5651
|
const apiBaseUrl = cli.flags['apiBaseUrl']
|
|
5629
5652
|
const apiProxy = cli.flags['apiProxy']
|
|
5630
5653
|
if (cli.flags['dryRun']) {
|
|
5631
|
-
logger.logger.log(DRY_RUN_BAIL_TEXT$
|
|
5654
|
+
logger.logger.log(DRY_RUN_BAIL_TEXT$w)
|
|
5632
5655
|
return
|
|
5633
5656
|
}
|
|
5634
5657
|
if (!isInteractive()) {
|
|
@@ -5661,8 +5684,8 @@ function attemptLogout() {
|
|
|
5661
5684
|
}
|
|
5662
5685
|
}
|
|
5663
5686
|
|
|
5664
|
-
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$
|
|
5665
|
-
const config$
|
|
5687
|
+
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$v } = constants
|
|
5688
|
+
const config$y = {
|
|
5666
5689
|
commandName: 'logout',
|
|
5667
5690
|
description: 'Socket API logout',
|
|
5668
5691
|
hidden: false,
|
|
@@ -5677,6 +5700,247 @@ const config$x = {
|
|
|
5677
5700
|
`
|
|
5678
5701
|
}
|
|
5679
5702
|
const cmdLogout = {
|
|
5703
|
+
description: config$y.description,
|
|
5704
|
+
hidden: config$y.hidden,
|
|
5705
|
+
run: run$y
|
|
5706
|
+
}
|
|
5707
|
+
async function run$y(argv, importMeta, { parentName }) {
|
|
5708
|
+
const cli = meowOrExit({
|
|
5709
|
+
argv,
|
|
5710
|
+
config: config$y,
|
|
5711
|
+
importMeta,
|
|
5712
|
+
parentName
|
|
5713
|
+
})
|
|
5714
|
+
if (cli.flags['dryRun']) {
|
|
5715
|
+
logger.logger.log(DRY_RUN_BAIL_TEXT$v)
|
|
5716
|
+
return
|
|
5717
|
+
}
|
|
5718
|
+
attemptLogout()
|
|
5719
|
+
}
|
|
5720
|
+
|
|
5721
|
+
async function convertCondaToRequirements(target, cwd, verbose) {
|
|
5722
|
+
let contents
|
|
5723
|
+
if (target === '-') {
|
|
5724
|
+
if (verbose) {
|
|
5725
|
+
logger.logger.error(`[VERBOSE] reading input from stdin`)
|
|
5726
|
+
}
|
|
5727
|
+
const buf = []
|
|
5728
|
+
contents = await new Promise((resolve, reject) => {
|
|
5729
|
+
process.stdin.on('data', chunk => {
|
|
5730
|
+
const input = chunk.toString()
|
|
5731
|
+
buf.push(input)
|
|
5732
|
+
})
|
|
5733
|
+
process.stdin.on('end', () => {
|
|
5734
|
+
resolve(buf.join(''))
|
|
5735
|
+
})
|
|
5736
|
+
process.stdin.on('error', e => {
|
|
5737
|
+
if (verbose) {
|
|
5738
|
+
logger.logger.error('Unexpected error while reading from stdin:', e)
|
|
5739
|
+
}
|
|
5740
|
+
reject(e)
|
|
5741
|
+
})
|
|
5742
|
+
process.stdin.on('close', () => {
|
|
5743
|
+
if (buf.length === 0) {
|
|
5744
|
+
if (verbose) {
|
|
5745
|
+
logger.logger.error('stdin closed explicitly without data received')
|
|
5746
|
+
}
|
|
5747
|
+
reject(new Error('No data received from stdin'))
|
|
5748
|
+
} else {
|
|
5749
|
+
if (verbose) {
|
|
5750
|
+
logger.logger.error(
|
|
5751
|
+
'warning: stdin closed explicitly with some data received'
|
|
5752
|
+
)
|
|
5753
|
+
}
|
|
5754
|
+
resolve(buf.join(''))
|
|
5755
|
+
}
|
|
5756
|
+
})
|
|
5757
|
+
})
|
|
5758
|
+
if (!contents) {
|
|
5759
|
+
return {
|
|
5760
|
+
ok: false,
|
|
5761
|
+
message: 'No data received from stdin',
|
|
5762
|
+
data: undefined
|
|
5763
|
+
}
|
|
5764
|
+
}
|
|
5765
|
+
} else {
|
|
5766
|
+
const f = path$1.resolve(cwd, target)
|
|
5767
|
+
if (verbose) {
|
|
5768
|
+
logger.logger.error(`[VERBOSE] target file: ${f}`)
|
|
5769
|
+
}
|
|
5770
|
+
if (!fs$1.existsSync(f)) {
|
|
5771
|
+
return {
|
|
5772
|
+
ok: false,
|
|
5773
|
+
message: `Input file not found at ${f}`,
|
|
5774
|
+
data: undefined
|
|
5775
|
+
}
|
|
5776
|
+
}
|
|
5777
|
+
contents = fs$1.readFileSync(target, 'utf8')
|
|
5778
|
+
if (!contents) {
|
|
5779
|
+
return {
|
|
5780
|
+
ok: false,
|
|
5781
|
+
message: 'File is empty',
|
|
5782
|
+
data: undefined
|
|
5783
|
+
}
|
|
5784
|
+
}
|
|
5785
|
+
}
|
|
5786
|
+
return {
|
|
5787
|
+
ok: true,
|
|
5788
|
+
message: '',
|
|
5789
|
+
data: {
|
|
5790
|
+
contents,
|
|
5791
|
+
pip: convertCondaToRequirementsFromInput(contents)
|
|
5792
|
+
}
|
|
5793
|
+
}
|
|
5794
|
+
}
|
|
5795
|
+
|
|
5796
|
+
// Just extract the first pip block, if one exists at all.
|
|
5797
|
+
function convertCondaToRequirementsFromInput(input) {
|
|
5798
|
+
const keeping = []
|
|
5799
|
+
let collecting = false
|
|
5800
|
+
let delim = '-'
|
|
5801
|
+
let indent = ''
|
|
5802
|
+
input.split('\n').some(line => {
|
|
5803
|
+
if (!line) {
|
|
5804
|
+
// Ignore empty lines
|
|
5805
|
+
return
|
|
5806
|
+
}
|
|
5807
|
+
if (collecting) {
|
|
5808
|
+
if (line.startsWith('#')) {
|
|
5809
|
+
// Ignore comment lines (keep?)
|
|
5810
|
+
return
|
|
5811
|
+
}
|
|
5812
|
+
if (line.startsWith(delim)) {
|
|
5813
|
+
// In this case we have a line with the same indentation as the
|
|
5814
|
+
// `- pip:` line, so we have reached the end of the pip block.
|
|
5815
|
+
return true // the end
|
|
5816
|
+
} else {
|
|
5817
|
+
if (!indent) {
|
|
5818
|
+
// Store the indentation of the block
|
|
5819
|
+
if (line.trim().startsWith('-')) {
|
|
5820
|
+
indent = line.split('-')[0] + '-'
|
|
5821
|
+
if (indent.length <= delim.length) {
|
|
5822
|
+
// The first line after the `pip:` line does not indent further
|
|
5823
|
+
// than that so the block is empty?
|
|
5824
|
+
return true
|
|
5825
|
+
}
|
|
5826
|
+
}
|
|
5827
|
+
}
|
|
5828
|
+
if (line.startsWith(indent)) {
|
|
5829
|
+
keeping.push(line.slice(indent.length).trim())
|
|
5830
|
+
} else {
|
|
5831
|
+
// Unexpected input. bail.
|
|
5832
|
+
return true
|
|
5833
|
+
}
|
|
5834
|
+
}
|
|
5835
|
+
} else {
|
|
5836
|
+
// Note: the line may end with a line comment so don't === it.
|
|
5837
|
+
if (line.trim().startsWith('- pip:')) {
|
|
5838
|
+
delim = line.split('-')[0] + '-'
|
|
5839
|
+
collecting = true
|
|
5840
|
+
}
|
|
5841
|
+
}
|
|
5842
|
+
})
|
|
5843
|
+
return keeping.join('\n')
|
|
5844
|
+
}
|
|
5845
|
+
|
|
5846
|
+
async function outputRequirements(data, outputKind, out) {
|
|
5847
|
+
if (outputKind === 'json') {
|
|
5848
|
+
const json = JSON.stringify(
|
|
5849
|
+
{
|
|
5850
|
+
ok: true,
|
|
5851
|
+
data: {
|
|
5852
|
+
pip: data.pip
|
|
5853
|
+
}
|
|
5854
|
+
},
|
|
5855
|
+
undefined,
|
|
5856
|
+
2
|
|
5857
|
+
)
|
|
5858
|
+
if (out === '-') {
|
|
5859
|
+
logger.logger.log(json)
|
|
5860
|
+
} else {
|
|
5861
|
+
fs$1.writeFileSync(out, json, 'utf8')
|
|
5862
|
+
}
|
|
5863
|
+
return
|
|
5864
|
+
}
|
|
5865
|
+
if (outputKind === 'markdown') {
|
|
5866
|
+
const arr = []
|
|
5867
|
+
arr.push('# Converted Conda file')
|
|
5868
|
+
arr.push('')
|
|
5869
|
+
arr.push(
|
|
5870
|
+
'This is the Conda `environment.yml` file converted to python `requirements.txt`:'
|
|
5871
|
+
)
|
|
5872
|
+
arr.push('')
|
|
5873
|
+
arr.push('```file=requirements.txt')
|
|
5874
|
+
arr.push(data.pip)
|
|
5875
|
+
arr.push('```')
|
|
5876
|
+
arr.push('')
|
|
5877
|
+
const md = arr.join('\n')
|
|
5878
|
+
if (out === '-') {
|
|
5879
|
+
logger.logger.log(md)
|
|
5880
|
+
} else {
|
|
5881
|
+
fs$1.writeFileSync(out, md, 'utf8')
|
|
5882
|
+
}
|
|
5883
|
+
return
|
|
5884
|
+
}
|
|
5885
|
+
if (out === '-') {
|
|
5886
|
+
logger.logger.log(data.pip)
|
|
5887
|
+
logger.logger.log('')
|
|
5888
|
+
} else {
|
|
5889
|
+
fs$1.writeFileSync(out, data.pip, 'utf8')
|
|
5890
|
+
}
|
|
5891
|
+
}
|
|
5892
|
+
|
|
5893
|
+
async function handleManifestConda(target, out, outputKind, cwd, verbose) {
|
|
5894
|
+
const data = await convertCondaToRequirements(target, cwd, verbose)
|
|
5895
|
+
if (!data) {
|
|
5896
|
+
return
|
|
5897
|
+
}
|
|
5898
|
+
if (!data.ok) {
|
|
5899
|
+
logger.logger.fail(data.message)
|
|
5900
|
+
return
|
|
5901
|
+
}
|
|
5902
|
+
await outputRequirements(data.data, outputKind, out)
|
|
5903
|
+
}
|
|
5904
|
+
|
|
5905
|
+
const { DRY_RUN_BAIL_TEXT: DRY_RUN_BAIL_TEXT$u } = constants
|
|
5906
|
+
const config$x = {
|
|
5907
|
+
commandName: 'conda',
|
|
5908
|
+
description:
|
|
5909
|
+
'[beta] Convert a Conda environment.yml file to a python requirements.txt',
|
|
5910
|
+
hidden: false,
|
|
5911
|
+
flags: {
|
|
5912
|
+
...commonFlags,
|
|
5913
|
+
...outputFlags,
|
|
5914
|
+
cwd: {
|
|
5915
|
+
type: 'string',
|
|
5916
|
+
description: 'Set the cwd, defaults to process.cwd()'
|
|
5917
|
+
},
|
|
5918
|
+
out: {
|
|
5919
|
+
type: 'string',
|
|
5920
|
+
default: '-',
|
|
5921
|
+
description: 'Output target (use `-` or omit to print to stdout)'
|
|
5922
|
+
},
|
|
5923
|
+
verbose: {
|
|
5924
|
+
type: 'boolean',
|
|
5925
|
+
description: 'Print debug messages'
|
|
5926
|
+
}
|
|
5927
|
+
},
|
|
5928
|
+
help: (command, config) => `
|
|
5929
|
+
Usage
|
|
5930
|
+
$ ${command} FILE
|
|
5931
|
+
|
|
5932
|
+
Note: FILE can be a dash (-) to indicate stdin. This way you can pipe the
|
|
5933
|
+
contents of a file to have it processed.
|
|
5934
|
+
|
|
5935
|
+
Options
|
|
5936
|
+
${getFlagListOutput(config.flags, 6)}
|
|
5937
|
+
|
|
5938
|
+
Examples
|
|
5939
|
+
|
|
5940
|
+
$ ${command} ./environment.yml
|
|
5941
|
+
`
|
|
5942
|
+
}
|
|
5943
|
+
const cmdManifestConda = {
|
|
5680
5944
|
description: config$x.description,
|
|
5681
5945
|
hidden: config$x.hidden,
|
|
5682
5946
|
run: run$x
|
|
@@ -5688,11 +5952,59 @@ async function run$x(argv, importMeta, { parentName }) {
|
|
|
5688
5952
|
importMeta,
|
|
5689
5953
|
parentName
|
|
5690
5954
|
})
|
|
5955
|
+
const {
|
|
5956
|
+
cwd = process.cwd(),
|
|
5957
|
+
json = false,
|
|
5958
|
+
markdown = false,
|
|
5959
|
+
out = '-',
|
|
5960
|
+
verbose = false
|
|
5961
|
+
} = cli.flags
|
|
5962
|
+
const [target = ''] = cli.input
|
|
5963
|
+
if (verbose) {
|
|
5964
|
+
logger.logger.group('- ', parentName, config$x.commandName, ':')
|
|
5965
|
+
logger.logger.group('- flags:', cli.flags)
|
|
5966
|
+
logger.logger.groupEnd()
|
|
5967
|
+
logger.logger.log('- target:', target)
|
|
5968
|
+
logger.logger.log('- output:', out)
|
|
5969
|
+
logger.logger.groupEnd()
|
|
5970
|
+
}
|
|
5971
|
+
const wasBadInput = handleBadInput(
|
|
5972
|
+
{
|
|
5973
|
+
test: !!target,
|
|
5974
|
+
message: 'The FILE arg is required',
|
|
5975
|
+
pass: 'ok',
|
|
5976
|
+
fail: 'missing'
|
|
5977
|
+
},
|
|
5978
|
+
{
|
|
5979
|
+
nook: true,
|
|
5980
|
+
test: cli.input.length <= 1,
|
|
5981
|
+
message: 'Can only accept one DIR (make sure to escape spaces!)',
|
|
5982
|
+
pass: 'ok',
|
|
5983
|
+
fail: 'received ' + cli.input.length
|
|
5984
|
+
},
|
|
5985
|
+
{
|
|
5986
|
+
nook: true,
|
|
5987
|
+
test: !json || !markdown,
|
|
5988
|
+
message:
|
|
5989
|
+
'The `--json` and `--markdown` flags can not be used at the same time',
|
|
5990
|
+
pass: 'ok',
|
|
5991
|
+
fail: 'bad'
|
|
5992
|
+
}
|
|
5993
|
+
)
|
|
5994
|
+
if (wasBadInput) {
|
|
5995
|
+
return
|
|
5996
|
+
}
|
|
5691
5997
|
if (cli.flags['dryRun']) {
|
|
5692
5998
|
logger.logger.log(DRY_RUN_BAIL_TEXT$u)
|
|
5693
5999
|
return
|
|
5694
6000
|
}
|
|
5695
|
-
|
|
6001
|
+
await handleManifestConda(
|
|
6002
|
+
target,
|
|
6003
|
+
String(out || ''),
|
|
6004
|
+
json ? 'json' : markdown ? 'markdown' : 'text',
|
|
6005
|
+
String(cwd),
|
|
6006
|
+
Boolean(verbose)
|
|
6007
|
+
)
|
|
5696
6008
|
}
|
|
5697
6009
|
|
|
5698
6010
|
async function convertGradleToMaven(target, bin, cwd, verbose, gradleOpts) {
|
|
@@ -6298,6 +6610,25 @@ async function run$u(argv, importMeta, { parentName }) {
|
|
|
6298
6610
|
})
|
|
6299
6611
|
return
|
|
6300
6612
|
}
|
|
6613
|
+
const envyml = path$1.join(dir, 'environment.yml')
|
|
6614
|
+
const hasEnvyml = fs$1.existsSync(envyml)
|
|
6615
|
+
const envyaml = path$1.join(dir, 'environment.yaml')
|
|
6616
|
+
const hasEnvyaml = !hasEnvyml && fs$1.existsSync(envyaml)
|
|
6617
|
+
if (hasEnvyml || hasEnvyaml) {
|
|
6618
|
+
logger.logger.log(
|
|
6619
|
+
'Detected an environment.yml file, running default Conda generator...'
|
|
6620
|
+
)
|
|
6621
|
+
// This command takes the TARGET as first arg.
|
|
6622
|
+
subArgs.push(hasEnvyml ? envyml : hasEnvyaml ? envyaml : '')
|
|
6623
|
+
if (cli.flags['dryRun']) {
|
|
6624
|
+
logger.logger.log(DRY_RUN_BAIL_TEXT$r)
|
|
6625
|
+
return
|
|
6626
|
+
}
|
|
6627
|
+
await cmdManifestConda.run(subArgs, importMeta, {
|
|
6628
|
+
parentName
|
|
6629
|
+
})
|
|
6630
|
+
return
|
|
6631
|
+
}
|
|
6301
6632
|
if (cli.flags['dryRun']) {
|
|
6302
6633
|
logger.logger.log(DRY_RUN_BAIL_TEXT$r)
|
|
6303
6634
|
return
|
|
@@ -6488,6 +6819,7 @@ async function run$s(argv, importMeta, { parentName }) {
|
|
|
6488
6819
|
await meowWithSubcommands(
|
|
6489
6820
|
{
|
|
6490
6821
|
auto: cmdManifestAuto,
|
|
6822
|
+
conda: cmdManifestConda,
|
|
6491
6823
|
scala: cmdManifestScala,
|
|
6492
6824
|
gradle: cmdManifestGradle,
|
|
6493
6825
|
kotlin: cmdManifestKotlin
|
|
@@ -9931,11 +10263,6 @@ const config$8 = {
|
|
|
9931
10263
|
description:
|
|
9932
10264
|
'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.'
|
|
9933
10265
|
},
|
|
9934
|
-
dryRun: {
|
|
9935
|
-
type: 'boolean',
|
|
9936
|
-
description:
|
|
9937
|
-
'Run input validation part of command without any concrete side effects'
|
|
9938
|
-
},
|
|
9939
10266
|
pendingHead: {
|
|
9940
10267
|
type: 'boolean',
|
|
9941
10268
|
default: true,
|
|
@@ -11940,7 +12267,7 @@ void (async () => {
|
|
|
11940
12267
|
await vendor.updater({
|
|
11941
12268
|
name: SOCKET_CLI_BIN_NAME,
|
|
11942
12269
|
// The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
|
|
11943
|
-
version: '0.14.
|
|
12270
|
+
version: '0.14.106',
|
|
11944
12271
|
ttl: 86_400_000 /* 24 hours in milliseconds */
|
|
11945
12272
|
})
|
|
11946
12273
|
try {
|
|
@@ -12008,5 +12335,5 @@ void (async () => {
|
|
|
12008
12335
|
await shadowNpmInject.captureException(e)
|
|
12009
12336
|
}
|
|
12010
12337
|
})()
|
|
12011
|
-
//# debugId=
|
|
12338
|
+
//# debugId=262dd99f-490c-457b-886d-df52563318d8
|
|
12012
12339
|
//# sourceMappingURL=cli.js.map
|