Skip to content

Commit 42c6484

Browse files
committed
fix: create config file with empty object
1 parent adb744a commit 42c6484

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/utils.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ export function getConfigFilePath() {
1212

1313
const configPath = path.join(configDir, 'config.json')
1414

15-
fs.ensureFileSync(configPath)
15+
if (!fs.existsSync(configDir)) {
16+
fs.ensureFileSync(configPath)
17+
fs.writeFileSync(configPath, JSON.stringify({}))
18+
}
1619

1720
return configPath
1821
}
@@ -30,9 +33,8 @@ export function setAccessTokenConfig(token: string) {
3033

3134
export function safeStdinRead() {
3235
let result
33-
const STDIN_FD = 0
3436
try {
35-
result = fs.readFileSync(STDIN_FD).toString()
37+
result = fs.readFileSync(process.stdin.fd).toString()
3638
} catch {}
3739
return result
3840
}

0 commit comments

Comments
 (0)