diff --git a/CHANGELOG.md b/CHANGELOG.md index dd39eb7..cbbe40b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [0.0.1-alpha.7](https://github.com/DIG-Network/dig-chia-sdk/compare/v0.0.1-alpha.6...v0.0.1-alpha.7) (2024-09-10) + + +### Bug Fixes + +* set dig config when doesnt exist ([d2bf115](https://github.com/DIG-Network/dig-chia-sdk/commit/d2bf115cc5909da0a610e0b9abc90961c7aced0d)) + ### [0.0.1-alpha.6](https://github.com/DIG-Network/dig-chia-sdk/compare/v0.0.1-alpha.5...v0.0.1-alpha.6) (2024-09-10) diff --git a/package-lock.json b/package-lock.json index 390991b..a9f82b1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@dignetwork/dig-sdk", - "version": "0.0.1-alpha.6", + "version": "0.0.1-alpha.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@dignetwork/dig-sdk", - "version": "0.0.1-alpha.6", + "version": "0.0.1-alpha.7", "license": "ISC", "dependencies": { "bip39": "^3.1.0", diff --git a/package.json b/package.json index 400bce3..def318c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dignetwork/dig-sdk", - "version": "0.0.1-alpha.6", + "version": "0.0.1-alpha.7", "description": "", "type": "commonjs", "main": "./dist/index.js", diff --git a/src/utils/config.ts b/src/utils/config.ts index c977891..eeab5d8 100644 --- a/src/utils/config.ts +++ b/src/utils/config.ts @@ -33,9 +33,7 @@ export const createInitialConfig = (): void => { }; export const setRemote = (remote: string): void => { - if (!fs.existsSync(CONFIG_FILE_PATH)) { - throw new Error("Config file not found."); - } + ensureDigConfig(""); const config: Config = JSON.parse(fs.readFileSync(CONFIG_FILE_PATH, "utf-8")); config.remote = remote; @@ -45,9 +43,7 @@ export const setRemote = (remote: string): void => { }; export const setActiveStore = (storeId: string): void => { - if (!fs.existsSync(CONFIG_FILE_PATH)) { - throw new Error("Config file not found."); - } + ensureDigConfig(""); const config: Config = JSON.parse(fs.readFileSync(CONFIG_FILE_PATH, "utf-8")); config.active_store = storeId; @@ -161,10 +157,7 @@ export const getActiveStoreId = async (): Promise => { * @throws Will throw an error if the config file does not exist or cannot be parsed. */ export const loadDigConfig = (baseDir: string): DigConfig => { - if (!fs.existsSync(CONFIG_FILE_PATH)) { - throw new Error(`Configuration file not found at ${CONFIG_FILE_PATH}`); - } - + ensureDigConfig(""); try { const configContent = fs.readFileSync(CONFIG_FILE_PATH, "utf-8"); const config: DigConfig = JSON.parse(configContent);