Skip to content

Commit adb744a

Browse files
committed
fix: ensure config file is present
1 parent d35195f commit adb744a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/utils.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import fs from 'fs'
1+
import fs from 'fs-extra'
22
import {homedir, tmpdir} from 'os'
33
import * as path from 'path'
44

@@ -10,7 +10,11 @@ export function getConfigFilePath() {
1010
configDir = path.join(homedir(), '.hackmd')
1111
}
1212

13-
return path.join(configDir, 'config.json')
13+
const configPath = path.join(configDir, 'config.json')
14+
15+
fs.ensureFileSync(configPath)
16+
17+
return configPath
1418
}
1519

1620
export function setAccessTokenConfig(token: string) {

0 commit comments

Comments
 (0)