Skip to content

Commit

Permalink
Merge pull request #7 from DIG-Network/release/v0.0.1-alpha.7
Browse files Browse the repository at this point in the history
Release/v0.0.1 alpha.7
  • Loading branch information
MichaelTaylor3D authored Sep 10, 2024
2 parents 250f3df + 973a629 commit d15b6bd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
13 changes: 3 additions & 10 deletions src/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -161,10 +157,7 @@ export const getActiveStoreId = async (): Promise<Buffer | null> => {
* @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);
Expand Down

0 comments on commit d15b6bd

Please sign in to comment.