@socketsecurity/cli-with-sentry 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.
@@ -41,7 +41,7 @@ const relConstantsPath = './constants'
41
41
  Sentry.setTag(
42
42
  'version',
43
43
  // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION_HASH']".
44
- '0.14.118:fb39c6f:26305ac3:pub'
44
+ '0.14.120:d9e8965:3549d1b8:pub'
45
45
  )
46
46
  const constants = require(relConstantsPath)
47
47
  if (constants.ENV.SOCKET_CLI_DEBUG) {
@@ -56,5 +56,5 @@ const relConstantsPath = './constants'
56
56
  } = constants
57
57
  setSentry(Sentry)
58
58
  }
59
- //# debugId=d9a76e32-452e-4726-b1c0-3fde619937df
59
+ //# debugId=5af65e0c-4be6-423f-9ccb-c672cc4403d8
60
60
  //# sourceMappingURL=instrument-with-sentry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"instrument-with-sentry.js","sources":["../../src/instrument-with-sentry.ts"],"sourcesContent":["// This should ONLY be included in the special Sentry build!\n// Otherwise the Sentry dependency won't even be present in the manifest.\n\nimport { logger } from '@socketsecurity/registry/lib/logger'\n\n// Require constants with require(relConstantsPath) instead of require('./constants')\n// so Rollup doesn't generate a constants2.js chunk.\nconst relConstantsPath = './constants'\n// The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_SENTRY_BUILD']\".\nif (process.env['INLINED_SOCKET_CLI_SENTRY_BUILD']) {\n const Sentry = require('@sentry/node')\n Sentry.init({\n onFatalError(error: Error) {\n // Defer module loads until after Sentry.init is called.\n if (require(relConstantsPath).ENV.SOCKET_CLI_DEBUG) {\n logger.fail('[DEBUG] [Sentry onFatalError]:', error)\n }\n },\n dsn: 'https://66736701db8e4ffac046bd09fa6aaced@o555220.ingest.us.sentry.io/4508846967619585',\n enabled: true,\n integrations: []\n })\n Sentry.setTag(\n 'environment',\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_PUBLISHED_BUILD']\".\n process.env['INLINED_SOCKET_CLI_PUBLISHED_BUILD']\n ? 'pub'\n : // The NODE_ENV convention is used by apps to define the runtime environment.\n // https://nodejs.org/en/learn/getting-started/nodejs-the-difference-between-development-and-production\n process.env['NODE_ENV']\n )\n Sentry.setTag(\n 'version',\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_VERSION_HASH']\".\n process.env['INLINED_SOCKET_CLI_VERSION_HASH']\n )\n const constants = require(relConstantsPath)\n if (constants.ENV.SOCKET_CLI_DEBUG) {\n Sentry.setTag('debugging', true)\n logger.log('[DEBUG] Set up Sentry.')\n } else {\n Sentry.setTag('debugging', false)\n }\n const {\n kInternalsSymbol,\n [kInternalsSymbol as unknown as 'Symbol(kInternalsSymbol)']: { setSentry }\n } = constants\n setSentry(Sentry)\n} else if (require(relConstantsPath).ENV.SOCKET_CLI_DEBUG) {\n logger.log('[DEBUG] Sentry disabled explicitly.')\n}\n"],"names":["logger","dsn","enabled","integrations","process","Sentry","setSentry"],"mappings":";;;;;;;;;;;;;;;AAAA;AACA;;;AAIA;AACA;AACA;AACA;AACoD;AAClD;;;AAGI;;AAEEA;AACF;;AAEFC;AACAC;AACAC;AACF;;AAGE;AACAC;;AAQA;AACAA;AAEF;AACA;AACEC;AACAL;AACF;AACEK;AACF;;;AAGE;AAA+DC;AAAU;AAC3E;;AAEF","debugId":"d9a76e32-452e-4726-b1c0-3fde619937df"}
1
+ {"version":3,"file":"instrument-with-sentry.js","sources":["../../src/instrument-with-sentry.ts"],"sourcesContent":["// This should ONLY be included in the special Sentry build!\n// Otherwise the Sentry dependency won't even be present in the manifest.\n\nimport { logger } from '@socketsecurity/registry/lib/logger'\n\n// Require constants with require(relConstantsPath) instead of require('./constants')\n// so Rollup doesn't generate a constants2.js chunk.\nconst relConstantsPath = './constants'\n// The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_SENTRY_BUILD']\".\nif (process.env['INLINED_SOCKET_CLI_SENTRY_BUILD']) {\n const Sentry = require('@sentry/node')\n Sentry.init({\n onFatalError(error: Error) {\n // Defer module loads until after Sentry.init is called.\n if (require(relConstantsPath).ENV.SOCKET_CLI_DEBUG) {\n logger.fail('[DEBUG] [Sentry onFatalError]:', error)\n }\n },\n dsn: 'https://66736701db8e4ffac046bd09fa6aaced@o555220.ingest.us.sentry.io/4508846967619585',\n enabled: true,\n integrations: []\n })\n Sentry.setTag(\n 'environment',\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_PUBLISHED_BUILD']\".\n process.env['INLINED_SOCKET_CLI_PUBLISHED_BUILD']\n ? 'pub'\n : // The NODE_ENV convention is used by apps to define the runtime environment.\n // https://nodejs.org/en/learn/getting-started/nodejs-the-difference-between-development-and-production\n process.env['NODE_ENV']\n )\n Sentry.setTag(\n 'version',\n // The '@rollup/plugin-replace' will replace \"process.env['INLINED_SOCKET_CLI_VERSION_HASH']\".\n process.env['INLINED_SOCKET_CLI_VERSION_HASH']\n )\n const constants = require(relConstantsPath)\n if (constants.ENV.SOCKET_CLI_DEBUG) {\n Sentry.setTag('debugging', true)\n logger.log('[DEBUG] Set up Sentry.')\n } else {\n Sentry.setTag('debugging', false)\n }\n const {\n kInternalsSymbol,\n [kInternalsSymbol as unknown as 'Symbol(kInternalsSymbol)']: { setSentry }\n } = constants\n setSentry(Sentry)\n} else if (require(relConstantsPath).ENV.SOCKET_CLI_DEBUG) {\n logger.log('[DEBUG] Sentry disabled explicitly.')\n}\n"],"names":["logger","dsn","enabled","integrations","process","Sentry","setSentry"],"mappings":";;;;;;;;;;;;;;;AAAA;AACA;;;AAIA;AACA;AACA;AACA;AACoD;AAClD;;;AAGI;;AAEEA;AACF;;AAEFC;AACAC;AACAC;AACF;;AAGE;AACAC;;AAQA;AACAA;AAEF;AACA;AACEC;AACAL;AACF;AACEK;AACF;;;AAGE;AAA+DC;AAAU;AAC3E;;AAEF","debugId":"5af65e0c-4be6-423f-9ccb-c672cc4403d8"}
@@ -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:26305ac3:pub' // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION_HASH']".
920
+ const cliVersion = '0.14.120:d9e8965:3549d1b8: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,
@@ -4507,13 +4516,18 @@ async function pnpmFix(
4507
4516
  firstPatchedVersionIdentifier,
4508
4517
  vulnerableVersionRange
4509
4518
  } of infos) {
4519
+ // eslint-disable-next-line no-await-in-loop
4520
+ actualTree = await getActualTree()
4510
4521
  const node = shadowNpmInject.findPackageNode(
4511
4522
  actualTree,
4512
4523
  name,
4513
4524
  oldVersion
4514
4525
  )
4515
4526
  if (!node) {
4516
- debug.debugLog('skipping no node', pkgJsonPath)
4527
+ debug.debugLog(
4528
+ `Skipping ${oldSpec}, no node found in arborist.actualTree`,
4529
+ pkgJsonPath
4530
+ )
4517
4531
  continue
4518
4532
  }
4519
4533
  const availableVersions = Object.keys(packument.versions)
@@ -4631,7 +4645,7 @@ async function pnpmFix(
4631
4645
  newVersion,
4632
4646
  rangeStyle
4633
4647
  )
4634
- debug.debugLog('updatePackageJsonFromNode', modded)
4648
+ debug.debugLog(`Updated package.json from node: ${modded}`)
4635
4649
  let error
4636
4650
  let errored = false
4637
4651
  let installed = false
@@ -4673,13 +4687,16 @@ async function pnpmFix(
4673
4687
  error = e
4674
4688
  errored = true
4675
4689
  }
4676
- if (!errored && shouldOpenPr) {
4690
+ if (
4691
+ !errored &&
4692
+ shouldOpenPr &&
4677
4693
  // eslint-disable-next-line no-await-in-loop
4678
- await gitCreateAndPushBranchIfNeeded(
4694
+ (await gitCreateAndPushBranchIfNeeded(
4679
4695
  branch,
4680
4696
  getSocketCommitMessage(oldPurl, newVersion, workspaceName),
4681
4697
  cwd
4682
- )
4698
+ ))
4699
+ ) {
4683
4700
  // eslint-disable-next-line no-await-in-loop
4684
4701
  const prResponse = await openGitHubPullRequest(
4685
4702
  owner,
@@ -12300,7 +12317,7 @@ void (async () => {
12300
12317
  await vendor.updater({
12301
12318
  name: SOCKET_CLI_BIN_NAME,
12302
12319
  // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
12303
- version: '0.14.118',
12320
+ version: '0.14.120',
12304
12321
  ttl: 86_400_000 /* 24 hours in milliseconds */
12305
12322
  })
12306
12323
  try {
@@ -12368,5 +12385,5 @@ void (async () => {
12368
12385
  await shadowNpmInject.captureException(e)
12369
12386
  }
12370
12387
  })()
12371
- //# debugId=a562420c-f066-44bd-9943-52776a7de105
12388
+ //# debugId=d3515312-ada8-4513-a04e-bb0925cf84b
12372
12389
  //# sourceMappingURL=cli.js.map