Skip to content

Commit 1673b4d

Browse files
committed
fix: restore v1.x environment variable fallbacks and EEXIST handling
1. **Environment variable fallbacks** (CLI): - SOCKET_CLI_GIT_USER_NAME: Add SOCKET_CLI_GIT_USERNAME fallback, default to 'github-actions[bot]' - SOCKET_CLI_GIT_USER_EMAIL: Default to 'github-actions[bot]@users.noreply.github.com' 2. **EEXIST error handling**: - Wrap mkdirSync calls in try-catch to ignore EEXIST errors - Prevents failures when settings directory already exists These changes restore backward compatibility with v1.x environment variable names and fix race conditions with directory creation.
1 parent fe808f8 commit 1673b4d

File tree

22 files changed

+270
-213
lines changed

22 files changed

+270
-213
lines changed

packages/bootstrap/.config/esbuild.smol.config.mjs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url))
1818
const rootPath = path.resolve(__dirname, '..')
1919

2020
const config = {
21-
banner: {
22-
js: '#!/usr/bin/env node',
23-
},
2421
bundle: true,
2522
define: {
2623
__MIN_NODE_VERSION__: JSON.stringify(nodeVersionConfig.versionSemver),

packages/bootstrap/dist/bootstrap-npm.js

Lines changed: 83 additions & 74 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/bootstrap/dist/bootstrap-smol.js

Lines changed: 83 additions & 75 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/cli/.config/esbuild.cli.build.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ const config = {
174174
// (but doesn't hurt as extra safety).
175175
external: [
176176
'node-gyp', // Required for require.resolve('node-gyp/package.json')
177+
'@socketsecurity/registry', // Optional registry package (dev dependency only)
177178
],
178179

179180
// Suppress warnings for intentional CommonJS compatibility code.

packages/cli/.config/esbuild.inject.config.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
* when spawning npm with shadow arborist.
66
*/
77

8-
import { writeFileSync } from 'node:fs'
98
import path from 'node:path'
109
import { fileURLToPath } from 'node:url'
1110

packages/cli/scripts/build.mjs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ async function main() {
8787

8888
if (extractResult.code !== 0) {
8989
process.exitCode = extractResult.code
90-
throw new Error(`WASM extraction failed with exit code ${extractResult.code}`)
90+
throw new Error(
91+
`WASM extraction failed with exit code ${extractResult.code}`,
92+
)
9193
}
9294

9395
// Then start esbuild in watch mode.
@@ -135,11 +137,15 @@ async function main() {
135137
const shouldClean = force
136138

137139
const steps = [
138-
...(shouldClean ? [{
139-
name: 'Clean Dist',
140-
command: 'pnpm',
141-
args: ['run', 'clean:dist'],
142-
}] : []),
140+
...(shouldClean
141+
? [
142+
{
143+
name: 'Clean Dist',
144+
command: 'pnpm',
145+
args: ['run', 'clean:dist'],
146+
},
147+
]
148+
: []),
143149
// {
144150
// name: 'Extract MiniLM Model',
145151
// command: 'node',

packages/cli/src/cli-entry.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ import {
4343
InputError,
4444
} from './utils/error/errors.mts'
4545
import { failMsgWithBadge } from './utils/error/fail-msg-with-badge.mts'
46-
import { isSeaBinary } from './utils/sea/detect.mts'
4746
import { serializeResultJson } from './utils/output/result-json.mts'
4847
import { runPreflightDownloads } from './utils/preflight/downloads.mts'
48+
import { isSeaBinary } from './utils/sea/detect.mts'
4949
import { scheduleUpdateCheck } from './utils/update/manager.mts'
5050

5151
const __filename = fileURLToPath(import.meta.url)

packages/cli/src/commands/self-update/handle-self-update.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { outputSelfUpdate } from './output-self-update.mts'
1919
import ENV from '../../constants/env.mts'
2020
import { commonFlags } from '../../flags.mts'
2121
import { meowOrExit } from '../../utils/cli/with-subcommands.mjs'
22-
import { canSelfUpdate, isSeaBinary } from '../../utils/sea/detect.mjs'
2322
import {
2423
clearQuarantine,
2524
ensureExecutable,
@@ -32,6 +31,7 @@ import {
3231
fetchPackageMetadata,
3332
verifyTarballIntegrity,
3433
} from '../../utils/registry/npm-registry.mts'
34+
import { canSelfUpdate, isSeaBinary } from '../../utils/sea/detect.mjs'
3535

3636
import type { CliCommandConfig } from '../../utils/cli/with-subcommands.mjs'
3737

packages/cli/src/constants/paths.mts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ import { SOCKET_JSON } from './socket.mts'
2626
export { SOCKET_JSON }
2727

2828
// Re-export node-related constants from registry for convenience.
29-
export {
30-
getExecPath,
31-
getNodeHardenFlags,
32-
getNodeNoWarningsFlags,
33-
}
29+
export { getExecPath, getNodeHardenFlags, getNodeNoWarningsFlags }
3430

3531
// Export as non-function constants for backward compatibility.
3632
export const execPath = getExecPath()
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
/**
22
* SOCKET_CLI_GIT_USER_EMAIL environment variable snapshot.
33
* Overrides git user email for Socket CLI operations.
4+
* Falls back to 'github-actions[bot]@users.noreply.github.com' if not set.
45
*/
56

67
import { env } from 'node:process'
78

8-
export const SOCKET_CLI_GIT_USER_EMAIL = env['SOCKET_CLI_GIT_USER_EMAIL']
9+
export const SOCKET_CLI_GIT_USER_EMAIL =
10+
env['SOCKET_CLI_GIT_USER_EMAIL'] ||
11+
'github-actions[bot]@users.noreply.github.com'

0 commit comments

Comments
 (0)