Skip to content

Commit 90d1190

Browse files
committed
fix(cli): run the bundled command entry
1 parent 8392358 commit 90d1190

2 files changed

Lines changed: 18 additions & 7 deletions

File tree

‎src/cli-dispatch.mts‎

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
11
import { getInvocationMode } from './util/cli/invocation-mode.mts'
2+
import { errorMessage } from '@socketsecurity/lib-stable/errors/message'
3+
import { getDefaultLogger } from '@socketsecurity/lib-stable/logger/default'
24
import { isMainModule } from '../scripts/fleet/process/is-main-module.mts'
35
import { runMain } from '../scripts/fleet/process/run-main.mts'
46

57
import type { ScriptMeta } from '../scripts/fleet/process/run-main.mts'
68

9+
const logger = getDefaultLogger()
10+
11+
const SCRIPT_META: ScriptMeta = {
12+
describe: 'dispatch a Socket CLI wrapper invocation to its command mode',
13+
help: 'Usage: pnpm run dev [arguments]',
14+
json: 'native',
15+
}
16+
17+
export function runCliProduct(): void {
18+
void main().catch(error => {
19+
logger.error(errorMessage(error))
20+
process.exitCode = 1
21+
})
22+
}
23+
724
// Route to the appropriate CLI based on invocation mode.
825
export async function main(): Promise<void> {
926
const mode = getInvocationMode()
@@ -17,12 +34,6 @@ export async function main(): Promise<void> {
1734
await import('./cli-entry.mjs')
1835
}
1936

20-
const SCRIPT_META: ScriptMeta = {
21-
describe: 'dispatch a Socket CLI wrapper invocation to its command mode',
22-
help: 'Usage: pnpm run dev [arguments]',
23-
json: 'native',
24-
}
25-
2637
if (isMainModule(import.meta.url)) {
2738
runMain(main, SCRIPT_META)
2839
}

‎src/index.mts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ const path = require('node:path')
99

1010
// Load CLI from dist directory
1111
const cliPath = path.join(__dirname, 'cli.js')
12-
require(cliPath)
12+
require(cliPath).runCliProduct()

0 commit comments

Comments
 (0)