@socketsecurity/cli-with-sentry 0.14.73 → 0.14.75

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.73:3036c50:ff90e036:pub'
44
+ '0.14.75:48886e4:53d4dbe7: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=1c81fd52-7998-4b0f-af09-b8779210363e
59
+ //# debugId=6fb4ba09-84f2-42c9-b082-ee55c6760b1f
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":"1c81fd52-7998-4b0f-af09-b8779210363e"}
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":"6fb4ba09-84f2-42c9-b082-ee55c6760b1f"}
@@ -914,7 +914,7 @@ function emitBanner(name) {
914
914
  logger.logger.error(getAsciiHeader(name))
915
915
  }
916
916
  function getAsciiHeader(command) {
917
- const cliVersion = '0.14.73:3036c50:ff90e036:pub' // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION_HASH']".
917
+ const cliVersion = '0.14.75:48886e4:53d4dbe7:pub' // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION_HASH']".
918
918
  const nodeVersion = process$1.version
919
919
  const apiToken = shadowNpmInject.getDefaultToken()
920
920
  const shownToken = apiToken ? getLastFiveOfApiToken(apiToken) : 'no'
@@ -3192,6 +3192,28 @@ async function commitAndPushFix(branchName, commitMsg, cwd) {
3192
3192
  cwd
3193
3193
  })
3194
3194
  }
3195
+ async function waitForBranchToBeReadable(octokit, owner, repo, branch) {
3196
+ const maxRetries = 10
3197
+ const delay = 1500
3198
+ for (let i = 0; i < maxRetries; i++) {
3199
+ try {
3200
+ // eslint-disable-next-line no-await-in-loop
3201
+ const ref = await octokit.git.getRef({
3202
+ owner,
3203
+ repo,
3204
+ ref: `heads/${branch}`
3205
+ })
3206
+ if (ref) {
3207
+ return
3208
+ }
3209
+ } catch (err) {
3210
+ // Still not ready
3211
+ }
3212
+ // eslint-disable-next-line no-await-in-loop
3213
+ await new Promise(resolve => setTimeout(resolve, delay))
3214
+ }
3215
+ throw new Error(`Branch "${branch}" never became visible to GitHub API`)
3216
+ }
3195
3217
  async function createPullRequest({
3196
3218
  base = 'main',
3197
3219
  body,
@@ -3203,7 +3225,7 @@ async function createPullRequest({
3203
3225
  const octokit = new rest.Octokit({
3204
3226
  auth: process.env['SOCKET_AUTOFIX_PAT'] ?? process.env['GITHUB_TOKEN']
3205
3227
  })
3206
- await new Promise(resolve => setTimeout(resolve, 3000)) // 3s
3228
+ await waitForBranchToBeReadable(octokit, owner, repo, head)
3207
3229
  await octokit.pulls.create({
3208
3230
  owner,
3209
3231
  repo,
@@ -3349,6 +3371,19 @@ async function pnpmFix(pkgEnvDetails, options) {
3349
3371
  const commitMsg = `fix: upgrade ${name} to ${targetVersion}`
3350
3372
  const { owner, repo } = getRepoInfo()
3351
3373
  // eslint-disable-next-line no-await-in-loop
3374
+ await spawn.spawn(
3375
+ 'git',
3376
+ [
3377
+ 'remote',
3378
+ 'set-url',
3379
+ 'origin',
3380
+ `https://x-access-token:${process.env['SOCKET_AUTOFIX_PAT']}@github.com/${owner}/${repo}`
3381
+ ],
3382
+ {
3383
+ cwd
3384
+ }
3385
+ )
3386
+ // eslint-disable-next-line no-await-in-loop
3352
3387
  await commitAndPushFix(branchName, commitMsg, cwd)
3353
3388
  // eslint-disable-next-line no-await-in-loop
3354
3389
  await createPullRequest({
@@ -11021,7 +11056,7 @@ void (async () => {
11021
11056
  await updateNotifier({
11022
11057
  name: SOCKET_CLI_BIN_NAME,
11023
11058
  // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
11024
- version: '0.14.73',
11059
+ version: '0.14.75',
11025
11060
  ttl: 86_400_000 /* 24 hours in milliseconds */
11026
11061
  })
11027
11062
  try {
@@ -11092,5 +11127,5 @@ void (async () => {
11092
11127
  await shadowNpmInject.captureException(e)
11093
11128
  }
11094
11129
  })()
11095
- //# debugId=ffabba5b-b39f-4375-9b2f-88d2ab4544aa
11130
+ //# debugId=99d185ab-8a3c-4079-9df0-6377da54d4a1
11096
11131
  //# sourceMappingURL=cli.js.map