Skip to content

Commit 886103e

Browse files
authored
Merge branch 'main' into barslev/debug-publish-errors
2 parents 7f95ee4 + 44958dc commit 886103e

124 files changed

Lines changed: 3569 additions & 621 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.config/rollup.dist.config.mjs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,24 @@ const {
4040
ROLLUP_EXTERNAL_SUFFIX,
4141
SHADOW_NPM_BIN,
4242
SHADOW_NPM_INJECT,
43+
SHADOW_PNPM_BIN,
44+
SHADOW_YARN_BIN,
4345
SLASH_NODE_MODULES_SLASH,
4446
SOCKET_CLI_BIN_NAME,
4547
SOCKET_CLI_BIN_NAME_ALIAS,
4648
SOCKET_CLI_LEGACY_PACKAGE_NAME,
4749
SOCKET_CLI_NPM_BIN_NAME,
4850
SOCKET_CLI_NPX_BIN_NAME,
4951
SOCKET_CLI_PACKAGE_NAME,
52+
SOCKET_CLI_PNPM_BIN_NAME,
5053
SOCKET_CLI_SENTRY_BIN_NAME,
5154
SOCKET_CLI_SENTRY_BIN_NAME_ALIAS,
5255
SOCKET_CLI_SENTRY_NPM_BIN_NAME,
5356
SOCKET_CLI_SENTRY_NPX_BIN_NAME,
5457
SOCKET_CLI_SENTRY_PACKAGE_NAME,
58+
SOCKET_CLI_SENTRY_PNPM_BIN_NAME,
59+
SOCKET_CLI_SENTRY_YARN_BIN_NAME,
60+
SOCKET_CLI_YARN_BIN_NAME,
5561
} = constants
5662

5763
const BLESSED = 'blessed'
@@ -222,6 +228,8 @@ async function updatePackageJson() {
222228
[SOCKET_CLI_SENTRY_BIN_NAME]: bin[SOCKET_CLI_BIN_NAME],
223229
[SOCKET_CLI_SENTRY_NPM_BIN_NAME]: bin[SOCKET_CLI_NPM_BIN_NAME],
224230
[SOCKET_CLI_SENTRY_NPX_BIN_NAME]: bin[SOCKET_CLI_NPX_BIN_NAME],
231+
[SOCKET_CLI_SENTRY_PNPM_BIN_NAME]: bin[SOCKET_CLI_PNPM_BIN_NAME],
232+
[SOCKET_CLI_SENTRY_YARN_BIN_NAME]: bin[SOCKET_CLI_YARN_BIN_NAME],
225233
},
226234
dependencies: {
227235
...dependencies,
@@ -294,6 +302,10 @@ function resetBin(bin) {
294302
bin?.[SOCKET_CLI_NPM_BIN_NAME] ?? bin?.[SOCKET_CLI_SENTRY_NPM_BIN_NAME],
295303
[SOCKET_CLI_NPX_BIN_NAME]:
296304
bin?.[SOCKET_CLI_NPX_BIN_NAME] ?? bin?.[SOCKET_CLI_SENTRY_NPX_BIN_NAME],
305+
[SOCKET_CLI_PNPM_BIN_NAME]:
306+
bin?.[SOCKET_CLI_PNPM_BIN_NAME] ?? bin?.[SOCKET_CLI_SENTRY_PNPM_BIN_NAME],
307+
[SOCKET_CLI_YARN_BIN_NAME]:
308+
bin?.[SOCKET_CLI_YARN_BIN_NAME] ?? bin?.[SOCKET_CLI_SENTRY_YARN_BIN_NAME],
297309
}
298310
const newBin = {
299311
...(tmpBin[SOCKET_CLI_BIN_NAME]
@@ -305,12 +317,20 @@ function resetBin(bin) {
305317
...(tmpBin[SOCKET_CLI_NPX_BIN_NAME]
306318
? { [SOCKET_CLI_NPX_BIN_NAME]: tmpBin[SOCKET_CLI_NPX_BIN_NAME] }
307319
: {}),
320+
...(tmpBin[SOCKET_CLI_PNPM_BIN_NAME]
321+
? { [SOCKET_CLI_PNPM_BIN_NAME]: tmpBin[SOCKET_CLI_PNPM_BIN_NAME] }
322+
: {}),
323+
...(tmpBin[SOCKET_CLI_YARN_BIN_NAME]
324+
? { [SOCKET_CLI_YARN_BIN_NAME]: tmpBin[SOCKET_CLI_YARN_BIN_NAME] }
325+
: {}),
308326
}
309327
assert(
310328
util.isDeepStrictEqual(Object.keys(newBin).sort(naturalCompare), [
311329
SOCKET_CLI_BIN_NAME,
312330
SOCKET_CLI_NPM_BIN_NAME,
313331
SOCKET_CLI_NPX_BIN_NAME,
332+
SOCKET_CLI_PNPM_BIN_NAME,
333+
SOCKET_CLI_YARN_BIN_NAME,
314334
]),
315335
"Update the rollup Legacy and Sentry build's .bin to match the default build.",
316336
)
@@ -337,16 +357,28 @@ export default async () => {
337357
const shadowNpmInjectSrcPath = normalizePath(
338358
path.join(srcPath, 'shadow/npm/inject.mts'),
339359
)
360+
const shadowPnpmBinSrcPath = normalizePath(
361+
path.join(srcPath, 'shadow/pnpm/bin.mts'),
362+
)
363+
const shadowYarnBinSrcPath = normalizePath(
364+
path.join(srcPath, 'shadow/yarn/bin.mts'),
365+
)
340366
const utilsSrcPath = normalizePath(path.join(srcPath, UTILS))
341367

342368
return [
343369
// Bundle <root>/src/ entry point files and output to <root>/dist/.
344370
baseConfig({
345371
input: {
346372
cli: `${srcPath}/cli.mts`,
373+
'npm-cli': `${srcPath}/npm-cli.mts`,
374+
'npx-cli': `${srcPath}/npx-cli.mts`,
375+
'pnpm-cli': `${srcPath}/pnpm-cli.mts`,
376+
'yarn-cli': `${srcPath}/yarn-cli.mts`,
347377
[CONSTANTS]: `${srcPath}/constants.mts`,
348378
[SHADOW_NPM_BIN]: `${srcPath}/shadow/npm/bin.mts`,
349379
[SHADOW_NPM_INJECT]: `${srcPath}/shadow/npm/inject.mts`,
380+
[SHADOW_PNPM_BIN]: `${srcPath}/shadow/pnpm/bin.mts`,
381+
[SHADOW_YARN_BIN]: `${srcPath}/shadow/yarn/bin.mts`,
350382
...(constants.ENV[INLINED_SOCKET_CLI_SENTRY_BUILD]
351383
? {
352384
[INSTRUMENT_WITH_SENTRY]: `${srcPath}/${INSTRUMENT_WITH_SENTRY}.mts`,
@@ -372,6 +404,10 @@ export default async () => {
372404
return SHADOW_NPM_BIN
373405
case shadowNpmInjectSrcPath:
374406
return SHADOW_NPM_INJECT
407+
case shadowPnpmBinSrcPath:
408+
return SHADOW_PNPM_BIN
409+
case shadowYarnBinSrcPath:
410+
return SHADOW_YARN_BIN
375411
default:
376412
if (id.startsWith(`${utilsSrcPath}/`)) {
377413
return UTILS

.github/actions/setup/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ runs:
1616
node-version: ${{ inputs.node-version }}
1717

1818
- name: Setup PNPM
19-
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
19+
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
2020
with:
2121
version: '^10.16.0'
2222

2323
- name: Install dependencies
2424
shell: bash
25-
run: pnpm install
25+
run: pnpm install

.github/workflows/provenance.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121

2222
steps:
2323
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
24-
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
24+
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
2525
with:
2626
version: 10
2727
run_install: false

CLAUDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,11 @@ Socket CLI integrates with various third-party tools and services:
213213
-`process.exit(1)` (bypasses error handling framework)
214214

215215
### 🗑️ Safe File Operations (SECURITY CRITICAL)
216-
- **File deletion**: 🚨 ABSOLUTELY FORBIDDEN - NEVER use `rm -rf`. 🚨 MANDATORY - ALWAYS use `npx trash-cli`
216+
- **File deletion**: 🚨 ABSOLUTELY FORBIDDEN - NEVER use `rm -rf`. 🚨 MANDATORY - ALWAYS use `pnpm dlx trash-cli`
217217
- **Examples**:
218218
- ❌ CATASTROPHIC: `rm -rf directory` (permanent deletion - DATA LOSS RISK)
219219
- ❌ REPOSITORY DESTROYER: `rm -rf "$(pwd)"` (deletes entire repository)
220-
- ✅ SAFE: `npx trash-cli directory` (recoverable deletion)
220+
- ✅ SAFE: `pnpm dlx trash-cli directory` (recoverable deletion)
221221
- **Why this matters**: trash-cli enables recovery from accidental deletions via system trash/recycle bin
222222

223223
### Formatting

bin/cli.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env node
22
'use strict'
3-
;(async () => {
3+
4+
void (async () => {
45
const Module = require('node:module')
56
const path = require('node:path')
67
const rootPath = path.join(__dirname, '..')

bin/npm-cli.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env node
22
'use strict'
3-
;(async () => {
3+
4+
void (async () => {
45
const Module = require('node:module')
56
const path = require('node:path')
67
const rootPath = path.join(__dirname, '..')

bin/npx-cli.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env node
22
'use strict'
3-
;(async () => {
3+
4+
void (async () => {
45
const Module = require('node:module')
56
const path = require('node:path')
67
const rootPath = path.join(__dirname, '..')

bin/pnpm-cli.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env node
2+
'use strict'
3+
4+
void (async () => {
5+
const Module = require('node:module')
6+
const path = require('node:path')
7+
const rootPath = path.join(__dirname, '..')
8+
Module.enableCompileCache?.(path.join(rootPath, '.cache'))
9+
10+
const shadowBin = require(path.join(rootPath, 'dist/shadow-pnpm-bin.js'))
11+
12+
process.exitCode = 1
13+
14+
const { spawnPromise } = await shadowBin('pnpm', process.argv.slice(2), {
15+
stdio: 'inherit',
16+
})
17+
18+
// See https://nodejs.org/api/child_process.html#event-exit.
19+
spawnPromise.process.on('exit', (code, signalName) => {
20+
if (signalName) {
21+
process.kill(process.pid, signalName)
22+
} else if (typeof code === 'number') {
23+
// eslint-disable-next-line n/no-process-exit
24+
process.exit(code)
25+
}
26+
})
27+
28+
await spawnPromise
29+
})()

bin/yarn-cli.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env node
2+
'use strict'
3+
4+
void (async () => {
5+
const Module = require('node:module')
6+
const path = require('node:path')
7+
const rootPath = path.join(__dirname, '..')
8+
Module.enableCompileCache?.(path.join(rootPath, '.cache'))
9+
10+
const shadowBin = require(path.join(rootPath, 'dist/shadow-yarn-bin.js'))
11+
12+
process.exitCode = 1
13+
14+
const { spawnPromise } = await shadowBin('yarn', process.argv.slice(2), {
15+
stdio: 'inherit',
16+
})
17+
18+
// See https://nodejs.org/api/child_process.html#event-exit.
19+
spawnPromise.process.on('exit', (code, signalName) => {
20+
if (signalName) {
21+
process.kill(process.pid, signalName)
22+
} else if (typeof code === 'number') {
23+
// eslint-disable-next-line n/no-process-exit
24+
process.exit(code)
25+
}
26+
})
27+
28+
await spawnPromise
29+
})()

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,17 @@
1616
"bin": {
1717
"socket": "bin/cli.js",
1818
"socket-npm": "bin/npm-cli.js",
19-
"socket-npx": "bin/npx-cli.js"
19+
"socket-npx": "bin/npx-cli.js",
20+
"socket-pnpm": "bin/pnpm-cli.js",
21+
"socket-yarn": "bin/yarn-cli.js"
2022
},
2123
"types": "./dist/types/src/cli.d.ts",
2224
"exports": {
2325
"./bin/cli.js": "./dist/cli.js",
2426
"./bin/npm-cli.js": "./dist/npm-cli.js",
2527
"./bin/npx-cli.js": "./dist/npx-cli.js",
28+
"./bin/pnpm-cli.js": "./dist/pnpm-cli.js",
29+
"./bin/yarn-cli.js": "./dist/yarn-cli.js",
2630
"./package.json": "./package.json",
2731
"./requirements.json": "./requirements.json",
2832
"./translations.json": "./translations.json"
@@ -229,9 +233,9 @@
229233
"blessed-contrib@4.11.0": "patches/blessed-contrib@4.11.0.patch",
230234
"brace-expansion@2.0.2": "patches/brace-expansion@2.0.2.patch",
231235
"bresenham@0.0.3": "patches/bresenham@0.0.3.patch",
232-
"tiny-updater@3.5.3": "patches/tiny-updater@3.5.3.patch",
233236
"lodash@4.17.21": "patches/lodash@4.17.21.patch",
234-
"rollup@4.50.1": "patches/rollup@4.50.1.patch"
237+
"rollup@4.50.1": "patches/rollup@4.50.1.patch",
238+
"tiny-updater@3.5.3": "patches/tiny-updater@3.5.3.patch"
235239
}
236240
},
237241
"engines": {

0 commit comments

Comments
 (0)