File tree Expand file tree Collapse file tree
packages/cli/src/commands Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { handleConfigAuto } from './handle-config-auto.mts'
22import { FLAG_JSON , FLAG_MARKDOWN } from '../../constants/cli.mts'
3- import { HOME } from '../../env/home.mts'
43import { outputDryRunWrite } from '../../utils/dry-run/output.mts'
54import { defineFlags } from '../../meow.mts'
65import { commonFlags , outputFlags } from '../../flags.mts'
@@ -102,7 +101,8 @@ ${getSupportedConfigEntries()
102101 }
103102
104103 if ( dryRun ) {
105- const configPath = `${ HOME } /.config/socket/config.json`
104+ // Runtime read so tests that mutate process.env['HOME'] pick up changes.
105+ const configPath = `${ process . env [ 'HOME' ] } /.config/socket/config.json`
106106 outputDryRunWrite (
107107 configPath ,
108108 `auto-discover and set config value for "${ key } "` ,
Original file line number Diff line number Diff line change 11import { FLAG_JSON , FLAG_MARKDOWN } from '../../constants/cli.mjs'
2- import { HOME } from '../../env/home.mts'
32import { outputDryRunWrite } from '../../utils/dry-run/output.mts'
43import { commonFlags , outputFlags } from '../../flags.mts'
54import { meowOrExit } from '../../utils/cli/with-subcommands.mjs'
@@ -131,7 +130,8 @@ ${spec.helpExamples.map(ex => ` $ ${command} ${ex}`).join('\n')}
131130 }
132131
133132 if ( dryRun ) {
134- const configPath = `${ HOME } /.config/socket/config.json`
133+ // Runtime read so tests that mutate process.env['HOME'] pick up changes.
134+ const configPath = `${ process . env [ 'HOME' ] } /.config/socket/config.json`
135135 const changes = spec . needsValue
136136 ? [ `Set "${ key } " to: ${ value } ` ]
137137 : [ `Remove "${ key } " from config` ]
Original file line number Diff line number Diff line change 11import { handleInstallCompletion } from './handle-install-completion.mts'
2- import { HOME } from '../../env/home.mts'
32import { outputDryRunWrite } from '../../utils/dry-run/output.mts'
43import { defineFlags } from '../../meow.mts'
54import { commonFlags } from '../../flags.mts'
@@ -68,7 +67,8 @@ async function run(
6867 const targetName = cli . input [ 0 ] || 'socket'
6968
7069 if ( dryRun ) {
71- const bashRcPath = `${ HOME } /.bashrc`
70+ // Runtime read so tests that mutate process.env['HOME'] pick up changes.
71+ const bashRcPath = `${ process . env [ 'HOME' ] } /.bashrc`
7272 outputDryRunWrite (
7373 bashRcPath ,
7474 `install bash completion for "${ targetName } "` ,
Original file line number Diff line number Diff line change 11import isInteractive from '@socketregistry/is-interactive/index.cjs'
22
33import { attemptLogin } from './attempt-login.mts'
4- import { HOME } from '../../env/home.mts'
54import { outputDryRunWrite } from '../../utils/dry-run/output.mts'
65import { defineFlags } from '../../meow.mts'
76import { commonFlags } from '../../flags.mts'
@@ -83,7 +82,8 @@ async function run(
8382 const dryRun = ! ! cli . flags [ 'dryRun' ]
8483
8584 if ( dryRun ) {
86- const configPath = `${ HOME } /.config/socket/config.json`
85+ // Runtime read so tests that mutate process.env['HOME'] pick up changes.
86+ const configPath = `${ process . env [ 'HOME' ] } /.config/socket/config.json`
8787 const changes = [
8888 'Prompt for Socket API token' ,
8989 'Verify token with Socket API' ,
Original file line number Diff line number Diff line change 11import { getDefaultLogger } from '@socketsecurity/lib/logger'
22
3- import { HOME } from '../../env/home.mts'
43import { outputDryRunDelete } from '../../utils/dry-run/output.mts'
54import {
65 CONFIG_KEY_API_BASE_URL ,
@@ -85,7 +84,8 @@ export async function run(
8584 const dryRun = ! ! cli . flags [ 'dryRun' ]
8685
8786 if ( dryRun ) {
88- const configPath = `${ HOME } /.config/socket/config.json`
87+ // Runtime read so tests that mutate process.env['HOME'] pick up changes.
88+ const configPath = `${ process . env [ 'HOME' ] } /.config/socket/config.json`
8989 outputDryRunDelete ( 'Socket API credentials' , configPath )
9090 return
9191 }
You can’t perform that action at this time.
0 commit comments