diff --git a/package-lock.json b/package-lock.json index 152cd0f..58cb4a1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4181,7 +4181,7 @@ } }, "packages/config-maker": { - "version": "0.0.3", + "version": "0.0.4", "license": "MIT", "dependencies": { "adm-zip": "^0.5.9", @@ -4210,10 +4210,10 @@ } }, "packages/sandbox": { - "version": "0.8.8", + "version": "0.8.9", "license": "MIT", "dependencies": { - "config-maker": "^0.0.1", + "config-maker": "^0.0.3", "yargs": "^17.7.2" }, "devDependencies": { @@ -4230,9 +4230,9 @@ } }, "packages/sandbox/node_modules/config-maker": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/config-maker/-/config-maker-0.0.1.tgz", - "integrity": "sha512-AXV6afQqz/llf2/7+pN5d2Fu+Zwzf+eTxfkpUAFa9PmJtBR3RpWmKAx6QCSD0FLqw32O+G6An5KMOY3pnLPqPg==", + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/config-maker/-/config-maker-0.0.3.tgz", + "integrity": "sha512-M06a1mIaweGMhvOVV7feDrn82jrMD2g9hv2DTUMmA93JM4pm7Ow/CR21HMnG2B1AvoT5HPIF94zQl2Obze+9Bw==", "dependencies": { "adm-zip": "^0.5.9", "archiver": "^5.3.1", diff --git a/packages/config-maker/package.json b/packages/config-maker/package.json index 421c13b..77e8295 100644 --- a/packages/config-maker/package.json +++ b/packages/config-maker/package.json @@ -1,6 +1,6 @@ { "name": "config-maker", - "version": "0.0.3", + "version": "0.0.4", "description": "Make interactive config for CLIs. Fetch values from command line, file, user options or environment variable.", "main": "lib/index.js", "author": "Artur Czemiel", diff --git a/packages/config-maker/src/Configuration/index.ts b/packages/config-maker/src/Configuration/index.ts index 30d9fc8..4ffc679 100644 --- a/packages/config-maker/src/Configuration/index.ts +++ b/packages/config-maker/src/Configuration/index.ts @@ -168,7 +168,7 @@ export class ConfigMaker< if (nameOfEnv) { const valueFromEnv = getEnvValue(nameOfEnv); if (valueFromEnv) { - returnValue = (decoderFunction?.(valueFromEnv) || + return (decoderFunction?.(valueFromEnv) || valueFromEnv) as ConfigurationOptions[T]; } } @@ -210,7 +210,7 @@ export class ConfigMaker< const decoded = decoderFunction?.(answer) || answer; returnValue = decoded as ConfigurationOptions[T]; } - if (options?.saveOnInput) this.save(); + if (options?.saveOnInput && returnValue) this.setValue(k, returnValue); return returnValue; }; diff --git a/packages/sandbox/package.json b/packages/sandbox/package.json index a6cbef6..d0c3f74 100644 --- a/packages/sandbox/package.json +++ b/packages/sandbox/package.json @@ -1,7 +1,7 @@ { "name": "sandbox", "private": true, - "version": "0.8.8", + "version": "0.8.9", "description": "CLI test", "author": "Artur Czemiel", "license": "MIT", @@ -12,7 +12,7 @@ "watch": "tspc --watch" }, "dependencies": { - "config-maker": "^0.0.3", + "config-maker": "^0.0.4", "yargs": "^17.7.2" }, "devDependencies": {