Skip to content

Commit

Permalink
fix: fix warning message
Browse files Browse the repository at this point in the history
  • Loading branch information
ipetinate committed May 15, 2024
1 parent 307de63 commit ccbb014
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
5 changes: 5 additions & 0 deletions src/actions/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ export async function initAction() {
getConfigContent,
updateGlobalStore
)
} else {
console.info(
'You already have a configuration file at: ',
getConfigFilePath()
)
}

// TODO: create folders for presets and templates
Expand Down
10 changes: 6 additions & 4 deletions src/store/global.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { join } from 'node:path'
import { BehaviorSubject } from 'rxjs'
import { getConfigContent } from '../utils/init-action.js'

const configFilePath = join(process.cwd(), 'clingon.config.json')
import { getConfigContent, getConfigFilePath } from '../utils/init-action.js'

export const globalConfigSubject = new BehaviorSubject(getConfigContent(configFilePath))
const configFilePath = getConfigFilePath()

export const globalConfigSubject = new BehaviorSubject(
getConfigContent(configFilePath)
)
3 changes: 1 addition & 2 deletions src/utils/init-action.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
} from './file.js'

import { defaultConfig } from '../constants/config.js'
import { error } from 'node:console'
import { globalConfigSubject } from '../store/global.js'

const rootDir = process.cwd()
Expand Down Expand Up @@ -64,7 +63,7 @@ export function getConfigContent(filePath) {

return fileContentParsed
} catch (e) {
return error instanceof Error ? error.message : error
return e instanceof Error ? error.message : error
}
}

Expand Down

0 comments on commit ccbb014

Please sign in to comment.