socket 0.14.100 → 0.14.101
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 +82 -68
- 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 +82 -68
- 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
|
@@ -900,7 +900,7 @@ function emitBanner(name) {
|
|
|
900
900
|
logger.logger.error(getAsciiHeader(name))
|
|
901
901
|
}
|
|
902
902
|
function getAsciiHeader(command) {
|
|
903
|
-
const cliVersion = '0.14.
|
|
903
|
+
const cliVersion = '0.14.101:26533ef:8b0b91f5:pub' // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION_HASH']".
|
|
904
904
|
const nodeVersion = process$1.version
|
|
905
905
|
const apiToken = shadowNpmInject.getDefaultToken()
|
|
906
906
|
const shownToken = apiToken ? getLastFiveOfApiToken(apiToken) : 'no'
|
|
@@ -3965,6 +3965,8 @@ async function npmFix(
|
|
|
3965
3965
|
const editablePkgJson = await packages.readPackageJson(cwd, {
|
|
3966
3966
|
editable: true
|
|
3967
3967
|
})
|
|
3968
|
+
// Lazily access constants.ENV[CI].
|
|
3969
|
+
const isCi = constants.ENV[CI$1]
|
|
3968
3970
|
await arb.buildIdealTree()
|
|
3969
3971
|
for (const { 0: name, 1: infos } of infoByPkg) {
|
|
3970
3972
|
const hasUpgrade = !!registry.getManifestData(NPM$f, name)
|
|
@@ -4010,8 +4012,8 @@ async function npmFix(
|
|
|
4010
4012
|
if (
|
|
4011
4013
|
!shadowNpmInject.updateNode(node, packument, vulnerableVersionRange)
|
|
4012
4014
|
) {
|
|
4013
|
-
spinner?.
|
|
4014
|
-
|
|
4015
|
+
spinner?.fail(`Could not patch ${fromSpec}`)
|
|
4016
|
+
continue
|
|
4015
4017
|
}
|
|
4016
4018
|
const toVersion = node.package.version
|
|
4017
4019
|
const toVersionRange = shadowNpmInject.applyRange(
|
|
@@ -4020,21 +4022,17 @@ async function npmFix(
|
|
|
4020
4022
|
rangeStyle
|
|
4021
4023
|
)
|
|
4022
4024
|
const toSpec = `${name}@${toVersionRange}`
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
repo,
|
|
4035
|
-
branch
|
|
4036
|
-
))
|
|
4037
|
-
}
|
|
4025
|
+
const branch = isCi ? getSocketBranchName(fromPurl, toVersion) : ''
|
|
4026
|
+
const { owner, repo } = isCi
|
|
4027
|
+
? getGitHubEnvRepoInfo()
|
|
4028
|
+
: {
|
|
4029
|
+
owner: '',
|
|
4030
|
+
repo: ''
|
|
4031
|
+
}
|
|
4032
|
+
const shouldOpenPr = isCi
|
|
4033
|
+
? // eslint-disable-next-line no-await-in-loop
|
|
4034
|
+
!(await doesPullRequestExistForBranch(owner, repo, branch))
|
|
4035
|
+
: false
|
|
4038
4036
|
const revertData = {
|
|
4039
4037
|
...(editablePkgJson.content.dependencies
|
|
4040
4038
|
? {
|
|
@@ -4058,6 +4056,8 @@ async function npmFix(
|
|
|
4058
4056
|
|
|
4059
4057
|
// eslint-disable-next-line no-await-in-loop
|
|
4060
4058
|
await checkoutBaseBranchIfAvailable(baseBranch, cwd)
|
|
4059
|
+
let error
|
|
4060
|
+
let errored = false
|
|
4061
4061
|
let installed = false
|
|
4062
4062
|
let saved = false
|
|
4063
4063
|
try {
|
|
@@ -4087,23 +4087,11 @@ async function npmFix(
|
|
|
4087
4087
|
}
|
|
4088
4088
|
spinner?.successAndStop(`Fixed ${name}`)
|
|
4089
4089
|
spinner?.start()
|
|
4090
|
-
} catch {
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
editablePkgJson.update(revertData)
|
|
4094
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4095
|
-
await editablePkgJson.save()
|
|
4096
|
-
}
|
|
4097
|
-
if (installed) {
|
|
4098
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4099
|
-
await install$1(revertTree, {
|
|
4100
|
-
cwd
|
|
4101
|
-
})
|
|
4102
|
-
}
|
|
4103
|
-
spinner?.failAndStop(`Failed to fix ${fromSpec}`)
|
|
4104
|
-
return
|
|
4090
|
+
} catch (e) {
|
|
4091
|
+
error = e
|
|
4092
|
+
errored = true
|
|
4105
4093
|
}
|
|
4106
|
-
if (shouldOpenPr) {
|
|
4094
|
+
if (!errored && shouldOpenPr) {
|
|
4107
4095
|
// eslint-disable-next-line no-await-in-loop
|
|
4108
4096
|
await createAndPushBranchIfNeeded(
|
|
4109
4097
|
branch,
|
|
@@ -4125,6 +4113,25 @@ async function npmFix(
|
|
|
4125
4113
|
await enableAutoMerge(prResponse.data)
|
|
4126
4114
|
}
|
|
4127
4115
|
}
|
|
4116
|
+
if (errored || isCi) {
|
|
4117
|
+
if (errored) {
|
|
4118
|
+
spinner?.error(`Reverting ${toSpec}`, error)
|
|
4119
|
+
}
|
|
4120
|
+
if (saved) {
|
|
4121
|
+
editablePkgJson.update(revertData)
|
|
4122
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4123
|
+
await editablePkgJson.save()
|
|
4124
|
+
}
|
|
4125
|
+
if (installed) {
|
|
4126
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4127
|
+
await install$1(revertTree, {
|
|
4128
|
+
cwd
|
|
4129
|
+
})
|
|
4130
|
+
}
|
|
4131
|
+
if (errored) {
|
|
4132
|
+
spinner?.failAndStop(`Failed to fix ${fromSpec}`)
|
|
4133
|
+
}
|
|
4134
|
+
}
|
|
4128
4135
|
}
|
|
4129
4136
|
}
|
|
4130
4137
|
}
|
|
@@ -4375,6 +4382,8 @@ async function pnpmFix(
|
|
|
4375
4382
|
const editablePkgJson = await packages.readPackageJson(cwd, {
|
|
4376
4383
|
editable: true
|
|
4377
4384
|
})
|
|
4385
|
+
// Lazily access constants.ENV[CI].
|
|
4386
|
+
const isCi = constants.ENV[CI]
|
|
4378
4387
|
let actualTree = await getActualTree(cwd)
|
|
4379
4388
|
for (const { 0: name, 1: infos } of infoByPkg) {
|
|
4380
4389
|
if (registry.getManifestData(NPM$c, name)) {
|
|
@@ -4422,8 +4431,8 @@ async function pnpmFix(
|
|
|
4422
4431
|
? packument.versions[toVersion]
|
|
4423
4432
|
: undefined
|
|
4424
4433
|
if (!(toVersion && targetPackument)) {
|
|
4425
|
-
spinner?.
|
|
4426
|
-
|
|
4434
|
+
spinner?.fail(`Could not patch ${fromSpec}`)
|
|
4435
|
+
continue
|
|
4427
4436
|
}
|
|
4428
4437
|
const oldPnpm = editablePkgJson.content[PNPM$9]
|
|
4429
4438
|
const oldPnpmKeyCount = oldPnpm ? Object.keys(oldPnpm).length : 0
|
|
@@ -4438,21 +4447,17 @@ async function pnpmFix(
|
|
|
4438
4447
|
rangeStyle
|
|
4439
4448
|
)
|
|
4440
4449
|
const toSpec = `${name}@${toVersionRange}`
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
repo,
|
|
4453
|
-
branch
|
|
4454
|
-
))
|
|
4455
|
-
}
|
|
4450
|
+
const branch = isCi ? getSocketBranchName(fromPurl, toVersion) : ''
|
|
4451
|
+
const { owner, repo } = isCi
|
|
4452
|
+
? getGitHubEnvRepoInfo()
|
|
4453
|
+
: {
|
|
4454
|
+
owner: '',
|
|
4455
|
+
repo: ''
|
|
4456
|
+
}
|
|
4457
|
+
const shouldOpenPr = isCi
|
|
4458
|
+
? // eslint-disable-next-line no-await-in-loop
|
|
4459
|
+
!(await doesPullRequestExistForBranch(owner, repo, branch))
|
|
4460
|
+
: false
|
|
4456
4461
|
const updateData = {
|
|
4457
4462
|
[PNPM$9]: {
|
|
4458
4463
|
...oldPnpm,
|
|
@@ -4497,6 +4502,8 @@ async function pnpmFix(
|
|
|
4497
4502
|
|
|
4498
4503
|
// eslint-disable-next-line no-await-in-loop
|
|
4499
4504
|
await checkoutBaseBranchIfAvailable(baseBranch, cwd)
|
|
4505
|
+
let error
|
|
4506
|
+
let errored = false
|
|
4500
4507
|
let installed = false
|
|
4501
4508
|
let saved = false
|
|
4502
4509
|
try {
|
|
@@ -4528,22 +4535,10 @@ async function pnpmFix(
|
|
|
4528
4535
|
spinner?.successAndStop(`Fixed ${name}`)
|
|
4529
4536
|
spinner?.start()
|
|
4530
4537
|
} catch (e) {
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
editablePkgJson.update(revertData)
|
|
4534
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4535
|
-
await editablePkgJson.save()
|
|
4536
|
-
}
|
|
4537
|
-
if (installed) {
|
|
4538
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4539
|
-
actualTree = await install(pkgEnvDetails, {
|
|
4540
|
-
spinner
|
|
4541
|
-
})
|
|
4542
|
-
}
|
|
4543
|
-
spinner?.failAndStop(`Failed to fix ${fromSpec}`)
|
|
4544
|
-
return
|
|
4538
|
+
error = e
|
|
4539
|
+
errored = true
|
|
4545
4540
|
}
|
|
4546
|
-
if (shouldOpenPr) {
|
|
4541
|
+
if (!errored && shouldOpenPr) {
|
|
4547
4542
|
// eslint-disable-next-line no-await-in-loop
|
|
4548
4543
|
await createAndPushBranchIfNeeded(
|
|
4549
4544
|
branch,
|
|
@@ -4565,6 +4560,25 @@ async function pnpmFix(
|
|
|
4565
4560
|
await enableAutoMerge(prResponse.data)
|
|
4566
4561
|
}
|
|
4567
4562
|
}
|
|
4563
|
+
if (errored || isCi) {
|
|
4564
|
+
if (errored) {
|
|
4565
|
+
spinner?.error(`Reverting ${toSpec}`, error)
|
|
4566
|
+
}
|
|
4567
|
+
if (saved) {
|
|
4568
|
+
editablePkgJson.update(revertData)
|
|
4569
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4570
|
+
await editablePkgJson.save()
|
|
4571
|
+
}
|
|
4572
|
+
if (installed) {
|
|
4573
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4574
|
+
actualTree = await install(pkgEnvDetails, {
|
|
4575
|
+
spinner
|
|
4576
|
+
})
|
|
4577
|
+
}
|
|
4578
|
+
if (errored) {
|
|
4579
|
+
spinner?.failAndStop(`Failed to fix ${fromSpec}`)
|
|
4580
|
+
}
|
|
4581
|
+
}
|
|
4568
4582
|
}
|
|
4569
4583
|
}
|
|
4570
4584
|
}
|
|
@@ -11484,7 +11498,7 @@ void (async () => {
|
|
|
11484
11498
|
await vendor.updater({
|
|
11485
11499
|
name: SOCKET_CLI_BIN_NAME,
|
|
11486
11500
|
// The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
|
|
11487
|
-
version: '0.14.
|
|
11501
|
+
version: '0.14.101',
|
|
11488
11502
|
ttl: 86_400_000 /* 24 hours in milliseconds */
|
|
11489
11503
|
})
|
|
11490
11504
|
try {
|
|
@@ -11552,5 +11566,5 @@ void (async () => {
|
|
|
11552
11566
|
await shadowNpmInject.captureException(e)
|
|
11553
11567
|
}
|
|
11554
11568
|
})()
|
|
11555
|
-
//# debugId=
|
|
11569
|
+
//# debugId=994a338d-d21c-4fec-b92e-a2121b0f443a
|
|
11556
11570
|
//# sourceMappingURL=cli.js.map
|