socket 0.14.117 → 0.14.119

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.117:3a58b03:992e8879:pub' // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION_HASH']".
920
+ const cliVersion = '0.14.119:4f7b6a8:5ff737f3: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
  })
@@ -4216,13 +4218,16 @@ async function npmFix(
4216
4218
  error = e
4217
4219
  errored = true
4218
4220
  }
4219
- if (!errored && shouldOpenPr) {
4221
+ if (
4222
+ !errored &&
4223
+ shouldOpenPr &&
4220
4224
  // eslint-disable-next-line no-await-in-loop
4221
- await gitCreateAndPushBranchIfNeeded(
4225
+ (await gitCreateAndPushBranchIfNeeded(
4222
4226
  branch,
4223
4227
  getSocketCommitMessage(oldPurl, newVersion, workspaceName),
4224
4228
  cwd
4225
- )
4229
+ ))
4230
+ ) {
4226
4231
  // eslint-disable-next-line no-await-in-loop
4227
4232
  const prResponse = await openGitHubPullRequest(
4228
4233
  owner,
@@ -4248,19 +4253,15 @@ async function npmFix(
4248
4253
  spinner?.error(`Reverting ${newSpec}${workspaceDetails}`, error)
4249
4254
  }
4250
4255
  }
4251
- // eslint-disable-next-line no-await-in-loop
4252
- await shadowNpmInject.removeNodeModules(cwd)
4253
- if (isRepo) {
4254
- // eslint-disable-next-line no-await-in-loop
4255
- await gitHardReset(cwd)
4256
- }
4257
4256
  if (saved) {
4258
4257
  editablePkgJson.update(revertData)
4259
- if (!isRepo) {
4260
- // eslint-disable-next-line no-await-in-loop
4261
- await editablePkgJson.save()
4262
- }
4263
4258
  }
4259
+ // eslint-disable-next-line no-await-in-loop
4260
+ await Promise.all([
4261
+ shadowNpmInject.removeNodeModules(cwd),
4262
+ ...(isRepo ? [gitHardReset(cwd)] : []),
4263
+ ...(saved && !isRepo ? [editablePkgJson.save()] : [])
4264
+ ])
4264
4265
  if (!isRepo && installed) {
4265
4266
  // eslint-disable-next-line no-await-in-loop
4266
4267
  await install$1(revertTree, {
@@ -4673,13 +4674,16 @@ async function pnpmFix(
4673
4674
  error = e
4674
4675
  errored = true
4675
4676
  }
4676
- if (!errored && shouldOpenPr) {
4677
+ if (
4678
+ !errored &&
4679
+ shouldOpenPr &&
4677
4680
  // eslint-disable-next-line no-await-in-loop
4678
- await gitCreateAndPushBranchIfNeeded(
4681
+ (await gitCreateAndPushBranchIfNeeded(
4679
4682
  branch,
4680
4683
  getSocketCommitMessage(oldPurl, newVersion, workspaceName),
4681
4684
  cwd
4682
- )
4685
+ ))
4686
+ ) {
4683
4687
  // eslint-disable-next-line no-await-in-loop
4684
4688
  const prResponse = await openGitHubPullRequest(
4685
4689
  owner,
@@ -4707,20 +4711,18 @@ async function pnpmFix(
4707
4711
  }
4708
4712
  editablePkgJson.update(revertData)
4709
4713
  // eslint-disable-next-line no-await-in-loop
4710
- await shadowNpmInject.removeNodeModules(cwd)
4711
- if (isRepo) {
4712
- // eslint-disable-next-line no-await-in-loop
4713
- await gitHardReset(cwd)
4714
- // eslint-disable-next-line no-await-in-loop
4715
- actualTree = await getActualTree(cwd)
4716
- } else if (installed) {
4717
- // eslint-disable-next-line no-await-in-loop
4718
- await editablePkgJson.save()
4719
- // eslint-disable-next-line no-await-in-loop
4720
- actualTree = await install(pkgEnvDetails, {
4721
- spinner
4722
- })
4723
- }
4714
+ await Promise.all([
4715
+ shadowNpmInject.removeNodeModules(cwd),
4716
+ ...(isRepo
4717
+ ? [gitHardReset(cwd)]
4718
+ : installed
4719
+ ? [editablePkgJson.save()]
4720
+ : [])
4721
+ ])
4722
+ // eslint-disable-next-line no-await-in-loop
4723
+ actualTree = await install(pkgEnvDetails, {
4724
+ spinner
4725
+ })
4724
4726
  if (errored) {
4725
4727
  if (!failedSpecs.has(newSpecKey)) {
4726
4728
  failedSpecs.add(newSpecKey)
@@ -12302,7 +12304,7 @@ void (async () => {
12302
12304
  await vendor.updater({
12303
12305
  name: SOCKET_CLI_BIN_NAME,
12304
12306
  // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
12305
- version: '0.14.117',
12307
+ version: '0.14.119',
12306
12308
  ttl: 86_400_000 /* 24 hours in milliseconds */
12307
12309
  })
12308
12310
  try {
@@ -12370,5 +12372,5 @@ void (async () => {
12370
12372
  await shadowNpmInject.captureException(e)
12371
12373
  }
12372
12374
  })()
12373
- //# debugId=6435fd3c-af36-45dd-abe9-42d54adb2b3f
12375
+ //# debugId=617452d4-7fe3-48d9-912c-adf3352d17b3
12374
12376
  //# sourceMappingURL=cli.js.map