@socketsecurity/cli-with-sentry 0.14.123 → 0.14.125
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 +145 -208
- 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 +145 -208
- 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.125:11530dd:4065fadc: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=c1ddbf6d-9662-4963-8b89-6c5e285bcd37
|
|
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":"c1ddbf6d-9662-4963-8b89-6c5e285bcd37"}
|
package/dist/module-sync/cli.js
CHANGED
|
@@ -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.
|
|
920
|
+
const cliVersion = '0.14.125:11530dd:4065fadc: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')
|
|
@@ -3739,7 +3739,7 @@ function getPkgNameFromPurlObj(purlObj) {
|
|
|
3739
3739
|
function getBaseGitBranch() {
|
|
3740
3740
|
// Lazily access constants.ENV[GITHUB_REF_NAME].
|
|
3741
3741
|
return (
|
|
3742
|
-
constants.ENV[GITHUB_REF_NAME]
|
|
3742
|
+
constants.ENV[GITHUB_REF_NAME] ||
|
|
3743
3743
|
// GitHub defaults to branch name "main"
|
|
3744
3744
|
// https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-branches#about-the-default-branch
|
|
3745
3745
|
'main'
|
|
@@ -3858,16 +3858,6 @@ async function gitUnstagedModifiedFiles(cwd = process.cwd()) {
|
|
|
3858
3858
|
const rawFiles = stdout?.trim().split('\n') ?? []
|
|
3859
3859
|
return rawFiles.map(relPath => path.normalizePath(relPath))
|
|
3860
3860
|
}
|
|
3861
|
-
async function isInGitRepo(cwd = process.cwd()) {
|
|
3862
|
-
try {
|
|
3863
|
-
await spawn.spawn('git', ['rev-parse', '--is-inside-work-tree'], {
|
|
3864
|
-
cwd,
|
|
3865
|
-
stdio: 'ignore'
|
|
3866
|
-
})
|
|
3867
|
-
return true
|
|
3868
|
-
} catch {}
|
|
3869
|
-
return false
|
|
3870
|
-
}
|
|
3871
3861
|
|
|
3872
3862
|
const { GITHUB_ACTIONS, GITHUB_REPOSITORY, SOCKET_SECURITY_GITHUB_PAT } =
|
|
3873
3863
|
constants
|
|
@@ -4054,10 +4044,10 @@ async function npmFix(
|
|
|
4054
4044
|
|
|
4055
4045
|
// Lazily access constants.ENV[CI].
|
|
4056
4046
|
const isCi = constants.ENV[CI$1]
|
|
4057
|
-
const
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4047
|
+
const workspacePkgJsonPaths = await shadowNpmInject.globWorkspace(
|
|
4048
|
+
pkgEnvDetails.agent,
|
|
4049
|
+
rootPath
|
|
4050
|
+
)
|
|
4061
4051
|
const pkgJsonPaths = [
|
|
4062
4052
|
...workspacePkgJsonPaths,
|
|
4063
4053
|
// Process the workspace root last since it will add an override to package.json.
|
|
@@ -4075,7 +4065,7 @@ async function npmFix(
|
|
|
4075
4065
|
const oldVersions = arrays.arrayUnique(
|
|
4076
4066
|
shadowNpmInject
|
|
4077
4067
|
.findPackageNodes(arb.idealTree, name)
|
|
4078
|
-
.map(n => n.version)
|
|
4068
|
+
.map(n => n.target?.version ?? n.version)
|
|
4079
4069
|
.filter(Boolean)
|
|
4080
4070
|
)
|
|
4081
4071
|
const packument =
|
|
@@ -4190,7 +4180,6 @@ async function npmFix(
|
|
|
4190
4180
|
)
|
|
4191
4181
|
let error
|
|
4192
4182
|
let errored = false
|
|
4193
|
-
let installed = false
|
|
4194
4183
|
let saved = false
|
|
4195
4184
|
|
|
4196
4185
|
// eslint-disable-next-line no-await-in-loop
|
|
@@ -4206,7 +4195,6 @@ async function npmFix(
|
|
|
4206
4195
|
await install$1(arb.idealTree, {
|
|
4207
4196
|
cwd
|
|
4208
4197
|
})
|
|
4209
|
-
installed = true
|
|
4210
4198
|
if (test) {
|
|
4211
4199
|
if (!testedSpecs.has(newSpecKey)) {
|
|
4212
4200
|
testedSpecs.add(newSpecKey)
|
|
@@ -4272,15 +4260,15 @@ async function npmFix(
|
|
|
4272
4260
|
// eslint-disable-next-line no-await-in-loop
|
|
4273
4261
|
await Promise.all([
|
|
4274
4262
|
shadowNpmInject.removeNodeModules(cwd),
|
|
4275
|
-
...(
|
|
4276
|
-
|
|
4263
|
+
...(isCi
|
|
4264
|
+
? [gitCheckoutBaseBranchIfAvailable(baseBranch, cwd)]
|
|
4265
|
+
: []),
|
|
4266
|
+
...(saved && !isCi ? [editablePkgJson.save()] : [])
|
|
4277
4267
|
])
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
})
|
|
4283
|
-
}
|
|
4268
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4269
|
+
await install$1(revertTree, {
|
|
4270
|
+
cwd
|
|
4271
|
+
})
|
|
4284
4272
|
if (errored) {
|
|
4285
4273
|
if (!failedSpecs.has(newSpecKey)) {
|
|
4286
4274
|
failedSpecs.add(newSpecKey)
|
|
@@ -4480,37 +4468,34 @@ async function pnpmFix(
|
|
|
4480
4468
|
|
|
4481
4469
|
// Lazily access constants.ENV[CI].
|
|
4482
4470
|
const isCi = constants.ENV[CI]
|
|
4483
|
-
const
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4471
|
+
const workspacePkgJsonPaths = await shadowNpmInject.globWorkspace(
|
|
4472
|
+
pkgEnvDetails.agent,
|
|
4473
|
+
rootPath
|
|
4474
|
+
)
|
|
4475
|
+
const baseBranch = isCi ? getBaseGitBranch() : ''
|
|
4476
|
+
const { owner, repo } = isCi
|
|
4477
|
+
? getGitHubEnvRepoInfo()
|
|
4478
|
+
: {
|
|
4479
|
+
owner: '',
|
|
4480
|
+
repo: ''
|
|
4481
|
+
}
|
|
4487
4482
|
const pkgJsonPaths = [
|
|
4488
4483
|
...workspacePkgJsonPaths,
|
|
4489
4484
|
// Process the workspace root last since it will add an override to package.json.
|
|
4490
4485
|
pkgEnvDetails.editablePkgJson.filename
|
|
4491
4486
|
]
|
|
4492
|
-
let actualTree
|
|
4487
|
+
let actualTree = await getActualTree(cwd)
|
|
4493
4488
|
for (const { 0: name, 1: infos } of infoByPkg) {
|
|
4494
4489
|
if (registry.getManifestData(NPM$c, name)) {
|
|
4495
4490
|
spinner?.info(`Skipping ${name}. Socket Optimize package exists.`)
|
|
4496
4491
|
continue
|
|
4497
4492
|
}
|
|
4498
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4499
|
-
await Promise.all([
|
|
4500
|
-
shadowNpmInject.removeNodeModules(cwd),
|
|
4501
|
-
...(isRepo ? [gitHardReset(cwd)] : [])
|
|
4502
|
-
])
|
|
4503
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4504
|
-
actualTree = await install(pkgEnvDetails, {
|
|
4505
|
-
spinner
|
|
4506
|
-
})
|
|
4507
4493
|
const oldVersions = arrays.arrayUnique(
|
|
4508
4494
|
shadowNpmInject
|
|
4509
4495
|
.findPackageNodes(actualTree, name)
|
|
4510
|
-
.map(n => n.version)
|
|
4496
|
+
.map(n => n.target?.version ?? n.version)
|
|
4511
4497
|
.filter(Boolean)
|
|
4512
4498
|
)
|
|
4513
|
-
debug.debugLog(name, 'oldVersions', oldVersions)
|
|
4514
4499
|
const packument =
|
|
4515
4500
|
oldVersions.length && infos.length
|
|
4516
4501
|
? // eslint-disable-next-line no-await-in-loop
|
|
@@ -4519,41 +4504,43 @@ async function pnpmFix(
|
|
|
4519
4504
|
if (!packument) {
|
|
4520
4505
|
continue
|
|
4521
4506
|
}
|
|
4522
|
-
const failedSpecs = new Set()
|
|
4523
4507
|
const fixedSpecs = new Set()
|
|
4524
|
-
const installedSpecs = new Set()
|
|
4525
|
-
const testedSpecs = new Set()
|
|
4526
|
-
const unavailableSpecs = new Set()
|
|
4527
|
-
const revertedSpecs = new Set()
|
|
4528
4508
|
for (const pkgJsonPath of pkgJsonPaths) {
|
|
4509
|
+
// Re-read actualTree to avoid lockfile state issues
|
|
4510
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4511
|
+
actualTree = await getActualTree(cwd)
|
|
4512
|
+
const pkgPath = path$1.dirname(pkgJsonPath)
|
|
4513
|
+
const isWorkspaceRoot =
|
|
4514
|
+
pkgJsonPath === pkgEnvDetails.editablePkgJson.filename
|
|
4515
|
+
const workspaceName = isWorkspaceRoot
|
|
4516
|
+
? 'root'
|
|
4517
|
+
: path$1.relative(rootPath, pkgPath)
|
|
4518
|
+
const editablePkgJson = isWorkspaceRoot
|
|
4519
|
+
? pkgEnvDetails.editablePkgJson
|
|
4520
|
+
: // eslint-disable-next-line no-await-in-loop
|
|
4521
|
+
await packages.readPackageJson(pkgJsonPath, {
|
|
4522
|
+
editable: true
|
|
4523
|
+
})
|
|
4524
|
+
|
|
4525
|
+
// Get current overrides for revert logic
|
|
4526
|
+
const oldPnpmSection = editablePkgJson.content[PNPM$8]
|
|
4527
|
+
const oldOverrides = oldPnpmSection?.[OVERRIDES$2]
|
|
4529
4528
|
for (const oldVersion of oldVersions) {
|
|
4530
4529
|
const oldSpec = `${name}@${oldVersion}`
|
|
4531
4530
|
const oldPurl = `pkg:npm/${oldSpec}`
|
|
4531
|
+
const node = shadowNpmInject.findPackageNode(
|
|
4532
|
+
actualTree,
|
|
4533
|
+
name,
|
|
4534
|
+
oldVersion
|
|
4535
|
+
)
|
|
4536
|
+
if (!node) {
|
|
4537
|
+
debug.debugLog(`Skipping ${oldSpec}, no node found in ${pkgJsonPath}`)
|
|
4538
|
+
continue
|
|
4539
|
+
}
|
|
4532
4540
|
for (const {
|
|
4533
4541
|
firstPatchedVersionIdentifier,
|
|
4534
4542
|
vulnerableVersionRange
|
|
4535
4543
|
} of infos) {
|
|
4536
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4537
|
-
await Promise.all([
|
|
4538
|
-
shadowNpmInject.removeNodeModules(cwd),
|
|
4539
|
-
...(isRepo ? [gitHardReset(cwd)] : [])
|
|
4540
|
-
])
|
|
4541
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4542
|
-
actualTree = await install(pkgEnvDetails, {
|
|
4543
|
-
spinner
|
|
4544
|
-
})
|
|
4545
|
-
const node = shadowNpmInject.findPackageNode(
|
|
4546
|
-
actualTree,
|
|
4547
|
-
name,
|
|
4548
|
-
oldVersion
|
|
4549
|
-
)
|
|
4550
|
-
if (!node) {
|
|
4551
|
-
debug.debugLog(
|
|
4552
|
-
`Skipping ${oldSpec}, no node found in arborist.actualTree`,
|
|
4553
|
-
pkgJsonPath
|
|
4554
|
-
)
|
|
4555
|
-
continue
|
|
4556
|
-
}
|
|
4557
4544
|
const availableVersions = Object.keys(packument.versions)
|
|
4558
4545
|
const newVersion = shadowNpmInject.findBestPatchVersion(
|
|
4559
4546
|
node,
|
|
@@ -4564,30 +4551,9 @@ async function pnpmFix(
|
|
|
4564
4551
|
? packument.versions[newVersion]
|
|
4565
4552
|
: undefined
|
|
4566
4553
|
if (!(newVersion && newVersionPackument)) {
|
|
4567
|
-
|
|
4568
|
-
unavailableSpecs.add(oldSpec)
|
|
4569
|
-
spinner?.fail(`No update available for ${oldSpec}`)
|
|
4570
|
-
}
|
|
4554
|
+
spinner?.fail(`No update available for ${oldSpec}`)
|
|
4571
4555
|
continue
|
|
4572
4556
|
}
|
|
4573
|
-
const isWorkspaceRoot =
|
|
4574
|
-
pkgJsonPath === pkgEnvDetails.editablePkgJson.filename
|
|
4575
|
-
const workspaceName = isWorkspaceRoot
|
|
4576
|
-
? ''
|
|
4577
|
-
: path$1.relative(rootPath, path$1.dirname(pkgJsonPath))
|
|
4578
|
-
const workspaceDetails = workspaceName ? ` in ${workspaceName}` : ''
|
|
4579
|
-
const editablePkgJson = isWorkspaceRoot
|
|
4580
|
-
? pkgEnvDetails.editablePkgJson
|
|
4581
|
-
: // eslint-disable-next-line no-await-in-loop
|
|
4582
|
-
await packages.readPackageJson(pkgJsonPath, {
|
|
4583
|
-
editable: true
|
|
4584
|
-
})
|
|
4585
|
-
const oldPnpm = editablePkgJson.content[PNPM$8]
|
|
4586
|
-
const oldPnpmKeyCount = oldPnpm ? Object.keys(oldPnpm).length : 0
|
|
4587
|
-
const oldOverrides = oldPnpm?.[OVERRIDES$2]
|
|
4588
|
-
const oldOverridesCount = oldOverrides
|
|
4589
|
-
? Object.keys(oldOverrides).length
|
|
4590
|
-
: 0
|
|
4591
4557
|
const overrideKey = `${name}@${vulnerableVersionRange}`
|
|
4592
4558
|
const newVersionRange = shadowNpmInject.applyRange(
|
|
4593
4559
|
oldOverrides?.[overrideKey] ?? oldVersion,
|
|
@@ -4595,14 +4561,20 @@ async function pnpmFix(
|
|
|
4595
4561
|
rangeStyle
|
|
4596
4562
|
)
|
|
4597
4563
|
const newSpec = `${name}@${newVersionRange}`
|
|
4598
|
-
const newSpecKey = `${workspaceName
|
|
4564
|
+
const newSpecKey = `${workspaceName}:${newSpec}`
|
|
4565
|
+
if (fixedSpecs.has(newSpecKey)) {
|
|
4566
|
+
debug.debugLog(
|
|
4567
|
+
`Already fixed ${newSpec} in ${workspaceName}, skipping`
|
|
4568
|
+
)
|
|
4569
|
+
continue
|
|
4570
|
+
}
|
|
4599
4571
|
const updateData = isWorkspaceRoot
|
|
4600
4572
|
? {
|
|
4601
4573
|
[PNPM$8]: {
|
|
4602
|
-
...
|
|
4574
|
+
...oldPnpmSection,
|
|
4603
4575
|
[OVERRIDES$2]: {
|
|
4604
|
-
|
|
4605
|
-
|
|
4576
|
+
...oldOverrides,
|
|
4577
|
+
[overrideKey]: newVersionRange
|
|
4606
4578
|
}
|
|
4607
4579
|
}
|
|
4608
4580
|
}
|
|
@@ -4610,54 +4582,27 @@ async function pnpmFix(
|
|
|
4610
4582
|
const revertData = {
|
|
4611
4583
|
...(isWorkspaceRoot
|
|
4612
4584
|
? {
|
|
4613
|
-
[PNPM$8]:
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
:
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
}
|
|
4624
|
-
: undefined
|
|
4585
|
+
[PNPM$8]: {
|
|
4586
|
+
...oldPnpmSection,
|
|
4587
|
+
[OVERRIDES$2]:
|
|
4588
|
+
oldOverrides && Object.keys(oldOverrides).length > 1
|
|
4589
|
+
? {
|
|
4590
|
+
...oldOverrides,
|
|
4591
|
+
[overrideKey]: undefined
|
|
4592
|
+
}
|
|
4593
|
+
: undefined
|
|
4594
|
+
}
|
|
4625
4595
|
}
|
|
4626
4596
|
: {}),
|
|
4627
|
-
...(editablePkgJson.content.dependencies
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
:
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
}
|
|
4637
|
-
: undefined),
|
|
4638
|
-
...(editablePkgJson.content.peerDependencies
|
|
4639
|
-
? {
|
|
4640
|
-
peerDependencies: editablePkgJson.content.peerDependencies
|
|
4641
|
-
}
|
|
4642
|
-
: undefined)
|
|
4643
|
-
}
|
|
4644
|
-
const branch = isCi
|
|
4645
|
-
? getSocketBranchName(oldPurl, newVersion, workspaceName)
|
|
4646
|
-
: ''
|
|
4647
|
-
const baseBranch = isCi ? getBaseGitBranch() : ''
|
|
4648
|
-
const { owner, repo } = isCi
|
|
4649
|
-
? getGitHubEnvRepoInfo()
|
|
4650
|
-
: {
|
|
4651
|
-
owner: '',
|
|
4652
|
-
repo: ''
|
|
4653
|
-
}
|
|
4654
|
-
const shouldOpenPr = isCi
|
|
4655
|
-
? // eslint-disable-next-line no-await-in-loop
|
|
4656
|
-
!(await doesPullRequestExistForBranch(owner, repo, branch))
|
|
4657
|
-
: false
|
|
4658
|
-
if (isCi) {
|
|
4659
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4660
|
-
await gitCheckoutBaseBranchIfAvailable(baseBranch, cwd)
|
|
4597
|
+
...(editablePkgJson.content.dependencies && {
|
|
4598
|
+
dependencies: editablePkgJson.content.dependencies
|
|
4599
|
+
}),
|
|
4600
|
+
...(editablePkgJson.content.optionalDependencies && {
|
|
4601
|
+
optionalDependencies: editablePkgJson.content.optionalDependencies
|
|
4602
|
+
}),
|
|
4603
|
+
...(editablePkgJson.content.peerDependencies && {
|
|
4604
|
+
peerDependencies: editablePkgJson.content.peerDependencies
|
|
4605
|
+
})
|
|
4661
4606
|
}
|
|
4662
4607
|
if (updateData) {
|
|
4663
4608
|
editablePkgJson.update(updateData)
|
|
@@ -4670,107 +4615,99 @@ async function pnpmFix(
|
|
|
4670
4615
|
rangeStyle
|
|
4671
4616
|
)
|
|
4672
4617
|
debug.debugLog(`Updated package.json from node: ${modded}`)
|
|
4673
|
-
let error
|
|
4674
|
-
let errored = false
|
|
4675
|
-
let installed = false
|
|
4676
4618
|
|
|
4677
4619
|
// eslint-disable-next-line no-await-in-loop
|
|
4678
4620
|
if (!(await editablePkgJson.save())) {
|
|
4679
4621
|
debug.debugLog(
|
|
4680
|
-
`
|
|
4622
|
+
`No changes saved for ${pkgJsonPath}, skipping install`
|
|
4681
4623
|
)
|
|
4682
4624
|
continue
|
|
4683
4625
|
}
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
}
|
|
4626
|
+
spinner?.info(`Installing ${newSpec} in ${workspaceName}`)
|
|
4627
|
+
let errored = false
|
|
4628
|
+
let error
|
|
4688
4629
|
try {
|
|
4689
4630
|
// eslint-disable-next-line no-await-in-loop
|
|
4690
4631
|
actualTree = await install(pkgEnvDetails, {
|
|
4691
4632
|
spinner
|
|
4692
4633
|
})
|
|
4693
|
-
installed = true
|
|
4694
4634
|
if (test) {
|
|
4695
|
-
|
|
4696
|
-
testedSpecs.add(newSpecKey)
|
|
4697
|
-
spinner?.info(`Testing ${newSpec}${workspaceDetails}`)
|
|
4698
|
-
}
|
|
4635
|
+
spinner?.info(`Testing ${newSpec} in ${workspaceName}`)
|
|
4699
4636
|
// eslint-disable-next-line no-await-in-loop
|
|
4700
4637
|
await npm.runScript(testScript, [], {
|
|
4701
4638
|
spinner,
|
|
4702
4639
|
stdio: 'ignore'
|
|
4703
4640
|
})
|
|
4704
4641
|
}
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
}
|
|
4710
|
-
} catch (e) {
|
|
4711
|
-
error = e
|
|
4712
|
-
errored = true
|
|
4713
|
-
}
|
|
4714
|
-
if (
|
|
4715
|
-
!errored &&
|
|
4716
|
-
shouldOpenPr &&
|
|
4717
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4718
|
-
(await gitCreateAndPushBranchIfNeeded(
|
|
4719
|
-
branch,
|
|
4720
|
-
getSocketCommitMessage(oldPurl, newVersion, workspaceName),
|
|
4721
|
-
cwd
|
|
4722
|
-
))
|
|
4723
|
-
) {
|
|
4724
|
-
// eslint-disable-next-line no-await-in-loop
|
|
4725
|
-
const prResponse = await openGitHubPullRequest(
|
|
4726
|
-
owner,
|
|
4727
|
-
repo,
|
|
4728
|
-
baseBranch,
|
|
4729
|
-
branch,
|
|
4642
|
+
fixedSpecs.add(newSpecKey)
|
|
4643
|
+
spinner?.successAndStop(`Fixed ${name} in ${workspaceName}`)
|
|
4644
|
+
spinner?.start()
|
|
4645
|
+
const branch = getSocketBranchName(
|
|
4730
4646
|
oldPurl,
|
|
4731
4647
|
newVersion,
|
|
4732
|
-
|
|
4733
|
-
cwd,
|
|
4734
|
-
workspaceName
|
|
4735
|
-
}
|
|
4648
|
+
workspaceName
|
|
4736
4649
|
)
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4650
|
+
const shouldOpenPr = isCi
|
|
4651
|
+
? // eslint-disable-next-line no-await-in-loop
|
|
4652
|
+
!(await doesPullRequestExistForBranch(owner, repo, branch))
|
|
4653
|
+
: false
|
|
4654
|
+
if (
|
|
4655
|
+
isCi &&
|
|
4656
|
+
shouldOpenPr &&
|
|
4657
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4658
|
+
(await gitCreateAndPushBranchIfNeeded(
|
|
4659
|
+
branch,
|
|
4660
|
+
getSocketCommitMessage(oldPurl, newVersion, workspaceName),
|
|
4661
|
+
cwd
|
|
4662
|
+
))
|
|
4663
|
+
) {
|
|
4664
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4665
|
+
const prResponse = await openGitHubPullRequest(
|
|
4666
|
+
owner,
|
|
4667
|
+
repo,
|
|
4668
|
+
baseBranch,
|
|
4669
|
+
branch,
|
|
4670
|
+
oldPurl,
|
|
4671
|
+
newVersion,
|
|
4672
|
+
{
|
|
4673
|
+
cwd,
|
|
4674
|
+
workspaceName
|
|
4675
|
+
}
|
|
4676
|
+
)
|
|
4677
|
+
if (prResponse) {
|
|
4678
|
+
const { data } = prResponse
|
|
4679
|
+
spinner?.info(`PR #${data.number} opened.`)
|
|
4680
|
+
if (autoMerge) {
|
|
4681
|
+
// eslint-disable-next-line no-await-in-loop
|
|
4682
|
+
await enableAutoMerge(data)
|
|
4683
|
+
}
|
|
4743
4684
|
}
|
|
4744
4685
|
}
|
|
4686
|
+
} catch (e) {
|
|
4687
|
+
error = e
|
|
4688
|
+
errored = true
|
|
4745
4689
|
}
|
|
4746
4690
|
if (errored || isCi) {
|
|
4747
|
-
if (errored) {
|
|
4748
|
-
if (!revertedSpecs.has(newSpecKey)) {
|
|
4749
|
-
revertedSpecs.add(newSpecKey)
|
|
4750
|
-
spinner?.error(`Reverting ${newSpec}${workspaceDetails}`, error)
|
|
4751
|
-
}
|
|
4752
|
-
}
|
|
4753
4691
|
editablePkgJson.update(revertData)
|
|
4692
|
+
|
|
4754
4693
|
// eslint-disable-next-line no-await-in-loop
|
|
4755
4694
|
await Promise.all([
|
|
4756
4695
|
shadowNpmInject.removeNodeModules(cwd),
|
|
4757
|
-
...(
|
|
4758
|
-
? [
|
|
4759
|
-
:
|
|
4760
|
-
|
|
4761
|
-
: [])
|
|
4696
|
+
...(isCi
|
|
4697
|
+
? [gitCheckoutBaseBranchIfAvailable(baseBranch, cwd)]
|
|
4698
|
+
: []),
|
|
4699
|
+
...(isCi ? [] : [editablePkgJson.save()])
|
|
4762
4700
|
])
|
|
4701
|
+
|
|
4763
4702
|
// eslint-disable-next-line no-await-in-loop
|
|
4764
4703
|
actualTree = await install(pkgEnvDetails, {
|
|
4765
4704
|
spinner
|
|
4766
4705
|
})
|
|
4767
4706
|
if (errored) {
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
)
|
|
4773
|
-
}
|
|
4707
|
+
spinner?.failAndStop(
|
|
4708
|
+
`Update failed for ${oldSpec} in ${workspaceName}`,
|
|
4709
|
+
error
|
|
4710
|
+
)
|
|
4774
4711
|
}
|
|
4775
4712
|
}
|
|
4776
4713
|
}
|
|
@@ -12345,7 +12282,7 @@ void (async () => {
|
|
|
12345
12282
|
await vendor.updater({
|
|
12346
12283
|
name: SOCKET_CLI_BIN_NAME,
|
|
12347
12284
|
// The '@rollup/plugin-replace' will replace "process.env['INLINED_SOCKET_CLI_VERSION']".
|
|
12348
|
-
version: '0.14.
|
|
12285
|
+
version: '0.14.125',
|
|
12349
12286
|
ttl: 86_400_000 /* 24 hours in milliseconds */
|
|
12350
12287
|
})
|
|
12351
12288
|
try {
|
|
@@ -12413,5 +12350,5 @@ void (async () => {
|
|
|
12413
12350
|
await shadowNpmInject.captureException(e)
|
|
12414
12351
|
}
|
|
12415
12352
|
})()
|
|
12416
|
-
//# debugId=
|
|
12353
|
+
//# debugId=67b97c4d-7bde-463e-9396-0773b05c0b3a
|
|
12417
12354
|
//# sourceMappingURL=cli.js.map
|