@socketsecurity/cli-with-sentry 0.14.106 → 0.14.107

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.106:968fc98:d6f1d87a:pub'
44
+ '0.14.107:50dd758:3aa99209: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=d1310559-3c56-4c67-b04a-f71c213ee79
59
+ //# debugId=7ac62440-00ea-4d3b-925e-54c87c9dce5e
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":"d1310559-3c56-4c67-b04a-f71c213ee79"}
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":"7ac62440-00ea-4d3b-925e-54c87c9dce5e"}
@@ -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.106:968fc98:d6f1d87a:pub' // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION_HASH']".
920
+ const cliVersion = '0.14.107:50dd758:3aa99209: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 shownToken = apiToken ? getLastFiveOfApiToken(apiToken) : 'no'
@@ -3815,14 +3815,16 @@ async function gitCreateAndPushBranchIfNeeded(
3815
3815
  await spawn.spawn('git', ['checkout', '-b', branch], {
3816
3816
  cwd
3817
3817
  })
3818
- const relFilepaths = await vendor.distExports.glob(
3819
- '**/{package.json,package-lock.json,pnpm-lock.yaml}',
3820
- {
3821
- cwd
3822
- }
3823
- )
3824
- if (relFilepaths.length) {
3825
- await spawn.spawn('git', ['add', ...relFilepaths], {
3818
+ const moddedFilepaths = (await gitModifiedFiles(cwd)).filter(p => {
3819
+ const basename = path$1.basename(p)
3820
+ return (
3821
+ basename === 'package.json' ||
3822
+ basename === 'package-lock.json' ||
3823
+ basename === 'pnpm-lock.yaml'
3824
+ )
3825
+ })
3826
+ if (moddedFilepaths.length) {
3827
+ await spawn.spawn('git', ['add', ...moddedFilepaths], {
3826
3828
  cwd
3827
3829
  })
3828
3830
  }
@@ -3839,6 +3841,13 @@ async function gitHardReset(cwd = process.cwd()) {
3839
3841
  cwd
3840
3842
  })
3841
3843
  }
3844
+ async function gitModifiedFiles(cwd = process.cwd()) {
3845
+ const { stdout } = await spawn.spawn('git', ['diff', '--name-only'], {
3846
+ cwd
3847
+ })
3848
+ const rawFiles = stdout?.trim().split('\n') ?? []
3849
+ return rawFiles.map(relPath => path.normalizePath(relPath))
3850
+ }
3842
3851
  async function isInGitRepo(cwd = process.cwd()) {
3843
3852
  try {
3844
3853
  await spawn.spawn('git', ['rev-parse', '--is-inside-work-tree'], {
@@ -3876,13 +3885,16 @@ function getOctokitGraphql() {
3876
3885
  }
3877
3886
  async function doesPullRequestExistForBranch(owner, repo, branch) {
3878
3887
  const octokit = getOctokit()
3879
- const { data: prs } = await octokit.pulls.list({
3880
- owner,
3881
- repo,
3882
- head: `${owner}:${branch}`,
3883
- state: 'open'
3884
- })
3885
- return prs.length > 0
3888
+ try {
3889
+ const { data: prs } = await octokit.pulls.list({
3890
+ owner,
3891
+ repo,
3892
+ head: `${owner}:${branch}`,
3893
+ state: 'open'
3894
+ })
3895
+ return prs.length > 0
3896
+ } catch {}
3897
+ return false
3886
3898
  }
3887
3899
  async function enableAutoMerge({ node_id: prId, number: prNumber }) {
3888
3900
  const octokitGraphql = getOctokitGraphql()
@@ -12267,7 +12279,7 @@ void (async () => {
12267
12279
  await vendor.updater({
12268
12280
  name: SOCKET_CLI_BIN_NAME,
12269
12281
  // The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
12270
- version: '0.14.106',
12282
+ version: '0.14.107',
12271
12283
  ttl: 86_400_000 /* 24 hours in milliseconds */
12272
12284
  })
12273
12285
  try {
@@ -12335,5 +12347,5 @@ void (async () => {
12335
12347
  await shadowNpmInject.captureException(e)
12336
12348
  }
12337
12349
  })()
12338
- //# debugId=262dd99f-490c-457b-886d-df52563318d8
12350
+ //# debugId=1a78e420-9227-454d-9bf5-ad9bd2d2bf56
12339
12351
  //# sourceMappingURL=cli.js.map