@socketsecurity/cli-with-sentry 0.14.107 → 0.14.109
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.
- package/dist/instrument-with-sentry.js +2 -2
- package/dist/instrument-with-sentry.js.map +1 -1
- package/dist/module-sync/cli.js +36 -12
- package/dist/module-sync/cli.js.map +1 -1
- package/dist/module-sync/shadow-npm-inject.js +2 -2
- package/dist/module-sync/shadow-npm-inject.js.map +1 -1
- package/dist/require/cli.js +36 -12
- package/dist/require/cli.js.map +1 -1
- package/dist/require/shadow-npm-inject.js +2 -2
- package/dist/require/shadow-npm-inject.js.map +1 -1
- package/package.json +1 -1
|
@@ -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.
|
|
44
|
+
'0.14.109:c6dcd25:2fe312db: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=
|
|
59
|
+
//# debugId=8f6e8d30-e43e-4cc0-ac8b-c106158d56a1
|
|
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":"
|
|
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":"8f6e8d30-e43e-4cc0-ac8b-c106158d56a1"}
|
package/dist/module-sync/cli.js
CHANGED
|
@@ -917,9 +917,11 @@ function emitBanner(name) {
|
|
|
917
917
|
logger.logger.error(getAsciiHeader(name))
|
|
918
918
|
}
|
|
919
919
|
function getAsciiHeader(command) {
|
|
920
|
-
const cliVersion = '0.14.
|
|
920
|
+
const cliVersion = '0.14.109:c6dcd25:2fe312db: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
|
+
const defaultOrg = shadowNpmInject.getConfigValue('defaultOrg')
|
|
924
|
+
const readOnlyConfig = shadowNpmInject.isReadOnlyConfig() ? '*' : '.'
|
|
923
925
|
const shownToken = apiToken ? getLastFiveOfApiToken(apiToken) : 'no'
|
|
924
926
|
const relCwd = path.normalizePath(
|
|
925
927
|
process$1
|
|
@@ -935,7 +937,7 @@ function getAsciiHeader(command) {
|
|
|
935
937
|
const body = `
|
|
936
938
|
_____ _ _ /---------------
|
|
937
939
|
| __|___ ___| |_ ___| |_ | Socket.dev CLI ver ${cliVersion}
|
|
938
|
-
|__ |
|
|
940
|
+
|__ | ${readOnlyConfig} | _| '_| -_| _| | Node: ${nodeVersion}, API token set: ${shownToken}${defaultOrg ? `, default org: ${defaultOrg}` : ''}
|
|
939
941
|
|_____|___|___|_,_|___|_|.dev | Command: \`${command}\`, cwd: ${relCwd}`.trimStart()
|
|
940
942
|
return ` ${body}\n`
|
|
941
943
|
}
|
|
@@ -2301,7 +2303,7 @@ async function handleScanReport({
|
|
|
2301
2303
|
})
|
|
2302
2304
|
}
|
|
2303
2305
|
|
|
2304
|
-
async function outputCreateNewScan(data, outputKind) {
|
|
2306
|
+
async function outputCreateNewScan(data, outputKind, interactive) {
|
|
2305
2307
|
if (!data.id) {
|
|
2306
2308
|
logger.logger.fail('Did not receive a scan ID from the API...')
|
|
2307
2309
|
process.exitCode = 1
|
|
@@ -2341,10 +2343,11 @@ async function outputCreateNewScan(data, outputKind) {
|
|
|
2341
2343
|
)
|
|
2342
2344
|
logger.logger.log(`Available at: ${link}`)
|
|
2343
2345
|
if (
|
|
2344
|
-
|
|
2346
|
+
interactive &&
|
|
2347
|
+
(await prompts.confirm({
|
|
2345
2348
|
message: 'Would you like to open it in your browser?',
|
|
2346
2349
|
default: false
|
|
2347
|
-
})
|
|
2350
|
+
}))
|
|
2348
2351
|
) {
|
|
2349
2352
|
await vendor.open(`${data.html_report_url}`)
|
|
2350
2353
|
}
|
|
@@ -2357,6 +2360,7 @@ async function handleCreateNewScan({
|
|
|
2357
2360
|
committers,
|
|
2358
2361
|
cwd,
|
|
2359
2362
|
defaultBranch,
|
|
2363
|
+
interactive,
|
|
2360
2364
|
orgSlug,
|
|
2361
2365
|
outputKind,
|
|
2362
2366
|
pendingHead,
|
|
@@ -2428,7 +2432,7 @@ async function handleCreateNewScan({
|
|
|
2428
2432
|
process.exitCode = 1
|
|
2429
2433
|
}
|
|
2430
2434
|
} else {
|
|
2431
|
-
await outputCreateNewScan(data, outputKind)
|
|
2435
|
+
await outputCreateNewScan(data, outputKind, interactive)
|
|
2432
2436
|
}
|
|
2433
2437
|
}
|
|
2434
2438
|
|
|
@@ -2451,6 +2455,7 @@ async function handleCI() {
|
|
|
2451
2455
|
committers: '',
|
|
2452
2456
|
cwd: process.cwd(),
|
|
2453
2457
|
defaultBranch: false,
|
|
2458
|
+
interactive: false,
|
|
2454
2459
|
orgSlug,
|
|
2455
2460
|
outputKind: 'json',
|
|
2456
2461
|
pendingHead: true,
|
|
@@ -3815,7 +3820,7 @@ async function gitCreateAndPushBranchIfNeeded(
|
|
|
3815
3820
|
await spawn.spawn('git', ['checkout', '-b', branch], {
|
|
3816
3821
|
cwd
|
|
3817
3822
|
})
|
|
3818
|
-
const moddedFilepaths = (await
|
|
3823
|
+
const moddedFilepaths = (await gitUnstagedModifiedFiles(cwd)).filter(p => {
|
|
3819
3824
|
const basename = path$1.basename(p)
|
|
3820
3825
|
return (
|
|
3821
3826
|
basename === 'package.json' ||
|
|
@@ -3823,6 +3828,11 @@ async function gitCreateAndPushBranchIfNeeded(
|
|
|
3823
3828
|
basename === 'pnpm-lock.yaml'
|
|
3824
3829
|
)
|
|
3825
3830
|
})
|
|
3831
|
+
debug.debugLog('branch', branch)
|
|
3832
|
+
debug.debugLog(
|
|
3833
|
+
'gitCreateAndPushBranchIfNeeded > moddedFilepaths',
|
|
3834
|
+
moddedFilepaths
|
|
3835
|
+
)
|
|
3826
3836
|
if (moddedFilepaths.length) {
|
|
3827
3837
|
await spawn.spawn('git', ['add', ...moddedFilepaths], {
|
|
3828
3838
|
cwd
|
|
@@ -3841,7 +3851,7 @@ async function gitHardReset(cwd = process.cwd()) {
|
|
|
3841
3851
|
cwd
|
|
3842
3852
|
})
|
|
3843
3853
|
}
|
|
3844
|
-
async function
|
|
3854
|
+
async function gitUnstagedModifiedFiles(cwd = process.cwd()) {
|
|
3845
3855
|
const { stdout } = await spawn.spawn('git', ['diff', '--name-only'], {
|
|
3846
3856
|
cwd
|
|
3847
3857
|
})
|
|
@@ -3892,6 +3902,7 @@ async function doesPullRequestExistForBranch(owner, repo, branch) {
|
|
|
3892
3902
|
head: `${owner}:${branch}`,
|
|
3893
3903
|
state: 'open'
|
|
3894
3904
|
})
|
|
3905
|
+
debug.debugLog('doesPullRequestExistForBranch > prs', prs)
|
|
3895
3906
|
return prs.length > 0
|
|
3896
3907
|
} catch {}
|
|
3897
3908
|
return false
|
|
@@ -4471,6 +4482,7 @@ async function pnpmFix(
|
|
|
4471
4482
|
pkgEnvDetails.editablePkgJson.filename,
|
|
4472
4483
|
...workspacePkgJsonPaths
|
|
4473
4484
|
]
|
|
4485
|
+
debug.debugLog('workspacePkgJsonPaths', workspacePkgJsonPaths)
|
|
4474
4486
|
let actualTree = initialTree
|
|
4475
4487
|
for (const { 0: name, 1: infos } of infoByPkg) {
|
|
4476
4488
|
if (registry.getManifestData(NPM$c, name)) {
|
|
@@ -4525,6 +4537,7 @@ async function pnpmFix(
|
|
|
4525
4537
|
}
|
|
4526
4538
|
continue
|
|
4527
4539
|
}
|
|
4540
|
+
debug.debugLog('pkgJsonPaths', pkgJsonPaths)
|
|
4528
4541
|
for (const pkgJsonPath of pkgJsonPaths) {
|
|
4529
4542
|
const isWorkspaceRoot =
|
|
4530
4543
|
pkgJsonPath === pkgEnvDetails.editablePkgJson.filename
|
|
@@ -4663,13 +4676,16 @@ async function pnpmFix(
|
|
|
4663
4676
|
error = e
|
|
4664
4677
|
errored = true
|
|
4665
4678
|
}
|
|
4679
|
+
debug.debugLog('check "errored":', errored)
|
|
4666
4680
|
if (!errored && shouldOpenPr) {
|
|
4681
|
+
debug.debugLog('1: gitCreateAndPushBranchIfNeeded')
|
|
4667
4682
|
// eslint-disable-next-line no-await-in-loop
|
|
4668
4683
|
await gitCreateAndPushBranchIfNeeded(
|
|
4669
4684
|
branch,
|
|
4670
4685
|
getSocketCommitMessage(oldPurl, newVersion, workspaceName),
|
|
4671
4686
|
cwd
|
|
4672
4687
|
)
|
|
4688
|
+
debug.debugLog('2: openGitHubPullRequest')
|
|
4673
4689
|
// eslint-disable-next-line no-await-in-loop
|
|
4674
4690
|
const prResponse = await openGitHubPullRequest(
|
|
4675
4691
|
owner,
|
|
@@ -10275,6 +10291,12 @@ const config$8 = {
|
|
|
10275
10291
|
description:
|
|
10276
10292
|
'Set the default branch of the repository to the branch of this full-scan. Should only need to be done once, for example for the "main" or "master" branch.'
|
|
10277
10293
|
},
|
|
10294
|
+
interactive: {
|
|
10295
|
+
type: 'boolean',
|
|
10296
|
+
default: true,
|
|
10297
|
+
description:
|
|
10298
|
+
'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.'
|
|
10299
|
+
},
|
|
10278
10300
|
pendingHead: {
|
|
10279
10301
|
type: 'boolean',
|
|
10280
10302
|
default: true,
|
|
@@ -10371,6 +10393,7 @@ async function run$8(argv, importMeta, { parentName }) {
|
|
|
10371
10393
|
cwd: cwdOverride,
|
|
10372
10394
|
defaultBranch,
|
|
10373
10395
|
dryRun,
|
|
10396
|
+
interactive = true,
|
|
10374
10397
|
json,
|
|
10375
10398
|
markdown,
|
|
10376
10399
|
pendingHead,
|
|
@@ -10396,7 +10419,7 @@ async function run$8(argv, importMeta, { parentName }) {
|
|
|
10396
10419
|
// If we updated any inputs then we should print the command line to repeat
|
|
10397
10420
|
// the command without requiring user input, as a suggestion.
|
|
10398
10421
|
let updatedInput = false
|
|
10399
|
-
if (!targets.length && !dryRun) {
|
|
10422
|
+
if (!targets.length && !dryRun && interactive) {
|
|
10400
10423
|
const received = await suggestTarget()
|
|
10401
10424
|
targets = received ?? []
|
|
10402
10425
|
updatedInput = true
|
|
@@ -10405,7 +10428,7 @@ async function run$8(argv, importMeta, { parentName }) {
|
|
|
10405
10428
|
// If the current cwd is unknown and is used as a repo slug anyways, we will
|
|
10406
10429
|
// first need to register the slug before we can use it.
|
|
10407
10430
|
// Only do suggestions with an apiToken and when not in dryRun mode
|
|
10408
|
-
if (apiToken && !dryRun) {
|
|
10431
|
+
if (apiToken && !dryRun && interactive) {
|
|
10409
10432
|
if (!orgSlug) {
|
|
10410
10433
|
const suggestion = await suggestOrgSlug()
|
|
10411
10434
|
if (suggestion) {
|
|
@@ -10493,6 +10516,7 @@ async function run$8(argv, importMeta, { parentName }) {
|
|
|
10493
10516
|
committers: (committers && String(committers)) || '',
|
|
10494
10517
|
cwd,
|
|
10495
10518
|
defaultBranch: Boolean(defaultBranch),
|
|
10519
|
+
interactive: Boolean(interactive),
|
|
10496
10520
|
orgSlug,
|
|
10497
10521
|
outputKind: json ? 'json' : markdown ? 'markdown' : 'text',
|
|
10498
10522
|
pendingHead: Boolean(pendingHead),
|
|
@@ -12279,7 +12303,7 @@ void (async () => {
|
|
|
12279
12303
|
await vendor.updater({
|
|
12280
12304
|
name: SOCKET_CLI_BIN_NAME,
|
|
12281
12305
|
// The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
|
|
12282
|
-
version: '0.14.
|
|
12306
|
+
version: '0.14.109',
|
|
12283
12307
|
ttl: 86_400_000 /* 24 hours in milliseconds */
|
|
12284
12308
|
})
|
|
12285
12309
|
try {
|
|
@@ -12347,5 +12371,5 @@ void (async () => {
|
|
|
12347
12371
|
await shadowNpmInject.captureException(e)
|
|
12348
12372
|
}
|
|
12349
12373
|
})()
|
|
12350
|
-
//# debugId=
|
|
12374
|
+
//# debugId=62f31375-8969-41e7-8ffb-e58b9e021b38
|
|
12351
12375
|
//# sourceMappingURL=cli.js.map
|