From bc49ceea79e0c12454fb862e970e744e76cca53a Mon Sep 17 00:00:00 2001 From: aexol Date: Wed, 3 Jul 2024 14:39:12 +0200 Subject: [PATCH] save on input --- package-lock.json | 34 +++++++++++++++++-- packages/config-maker/package.json | 2 +- .../config-maker/src/Configuration/index.ts | 3 +- packages/sandbox/package.json | 6 ++-- 4 files changed, 38 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6b3693e..152cd0f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4181,7 +4181,7 @@ } }, "packages/config-maker": { - "version": "0.0.1", + "version": "0.0.3", "license": "MIT", "dependencies": { "adm-zip": "^0.5.9", @@ -4210,7 +4210,7 @@ } }, "packages/sandbox": { - "version": "0.8.7", + "version": "0.8.8", "license": "MIT", "dependencies": { "config-maker": "^0.0.1", @@ -4228,6 +4228,36 @@ "dependencies": { "undici-types": "~5.26.4" } + }, + "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==", + "dependencies": { + "adm-zip": "^0.5.9", + "archiver": "^5.3.1", + "chalk": "^5.0.1", + "clipboardy": "^3.0.0", + "conf": "^10.2.0", + "dotenv": "^16.0.3", + "execa": "^6.1.0", + "express": "^4.18.1", + "fast-glob": "^3.2.12", + "figures": "^5.0.0", + "inquirer": "^9.1.2", + "mime": "^3.0.0", + "node-fetch": "^3.2.10", + "open": "^8.4.0", + "ora": "^6.1.2", + "picocolors": "^1.0.0", + "pkg-install": "^1.0.0", + "qs": "^6.11.0", + "run-async": "^2.4.1", + "ts-node": "^10.9.1", + "ts-patch": "^3.0.2", + "ws": "^8.14.2", + "yargs": "^17.5.1" + } } } } diff --git a/packages/config-maker/package.json b/packages/config-maker/package.json index 4f5f8ca..421c13b 100644 --- a/packages/config-maker/package.json +++ b/packages/config-maker/package.json @@ -1,6 +1,6 @@ { "name": "config-maker", - "version": "0.0.2", + "version": "0.0.3", "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 4631edd..30d9fc8 100644 --- a/packages/config-maker/src/Configuration/index.ts +++ b/packages/config-maker/src/Configuration/index.ts @@ -159,7 +159,7 @@ export class ConfigMaker< const valueFromCommandLine = options?.commandLineProvidedOptions?.[k as string]; if (valueFromCommandLine) - returnValue = (decoderFunction?.(valueFromCommandLine) || + return (decoderFunction?.(valueFromCommandLine) || valueFromCommandLine) as ConfigurationOptions[T]; // Then we check if there is environment variable. @@ -210,6 +210,7 @@ export class ConfigMaker< const decoded = decoderFunction?.(answer) || answer; returnValue = decoded as ConfigurationOptions[T]; } + if (options?.saveOnInput) this.save(); return returnValue; }; diff --git a/packages/sandbox/package.json b/packages/sandbox/package.json index c7eafa3..7a2db59 100644 --- a/packages/sandbox/package.json +++ b/packages/sandbox/package.json @@ -1,15 +1,15 @@ { "name": "sandbox", "private": true, - "version": "0.8.7", + "version": "0.8.8", "description": "CLI test", "author": "Artur Czemiel", "license": "MIT", "type": "module", "scripts": { "cli": "node lib/index.js", - "build":"tspc", - "watch":"tspc --watch" + "build": "tspc", + "watch": "tspc --watch" }, "dependencies": { "config-maker": "^0.0.1",