socket 0.14.118 → 0.14.120

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.
@@ -917,7 +917,7 @@ function emitBanner(name) {
917
917
  logger.logger.error(getAsciiHeader(name))
918
918
  }
919
919
  function getAsciiHeader(command) {
920
- const cliVersion = '0.14.118:fb39c6f:81d22cc7:pub' // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION_HASH']".
920
+ const cliVersion = '0.14.120:d9e8965:5c231098: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
923
  const defaultOrg = shadowNpmInject.getConfigValue('defaultOrg')
@@ -3817,12 +3817,9 @@ async function gitCreateAndPushBranchIfNeeded(
3817
3817
  cwd = process.cwd()
3818
3818
  ) {
3819
3819
  if (await gitBranchExists(branch, cwd)) {
3820
- logger.logger.warn(`Branch "${branch}" already exists. Skipping creation.`)
3821
- return false
3820
+ logger.logger.warn(`Branch "${branch}" already exists, skipping creation.`)
3821
+ return true
3822
3822
  }
3823
- await spawn.spawn('git', ['checkout', '-b', branch], {
3824
- cwd
3825
- })
3826
3823
  const moddedFilepaths = (await gitUnstagedModifiedFiles(cwd)).filter(p => {
3827
3824
  const basename = path$1.basename(p)
3828
3825
  return (
@@ -3831,11 +3828,16 @@ async function gitCreateAndPushBranchIfNeeded(
3831
3828
  basename === 'pnpm-lock.yaml'
3832
3829
  )
3833
3830
  })
3834
- if (moddedFilepaths.length) {
3835
- await spawn.spawn('git', ['add', ...moddedFilepaths], {
3836
- cwd
3837
- })
3831
+ if (!moddedFilepaths.length) {
3832
+ logger.logger.warn('Nothing to commit, skipping push.')
3833
+ return false
3838
3834
  }
3835
+ await spawn.spawn('git', ['checkout', '-b', branch], {
3836
+ cwd
3837
+ })
3838
+ await spawn.spawn('git', ['add', ...moddedFilepaths], {
3839
+ cwd
3840
+ })
3839
3841
  await spawn.spawn('git', ['commit', '-m', commitMsg], {
3840
3842
  cwd
3841
3843
  })
@@ -4103,6 +4105,10 @@ async function npmFix(
4103
4105
  oldVersion
4104
4106
  )
4105
4107
  if (!node) {
4108
+ debug.debugLog(
4109
+ `Skipping ${oldSpec}, no node found in arborist.idealTree`,
4110
+ pkgJsonPath
4111
+ )
4106
4112
  continue
4107
4113
  }
4108
4114
  if (
@@ -4216,13 +4222,16 @@ async function npmFix(
4216
4222
  error = e
4217
4223
  errored = true
4218
4224
  }
4219
- if (!errored && shouldOpenPr) {
4225
+ if (
4226
+ !errored &&
4227
+ shouldOpenPr &&
4220
4228
  // eslint-disable-next-line no-await-in-loop
4221
- await gitCreateAndPushBranchIfNeeded(
4229
+ (await gitCreateAndPushBranchIfNeeded(
4222
4230
  branch,
4223
4231
  getSocketCommitMessage(oldPurl, newVersion, workspaceName),
4224
4232
  cwd
4225
- )
4233
+ ))
4234
+ ) {
4226
4235
  // eslint-disable-next-line no-await-in-loop
4227
4236
  const prResponse = await openGitHubPullRequest(
4228
4237
  owner,
@@ -4503,13 +4512,18 @@ async function pnpmFix(
4503
4512
  firstPatchedVersionIdentifier,
4504
4513
  vulnerableVersionRange
4505
4514
  } of infos) {
4515
+ // eslint-disable-next-line no-await-in-loop
4516
+ actualTree = await getActualTree()
4506
4517
  const node = shadowNpmInject.findPackageNode(
4507
4518
  actualTree,
4508
4519
  name,
4509
4520
  oldVersion
4510
4521
  )
4511
4522
  if (!node) {
4512
- debug.debugLog('skipping no node', pkgJsonPath)
4523
+ debug.debugLog(
4524
+ `Skipping ${oldSpec}, no node found in arborist.actualTree`,
4525
+ pkgJsonPath
4526
+ )
4513
4527
  continue
4514
4528
  }
4515
4529
  const availableVersions = Object.keys(packument.versions)
@@ -4627,7 +4641,7 @@ async function pnpmFix(
4627
4641
  newVersion,
4628
4642
  rangeStyle
4629
4643
  )
4630
- debug.debugLog('updatePackageJsonFromNode', modded)
4644
+ debug.debugLog(`Updated package.json from node: ${modded}`)
4631
4645
  let error
4632
4646
  let errored = false
4633
4647
  let installed = false
@@ -4669,13 +4683,16 @@ async function pnpmFix(
4669
4683
  error = e
4670
4684
  errored = true
4671
4685
  }
4672
- if (!errored && shouldOpenPr) {
4686
+ if (
4687
+ !errored &&
4688
+ shouldOpenPr &&
4673
4689
  // eslint-disable-next-line no-await-in-loop
4674
- await gitCreateAndPushBranchIfNeeded(
4690
+ (await gitCreateAndPushBranchIfNeeded(
4675
4691
  branch,
4676
4692
  getSocketCommitMessage(oldPurl, newVersion, workspaceName),
4677
4693
  cwd
4678
- )
4694
+ ))
4695
+ ) {
4679
4696
  // eslint-disable-next-line no-await-in-loop
4680
4697
  const prResponse = await openGitHubPullRequest(
4681
4698
  owner,
@@ -12296,7 +12313,7 @@ void (async () => {
12296
12313
  await vendor.updater({
12297
12314
  name: SOCKET_CLI_BIN_NAME,
12298
12315
  // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
12299
- version: '0.14.118',
12316
+ version: '0.14.120',
12300
12317
  ttl: 86_400_000 /* 24 hours in milliseconds */
12301
12318
  })
12302
12319
  try {
@@ -12364,5 +12381,5 @@ void (async () => {
12364
12381
  await shadowNpmInject.captureException(e)
12365
12382
  }
12366
12383
  })()
12367
- //# debugId=1911c4b4-75fd-408e-81ff-9c4463baa635
12384
+ //# debugId=776d94c4-537e-4ae8-824d-a4a612fa5e0f
12368
12385
  //# sourceMappingURL=cli.js.map