socket 0.14.107 → 0.14.109
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/cli.js +36 -12
- package/dist/module-sync/cli.js.map +1 -1
- package/dist/module-sync/shadow-npm-inject.js +2 -2
- package/dist/module-sync/shadow-npm-inject.js.map +1 -1
- package/dist/require/cli.js +36 -12
- package/dist/require/cli.js.map +1 -1
- package/dist/require/shadow-npm-inject.js +2 -2
- package/dist/require/shadow-npm-inject.js.map +1 -1
- package/package.json +1 -1
package/dist/module-sync/cli.js
CHANGED
|
@@ -917,9 +917,11 @@ function emitBanner(name) {
|
|
|
917
917
|
logger.logger.error(getAsciiHeader(name))
|
|
918
918
|
}
|
|
919
919
|
function getAsciiHeader(command) {
|
|
920
|
-
const cliVersion = '0.14.
|
|
920
|
+
const cliVersion = '0.14.109:c6dcd25:241925b4:pub' // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION_HASH']".
|
|
921
921
|
const nodeVersion = process$1.version
|
|
922
922
|
const apiToken = shadowNpmInject.getDefaultToken()
|
|
923
|
+
const defaultOrg = shadowNpmInject.getConfigValue('defaultOrg')
|
|
924
|
+
const readOnlyConfig = shadowNpmInject.isReadOnlyConfig() ? '*' : '.'
|
|
923
925
|
const shownToken = apiToken ? getLastFiveOfApiToken(apiToken) : 'no'
|
|
924
926
|
const relCwd = path.normalizePath(
|
|
925
927
|
process$1
|
|
@@ -935,7 +937,7 @@ function getAsciiHeader(command) {
|
|
|
935
937
|
const body = `
|
|
936
938
|
_____ _ _ /---------------
|
|
937
939
|
| __|___ ___| |_ ___| |_ | Socket.dev CLI ver ${cliVersion}
|
|
938
|
-
|__ |
|
|
940
|
+
|__ | ${readOnlyConfig} | _| '_| -_| _| | Node: ${nodeVersion}, API token set: ${shownToken}${defaultOrg ? `, default org: ${defaultOrg}` : ''}
|
|
939
941
|
|_____|___|___|_,_|___|_|.dev | Command: \`${command}\`, cwd: ${relCwd}`.trimStart()
|
|
940
942
|
return ` ${body}\n`
|
|
941
943
|
}
|
|
@@ -2301,7 +2303,7 @@ async function handleScanReport({
|
|
|
2301
2303
|
})
|
|
2302
2304
|
}
|
|
2303
2305
|
|
|
2304
|
-
async function outputCreateNewScan(data, outputKind) {
|
|
2306
|
+
async function outputCreateNewScan(data, outputKind, interactive) {
|
|
2305
2307
|
if (!data.id) {
|
|
2306
2308
|
logger.logger.fail('Did not receive a scan ID from the API...')
|
|
2307
2309
|
process.exitCode = 1
|
|
@@ -2341,10 +2343,11 @@ async function outputCreateNewScan(data, outputKind) {
|
|
|
2341
2343
|
)
|
|
2342
2344
|
logger.logger.log(`Available at: ${link}`)
|
|
2343
2345
|
if (
|
|
2344
|
-
|
|
2346
|
+
interactive &&
|
|
2347
|
+
(await prompts.confirm({
|
|
2345
2348
|
message: 'Would you like to open it in your browser?',
|
|
2346
2349
|
default: false
|
|
2347
|
-
})
|
|
2350
|
+
}))
|
|
2348
2351
|
) {
|
|
2349
2352
|
await vendor.open(`${data.html_report_url}`)
|
|
2350
2353
|
}
|
|
@@ -2357,6 +2360,7 @@ async function handleCreateNewScan({
|
|
|
2357
2360
|
committers,
|
|
2358
2361
|
cwd,
|
|
2359
2362
|
defaultBranch,
|
|
2363
|
+
interactive,
|
|
2360
2364
|
orgSlug,
|
|
2361
2365
|
outputKind,
|
|
2362
2366
|
pendingHead,
|
|
@@ -2428,7 +2432,7 @@ async function handleCreateNewScan({
|
|
|
2428
2432
|
process.exitCode = 1
|
|
2429
2433
|
}
|
|
2430
2434
|
} else {
|
|
2431
|
-
await outputCreateNewScan(data, outputKind)
|
|
2435
|
+
await outputCreateNewScan(data, outputKind, interactive)
|
|
2432
2436
|
}
|
|
2433
2437
|
}
|
|
2434
2438
|
|
|
@@ -2451,6 +2455,7 @@ async function handleCI() {
|
|
|
2451
2455
|
committers: '',
|
|
2452
2456
|
cwd: process.cwd(),
|
|
2453
2457
|
defaultBranch: false,
|
|
2458
|
+
interactive: false,
|
|
2454
2459
|
orgSlug,
|
|
2455
2460
|
outputKind: 'json',
|
|
2456
2461
|
pendingHead: true,
|
|
@@ -3815,7 +3820,7 @@ async function gitCreateAndPushBranchIfNeeded(
|
|
|
3815
3820
|
await spawn.spawn('git', ['checkout', '-b', branch], {
|
|
3816
3821
|
cwd
|
|
3817
3822
|
})
|
|
3818
|
-
const moddedFilepaths = (await
|
|
3823
|
+
const moddedFilepaths = (await gitUnstagedModifiedFiles(cwd)).filter(p => {
|
|
3819
3824
|
const basename = path$1.basename(p)
|
|
3820
3825
|
return (
|
|
3821
3826
|
basename === 'package.json' ||
|
|
@@ -3823,6 +3828,11 @@ async function gitCreateAndPushBranchIfNeeded(
|
|
|
3823
3828
|
basename === 'pnpm-lock.yaml'
|
|
3824
3829
|
)
|
|
3825
3830
|
})
|
|
3831
|
+
debug.debugLog('branch', branch)
|
|
3832
|
+
debug.debugLog(
|
|
3833
|
+
'gitCreateAndPushBranchIfNeeded > moddedFilepaths',
|
|
3834
|
+
moddedFilepaths
|
|
3835
|
+
)
|
|
3826
3836
|
if (moddedFilepaths.length) {
|
|
3827
3837
|
await spawn.spawn('git', ['add', ...moddedFilepaths], {
|
|
3828
3838
|
cwd
|
|
@@ -3841,7 +3851,7 @@ async function gitHardReset(cwd = process.cwd()) {
|
|
|
3841
3851
|
cwd
|
|
3842
3852
|
})
|
|
3843
3853
|
}
|
|
3844
|
-
async function
|
|
3854
|
+
async function gitUnstagedModifiedFiles(cwd = process.cwd()) {
|
|
3845
3855
|
const { stdout } = await spawn.spawn('git', ['diff', '--name-only'], {
|
|
3846
3856
|
cwd
|
|
3847
3857
|
})
|
|
@@ -3892,6 +3902,7 @@ async function doesPullRequestExistForBranch(owner, repo, branch) {
|
|
|
3892
3902
|
head: `${owner}:${branch}`,
|
|
3893
3903
|
state: 'open'
|
|
3894
3904
|
})
|
|
3905
|
+
debug.debugLog('doesPullRequestExistForBranch > prs', prs)
|
|
3895
3906
|
return prs.length > 0
|
|
3896
3907
|
} catch {}
|
|
3897
3908
|
return false
|
|
@@ -4467,6 +4478,7 @@ async function pnpmFix(
|
|
|
4467
4478
|
pkgEnvDetails.editablePkgJson.filename,
|
|
4468
4479
|
...workspacePkgJsonPaths
|
|
4469
4480
|
]
|
|
4481
|
+
debug.debugLog('workspacePkgJsonPaths', workspacePkgJsonPaths)
|
|
4470
4482
|
let actualTree = initialTree
|
|
4471
4483
|
for (const { 0: name, 1: infos } of infoByPkg) {
|
|
4472
4484
|
if (registry.getManifestData(NPM$c, name)) {
|
|
@@ -4521,6 +4533,7 @@ async function pnpmFix(
|
|
|
4521
4533
|
}
|
|
4522
4534
|
continue
|
|
4523
4535
|
}
|
|
4536
|
+
debug.debugLog('pkgJsonPaths', pkgJsonPaths)
|
|
4524
4537
|
for (const pkgJsonPath of pkgJsonPaths) {
|
|
4525
4538
|
const isWorkspaceRoot =
|
|
4526
4539
|
pkgJsonPath === pkgEnvDetails.editablePkgJson.filename
|
|
@@ -4659,13 +4672,16 @@ async function pnpmFix(
|
|
|
4659
4672
|
error = e
|
|
4660
4673
|
errored = true
|
|
4661
4674
|
}
|
|
4675
|
+
debug.debugLog('check "errored":', errored)
|
|
4662
4676
|
if (!errored && shouldOpenPr) {
|
|
4677
|
+
debug.debugLog('1: gitCreateAndPushBranchIfNeeded')
|
|
4663
4678
|
// eslint-disable-next-line no-await-in-loop
|
|
4664
4679
|
await gitCreateAndPushBranchIfNeeded(
|
|
4665
4680
|
branch,
|
|
4666
4681
|
getSocketCommitMessage(oldPurl, newVersion, workspaceName),
|
|
4667
4682
|
cwd
|
|
4668
4683
|
)
|
|
4684
|
+
debug.debugLog('2: openGitHubPullRequest')
|
|
4669
4685
|
// eslint-disable-next-line no-await-in-loop
|
|
4670
4686
|
const prResponse = await openGitHubPullRequest(
|
|
4671
4687
|
owner,
|
|
@@ -10271,6 +10287,12 @@ const config$8 = {
|
|
|
10271
10287
|
description:
|
|
10272
10288
|
'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.'
|
|
10273
10289
|
},
|
|
10290
|
+
interactive: {
|
|
10291
|
+
type: 'boolean',
|
|
10292
|
+
default: true,
|
|
10293
|
+
description:
|
|
10294
|
+
'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
|
|
10295
|
+
},
|
|
10274
10296
|
pendingHead: {
|
|
10275
10297
|
type: 'boolean',
|
|
10276
10298
|
default: true,
|
|
@@ -10367,6 +10389,7 @@ async function run$8(argv, importMeta, { parentName }) {
|
|
|
10367
10389
|
cwd: cwdOverride,
|
|
10368
10390
|
defaultBranch,
|
|
10369
10391
|
dryRun,
|
|
10392
|
+
interactive = true,
|
|
10370
10393
|
json,
|
|
10371
10394
|
markdown,
|
|
10372
10395
|
pendingHead,
|
|
@@ -10392,7 +10415,7 @@ async function run$8(argv, importMeta, { parentName }) {
|
|
|
10392
10415
|
// If we updated any inputs then we should print the command line to repeat
|
|
10393
10416
|
// the command without requiring user input, as a suggestion.
|
|
10394
10417
|
let updatedInput = false
|
|
10395
|
-
if (!targets.length && !dryRun) {
|
|
10418
|
+
if (!targets.length && !dryRun && interactive) {
|
|
10396
10419
|
const received = await suggestTarget()
|
|
10397
10420
|
targets = received ?? []
|
|
10398
10421
|
updatedInput = true
|
|
@@ -10401,7 +10424,7 @@ async function run$8(argv, importMeta, { parentName }) {
|
|
|
10401
10424
|
// If the current cwd is unknown and is used as a repo slug anyways, we will
|
|
10402
10425
|
// first need to register the slug before we can use it.
|
|
10403
10426
|
// Only do suggestions with an apiToken and when not in dryRun mode
|
|
10404
|
-
if (apiToken && !dryRun) {
|
|
10427
|
+
if (apiToken && !dryRun && interactive) {
|
|
10405
10428
|
if (!orgSlug) {
|
|
10406
10429
|
const suggestion = await suggestOrgSlug()
|
|
10407
10430
|
if (suggestion) {
|
|
@@ -10489,6 +10512,7 @@ async function run$8(argv, importMeta, { parentName }) {
|
|
|
10489
10512
|
committers: (committers && String(committers)) || '',
|
|
10490
10513
|
cwd,
|
|
10491
10514
|
defaultBranch: Boolean(defaultBranch),
|
|
10515
|
+
interactive: Boolean(interactive),
|
|
10492
10516
|
orgSlug,
|
|
10493
10517
|
outputKind: json ? 'json' : markdown ? 'markdown' : 'text',
|
|
10494
10518
|
pendingHead: Boolean(pendingHead),
|
|
@@ -12275,7 +12299,7 @@ void (async () => {
|
|
|
12275
12299
|
await vendor.updater({
|
|
12276
12300
|
name: SOCKET_CLI_BIN_NAME,
|
|
12277
12301
|
// The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
|
|
12278
|
-
version: '0.14.
|
|
12302
|
+
version: '0.14.109',
|
|
12279
12303
|
ttl: 86_400_000 /* 24 hours in milliseconds */
|
|
12280
12304
|
})
|
|
12281
12305
|
try {
|
|
@@ -12343,5 +12367,5 @@ void (async () => {
|
|
|
12343
12367
|
await shadowNpmInject.captureException(e)
|
|
12344
12368
|
}
|
|
12345
12369
|
})()
|
|
12346
|
-
//# debugId=
|
|
12370
|
+
//# debugId=5749d845-bfec-49fb-b09e-8adb970927b1
|
|
12347
12371
|
//# sourceMappingURL=cli.js.map
|