@achs/env 4.12.3 → 5.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/README.md +580 -830
- package/arguments.d.ts +14 -14
- package/arguments.d.ts.map +1 -1
- package/arguments.js +135 -131
- package/arguments.js.map +1 -1
- package/assets/logo-achs.svg +16 -0
- package/assets/logo.svg +46 -0
- package/commands/env.command.d.ts +8 -2
- package/commands/env.command.d.ts.map +1 -1
- package/commands/env.command.js +55 -82
- package/commands/env.command.js.map +1 -1
- package/commands/export.command.d.ts +8 -2
- package/commands/export.command.d.ts.map +1 -1
- package/commands/export.command.js +53 -62
- package/commands/export.command.js.map +1 -1
- package/commands/index.d.ts +5 -5
- package/commands/index.d.ts.map +1 -1
- package/commands/index.js +5 -14
- package/commands/pull.command.d.ts +6 -1
- package/commands/pull.command.d.ts.map +1 -1
- package/commands/pull.command.js +20 -37
- package/commands/pull.command.js.map +1 -1
- package/commands/push.command.d.ts +6 -1
- package/commands/push.command.d.ts.map +1 -1
- package/commands/push.command.js +20 -36
- package/commands/push.command.js.map +1 -1
- package/commands/schema.command.d.ts +6 -1
- package/commands/schema.command.d.ts.map +1 -1
- package/commands/schema.command.js +16 -17
- package/commands/schema.command.js.map +1 -1
- package/exec.d.ts +7 -1
- package/exec.d.ts.map +1 -1
- package/exec.js +84 -160
- package/exec.js.map +1 -1
- package/index.d.ts +3 -3
- package/index.d.ts.map +1 -1
- package/index.js +3 -20
- package/interfaces/index.d.ts +1 -1
- package/interfaces/index.d.ts.map +1 -1
- package/interfaces/loader.interface.d.ts +29 -3
- package/interfaces/loader.interface.d.ts.map +1 -1
- package/main.d.ts +0 -1
- package/main.js +7 -26
- package/main.js.map +1 -1
- package/package.json +55 -34
- package/providers/app-settings.provider.d.ts +5 -2
- package/providers/app-settings.provider.d.ts.map +1 -1
- package/providers/app-settings.provider.js +36 -49
- package/providers/app-settings.provider.js.map +1 -1
- package/providers/azure-key-vault.provider.d.ts +12 -8
- package/providers/azure-key-vault.provider.d.ts.map +1 -1
- package/providers/azure-key-vault.provider.js +138 -169
- package/providers/azure-key-vault.provider.js.map +1 -1
- package/providers/index.d.ts +2 -2
- package/providers/index.d.ts.map +1 -1
- package/providers/index.js +18 -28
- package/providers/index.js.map +1 -1
- package/providers/local.provider.d.ts +5 -2
- package/providers/local.provider.d.ts.map +1 -1
- package/providers/local.provider.js +27 -40
- package/providers/local.provider.js.map +1 -1
- package/providers/package-json.provider.d.ts +5 -2
- package/providers/package-json.provider.d.ts.map +1 -1
- package/providers/package-json.provider.js +26 -28
- package/providers/package-json.provider.js.map +1 -1
- package/utils/argv.util.d.ts +10 -0
- package/utils/argv.util.d.ts.map +1 -0
- package/utils/argv.util.js +24 -0
- package/utils/argv.util.js.map +1 -0
- package/utils/command.util.d.ts +70 -3
- package/utils/command.util.d.ts.map +1 -1
- package/utils/command.util.js +60 -140
- package/utils/command.util.js.map +1 -1
- package/utils/index.d.ts +7 -6
- package/utils/index.d.ts.map +1 -1
- package/utils/index.js +8 -23
- package/utils/interpolate.util.d.ts +29 -1
- package/utils/interpolate.util.d.ts.map +1 -1
- package/utils/interpolate.util.js +12 -30
- package/utils/interpolate.util.js.map +1 -1
- package/utils/json.util.d.ts +41 -3
- package/utils/json.util.d.ts.map +1 -1
- package/utils/json.util.js +24 -42
- package/utils/json.util.js.map +1 -1
- package/utils/logger.d.ts +21 -2
- package/utils/logger.d.ts.map +1 -1
- package/utils/logger.js +31 -17
- package/utils/logger.js.map +1 -1
- package/utils/normalize.util.d.ts +24 -2
- package/utils/normalize.util.d.ts.map +1 -1
- package/utils/normalize.util.js +35 -56
- package/utils/normalize.util.js.map +1 -1
- package/utils/schema.util.d.ts +59 -0
- package/utils/schema.util.d.ts.map +1 -1
- package/utils/schema.util.js +62 -97
- package/utils/schema.util.js.map +1 -1
- package/commands/index.js.map +0 -1
- package/index.js.map +0 -1
- package/interfaces/index.js +0 -18
- package/interfaces/index.js.map +0 -1
- package/interfaces/loader.interface.js +0 -3
- package/interfaces/loader.interface.js.map +0 -1
- package/tsconfig.build.tsbuildinfo +0 -1
- package/utils/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.command.js","
|
|
1
|
+
{"version":3,"file":"env.command.js","names":[],"sources":["../../src/commands/env.command.ts"],"sourcesContent":["import merge from 'merge-deep';\r\nimport { spawn } from 'node:child_process';\r\nimport pc from 'picocolors';\r\nimport type { CommandModule } from 'yargs';\r\nimport type { CommandArguments } from '../arguments.js';\r\nimport {\r\n\tcreateValidator,\r\n\tflatResults,\r\n\tflatSchema,\r\n\tinterpolate,\r\n\tloadVariablesFromProviders,\r\n\tlogger,\r\n\tnormalize,\r\n} from '../utils/index.js';\r\n\r\nexport interface EnvCommandArguments extends CommandArguments {\r\n\t// whether validate schema before injecting variables\r\n\tschemaValidate: boolean;\r\n\t// command for execute after inject environment variables.\r\n\t// Should be prefixed or surrounded by ':' character.\r\n\tsubcmd: string[];\r\n}\r\n\r\n/**\r\n * Main command.\r\n * Injects environment variables into process.env.\r\n *\r\n * @example [>_]: env -e dev -m debug : npm start\r\n */\r\nexport const envCommand: CommandModule<any, EnvCommandArguments> = {\r\n\tcommand: '$0 [options..] [: <subcmd> :]',\r\n\tdescribe: 'Inject environment variables into process',\r\n\tbuilder: (builder) => {\r\n\t\tbuilder\r\n\t\t\t.options({\r\n\t\t\t\tschemaValidate: {\r\n\t\t\t\t\talias: 'validate',\r\n\t\t\t\t\tdefault: true,\r\n\t\t\t\t\tdescribe: 'Whether validates variables using JSON schema',\r\n\t\t\t\t\ttype: 'boolean',\r\n\t\t\t\t},\r\n\t\t\t\tsubcmd: {\r\n\t\t\t\t\tdescribe: 'Command for inject environment variables',\r\n\t\t\t\t\ttype: 'array',\r\n\t\t\t\t},\r\n\t\t\t})\r\n\t\t\t.example(\r\n\t\t\t\t'env -e dev -m test unit : npm test',\r\n\t\t\t\t'Loads \"dev\" environment variables, in \"test\" and \"unit\" modes, for \"npm start\" command',\r\n\t\t\t)\r\n\t\t\t.example(\r\n\t\t\t\t'env -e dev -m debug : npm start : -c my-config.json',\r\n\t\t\t\t'Loads \"dev\" environment variables, in \"debug\" mode, for \"npm test\" command and custom config file',\r\n\t\t\t)\r\n\t\t\t.example(\r\n\t\t\t\t'env -e dev -m debug -c [[root]]/[[env]].env.json : npm start',\r\n\t\t\t\t'Loads custom config file placed in root folder and named same as the env',\r\n\t\t\t)\r\n\t\t\t.check((argv): boolean => {\r\n\t\t\t\t// special check for custom argument\r\n\t\t\t\tif (argv._.length === 0 && !argv.subcmd) {\r\n\t\t\t\t\tlogger.error(\r\n\t\t\t\t\t\t'No one subcommand provided for exec surrounded by :',\r\n\t\t\t\t\t);\r\n\r\n\t\t\t\t\tprocess.exit(1);\r\n\t\t\t\t}\r\n\r\n\t\t\t\treturn true;\r\n\t\t\t});\r\n\r\n\t\treturn builder;\r\n\t},\r\n\thandler: async ({ expand, providers, schemaValidate, ...argv }) => {\r\n\t\tconst results = await loadVariablesFromProviders(providers, argv);\r\n\r\n\t\tlet env = merge(\r\n\t\t\t{ NODE_ENV: 'development' },\r\n\t\t\t...flatResults(results, argv.nestingDelimiter),\r\n\t\t);\r\n\r\n\t\tif (schemaValidate) {\r\n\t\t\tlet schema = {};\r\n\r\n\t\t\tfor (const {\r\n\t\t\t\thandler: { key },\r\n\t\t\t} of providers) {\r\n\t\t\t\tconst providerSchema = argv.schema?.[key];\r\n\r\n\t\t\t\tif (providerSchema) {\r\n\t\t\t\t\tschema = Object.assign(\r\n\t\t\t\t\t\tschema,\r\n\t\t\t\t\t\tflatSchema(providerSchema, '', argv.nestingDelimiter),\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tconst validator = createValidator({\r\n\t\t\t\tproperties: schema,\r\n\t\t\t\ttype: 'object',\r\n\t\t\t});\r\n\r\n\t\t\tif (!validator(env)) {\r\n\t\t\t\tlogger.error('schema validation failed', validator.errors);\r\n\r\n\t\t\t\tprocess.exit(1);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tenv = normalize(env, argv.nestingDelimiter, argv.arrayDescomposition);\r\n\t\tif (expand) {\r\n\t\t\tenv = interpolate(env, env);\r\n\t\t\targv.subcmd = interpolate(argv.subcmd, env);\r\n\t\t}\r\n\r\n\t\tlogger.debug('environment loaded:', env);\r\n\r\n\t\t// loads env vars to process.env\r\n\t\tfor (const varname in env) process.env[varname] = String(env[varname]);\r\n\r\n\t\tlogger.info(\r\n\t\t\t'executing command >',\r\n\t\t\tpc.bold(pc.yellow(argv.subcmd.join(' '))),\r\n\t\t);\r\n\r\n\t\tconst cmdProcess = argv.subcmd.join(' ');\r\n\r\n\t\tspawn(cmdProcess, {\r\n\t\t\tshell: true,\r\n\t\t\tstdio: 'inherit',\r\n\t\t}).on('exit', (code) => {\r\n\t\t\tif (code === 0 || code === null) {\r\n\t\t\t\tlogger.info('process finished successfully');\r\n\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tlogger.error('process finished with error');\r\n\t\t\tprocess.exit(code);\r\n\t\t});\r\n\t},\r\n};\r\n"],"mappings":";;;;;;;;;;AA6BA,IAAa,IAAsD;CAClE,SAAS;CACT,UAAU;CACV,UAAU,OACT,EACE,QAAQ;EACR,gBAAgB;GACf,OAAO;GACP,SAAS;GACT,UAAU;GACV,MAAM;EACP;EACA,QAAQ;GACP,UAAU;GACV,MAAM;EACP;CACD,CAAC,EACA,QACA,sCACA,gGACD,EACC,QACA,uDACA,yGACD,EACC,QACA,gEACA,0EACD,EACC,OAAO,OAEH,EAAK,EAAE,WAAW,KAAK,CAAC,EAAK,WAChC,EAAO,MACN,qDACD,GAEA,QAAQ,KAAK,CAAC,IAGR,GACP,GAEK;CAER,SAAS,OAAO,EAAE,WAAQ,cAAW,mBAAgB,GAAG,QAAW;EAGlE,IAAI,IAAM,EACT,EAAE,UAAU,cAAc,GAC1B,GAAG,EAAY,MAJM,EAA2B,GAAW,CAAI,GAIvC,EAAK,gBAAgB,CAC9C;EAEA,IAAI,GAAgB;GACnB,IAAI,IAAS,CAAC;GAEd,KAAK,IAAM,EACV,SAAS,EAAE,cACP,GAAW;IACf,IAAM,IAAiB,EAAK,SAAS;IAErC,AAAI,MACH,IAAS,OAAO,OACf,GACA,EAAW,GAAgB,IAAI,EAAK,gBAAgB,CACrD;GAEF;GAEA,IAAM,IAAY,EAAgB;IACjC,YAAY;IACZ,MAAM;GACP,CAAC;GAED,AAAK,EAAU,CAAG,MACjB,EAAO,MAAM,4BAA4B,EAAU,MAAM,GAEzD,QAAQ,KAAK,CAAC;EAEhB;EAQA,AANA,IAAM,EAAU,GAAK,EAAK,kBAAkB,EAAK,mBAAmB,GAChE,MACH,IAAM,EAAY,GAAK,CAAG,GAC1B,EAAK,SAAS,EAAY,EAAK,QAAQ,CAAG,IAG3C,EAAO,MAAM,uBAAuB,CAAG;EAGvC,KAAK,IAAM,KAAW,GAAK,QAAQ,IAAI,KAAW,OAAO,EAAI,EAAQ;EASrE,AAPA,EAAO,KACN,uBACA,EAAG,KAAK,EAAG,OAAO,EAAK,OAAO,KAAK,GAAG,CAAC,CAAC,CACzC,GAIA,EAFmB,EAAK,OAAO,KAAK,GAE9B,GAAY;GACjB,OAAO;GACP,OAAO;EACR,CAAC,EAAE,GAAG,SAAS,MAAS;GACvB,IAAI,MAAS,KAAK,MAAS,MAAM;IAChC,EAAO,KAAK,+BAA+B;IAE3C;GACD;GAGA,AADA,EAAO,MAAM,6BAA6B,GAC1C,QAAQ,KAAK,CAAI;EAClB,CAAC;CACF;AACD"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { CommandModule } from 'yargs';
|
|
2
|
-
import { CommandArguments } from '../arguments';
|
|
2
|
+
import { CommandArguments } from '../arguments.js';
|
|
3
3
|
export interface ExportCommandArguments extends CommandArguments {
|
|
4
|
-
format: '
|
|
4
|
+
format: 'dotenv' | 'json';
|
|
5
5
|
uri: string;
|
|
6
6
|
exportQuotes: boolean;
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Export command.
|
|
10
|
+
* Export environment variables to a file.
|
|
11
|
+
*
|
|
12
|
+
* @example [>_]: env export -e dev -m build
|
|
13
|
+
*/
|
|
8
14
|
export declare const exportCommand: CommandModule<any, ExportCommandArguments>;
|
|
9
15
|
//# sourceMappingURL=export.command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export.command.d.ts","sourceRoot":"","sources":["../../src/commands/export.command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"export.command.d.ts","sourceRoot":"","sources":["../../src/commands/export.command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAWxD,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;IAC/D,MAAM,EAAE,QAAQ,GAAG,MAAM,CAAC;IAE1B,GAAG,EAAE,MAAM,CAAC;IAEZ,YAAY,EAAE,OAAO,CAAC;CACtB;AAED;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,GAAG,EAAE,sBAAsB,CAkFpE,CAAC"}
|
|
@@ -1,64 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const { format, uri } = argv;
|
|
52
|
-
switch (format) {
|
|
53
|
-
case 'dotenv':
|
|
54
|
-
await (0, utils_1.writeEnvFromJson)(uri, env, true, exportQuotes);
|
|
55
|
-
break;
|
|
56
|
-
case 'json':
|
|
57
|
-
await (0, utils_1.writeJson)(uri, env, true);
|
|
58
|
-
break;
|
|
59
|
-
default:
|
|
60
|
-
utils_1.logger.error(`format ${format} not recognized`);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
1
|
+
import { flatAndValidateResults as e, loadVariablesFromProviders as t } from "../utils/command.util.js";
|
|
2
|
+
import { interpolate as n } from "../utils/interpolate.util.js";
|
|
3
|
+
import { writeEnvFromJson as r, writeJson as i } from "../utils/json.util.js";
|
|
4
|
+
import { logger as a } from "../utils/logger.js";
|
|
5
|
+
import { normalize as o } from "../utils/normalize.util.js";
|
|
6
|
+
import "../utils/index.js";
|
|
7
|
+
import s from "merge-deep";
|
|
8
|
+
//#region src/commands/export.command.ts
|
|
9
|
+
var c = {
|
|
10
|
+
command: "export [options..]",
|
|
11
|
+
describe: "Export unified environment variables to a file from providers",
|
|
12
|
+
builder: (e) => (e.options({
|
|
13
|
+
exportQuotes: {
|
|
14
|
+
alias: ["quotes", "q"],
|
|
15
|
+
default: !1,
|
|
16
|
+
describe: "Wraps values in quotes",
|
|
17
|
+
type: "boolean"
|
|
18
|
+
},
|
|
19
|
+
format: {
|
|
20
|
+
alias: "f",
|
|
21
|
+
choices: ["json", "dotenv"],
|
|
22
|
+
default: "dotenv",
|
|
23
|
+
describe: "Format for export variables",
|
|
24
|
+
type: "string"
|
|
25
|
+
},
|
|
26
|
+
uri: {
|
|
27
|
+
alias: [
|
|
28
|
+
"u",
|
|
29
|
+
"p",
|
|
30
|
+
"path"
|
|
31
|
+
],
|
|
32
|
+
default: ".env",
|
|
33
|
+
describe: "Uri for export file with variables",
|
|
34
|
+
type: "string"
|
|
35
|
+
}
|
|
36
|
+
}).example("env export -e dev -m build", "Exports \"dev\" variables to a dotenv file at root as \".env\"").example("env export -e prod -m build -f json --uri [[env]].env.json", "Exports \"prod\" variables to a json file at root as \"prod.env.json\""), e),
|
|
37
|
+
handler: async ({ expand: c, exportIgnoreKeys: l, exportQuotes: u, providers: d, ...f }) => {
|
|
38
|
+
let p = s({ NODE_ENV: "development" }, ...e(await t(d, f), f));
|
|
39
|
+
p = o(p, f.nestingDelimiter, f.arrayDescomposition), c && (p = n(p, p)), l && (a.silly("ignoring:", l), p = Object.fromEntries(Object.entries(p).filter(([e]) => !l.includes(e)))), a.debug("environment loaded:", p);
|
|
40
|
+
let { format: m, uri: h } = f;
|
|
41
|
+
switch (m) {
|
|
42
|
+
case "dotenv":
|
|
43
|
+
await r(h, p, !0, u);
|
|
44
|
+
break;
|
|
45
|
+
case "json":
|
|
46
|
+
await i(h, p, !0);
|
|
47
|
+
break;
|
|
48
|
+
default: a.error(`format ${m} not recognized`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
63
51
|
};
|
|
52
|
+
//#endregion
|
|
53
|
+
export { c as exportCommand };
|
|
54
|
+
|
|
64
55
|
//# sourceMappingURL=export.command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export.command.js","
|
|
1
|
+
{"version":3,"file":"export.command.js","names":[],"sources":["../../src/commands/export.command.ts"],"sourcesContent":["import merge from 'merge-deep';\r\nimport type { CommandModule } from 'yargs';\r\nimport type { CommandArguments } from '../arguments.js';\r\nimport {\r\n\tflatAndValidateResults,\r\n\tinterpolate,\r\n\tloadVariablesFromProviders,\r\n\tlogger,\r\n\tnormalize,\r\n\twriteEnvFromJson,\r\n\twriteJson,\r\n} from '../utils/index.js';\r\n\r\nexport interface ExportCommandArguments extends CommandArguments {\r\n\tformat: 'dotenv' | 'json';\r\n\r\n\turi: string;\r\n\r\n\texportQuotes: boolean;\r\n}\r\n\r\n/**\r\n * Export command.\r\n * Export environment variables to a file.\r\n *\r\n * @example [>_]: env export -e dev -m build\r\n */\r\nexport const exportCommand: CommandModule<any, ExportCommandArguments> = {\r\n\tcommand: 'export [options..]',\r\n\tdescribe: 'Export unified environment variables to a file from providers',\r\n\tbuilder: (builder) => {\r\n\t\tbuilder\r\n\t\t\t.options({\r\n\t\t\t\texportQuotes: {\r\n\t\t\t\t\talias: ['quotes', 'q'],\r\n\t\t\t\t\tdefault: false,\r\n\t\t\t\t\tdescribe: 'Wraps values in quotes',\r\n\t\t\t\t\ttype: 'boolean',\r\n\t\t\t\t},\r\n\t\t\t\tformat: {\r\n\t\t\t\t\talias: 'f',\r\n\t\t\t\t\tchoices: ['json', 'dotenv'],\r\n\t\t\t\t\tdefault: 'dotenv',\r\n\t\t\t\t\tdescribe: 'Format for export variables',\r\n\t\t\t\t\ttype: 'string',\r\n\t\t\t\t},\r\n\t\t\t\turi: {\r\n\t\t\t\t\talias: ['u', 'p', 'path'],\r\n\t\t\t\t\tdefault: '.env',\r\n\t\t\t\t\tdescribe: 'Uri for export file with variables',\r\n\t\t\t\t\ttype: 'string',\r\n\t\t\t\t},\r\n\t\t\t})\r\n\t\t\t.example(\r\n\t\t\t\t'env export -e dev -m build',\r\n\t\t\t\t'Exports \"dev\" variables to a dotenv file at root as \".env\"',\r\n\t\t\t)\r\n\t\t\t.example(\r\n\t\t\t\t'env export -e prod -m build -f json --uri [[env]].env.json',\r\n\t\t\t\t'Exports \"prod\" variables to a json file at root as \"prod.env.json\"',\r\n\t\t\t);\r\n\r\n\t\treturn builder;\r\n\t},\r\n\thandler: async ({\r\n\t\texpand,\r\n\t\texportIgnoreKeys,\r\n\t\texportQuotes,\r\n\t\tproviders,\r\n\t\t...argv\r\n\t}) => {\r\n\t\tconst results = await loadVariablesFromProviders(providers, argv);\r\n\r\n\t\tlet env = merge(\r\n\t\t\t{ NODE_ENV: 'development' },\r\n\t\t\t...flatAndValidateResults(results, argv),\r\n\t\t);\r\n\r\n\t\tenv = normalize(env, argv.nestingDelimiter, argv.arrayDescomposition);\r\n\t\tif (expand) env = interpolate(env, env);\r\n\t\tif (exportIgnoreKeys) {\r\n\t\t\tlogger.silly('ignoring:', exportIgnoreKeys);\r\n\t\t\tenv = Object.fromEntries(\r\n\t\t\t\tObject.entries(env).filter(\r\n\t\t\t\t\t([k]) => !exportIgnoreKeys.includes(k),\r\n\t\t\t\t),\r\n\t\t\t);\r\n\t\t}\r\n\r\n\t\tlogger.debug('environment loaded:', env);\r\n\r\n\t\tconst { format, uri } = argv;\r\n\r\n\t\tswitch (format) {\r\n\t\t\tcase 'dotenv': {\r\n\t\t\t\tawait writeEnvFromJson(uri, env, true, exportQuotes);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\tcase 'json': {\r\n\t\t\t\tawait writeJson(uri, env, true);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\r\n\t\t\tdefault: {\r\n\t\t\t\tlogger.error(`format ${format} not recognized`);\r\n\t\t\t}\r\n\t\t}\r\n\t},\r\n};\r\n"],"mappings":";;;;;;;;AA2BA,IAAa,IAA4D;CACxE,SAAS;CACT,UAAU;CACV,UAAU,OACT,EACE,QAAQ;EACR,cAAc;GACb,OAAO,CAAC,UAAU,GAAG;GACrB,SAAS;GACT,UAAU;GACV,MAAM;EACP;EACA,QAAQ;GACP,OAAO;GACP,SAAS,CAAC,QAAQ,QAAQ;GAC1B,SAAS;GACT,UAAU;GACV,MAAM;EACP;EACA,KAAK;GACJ,OAAO;IAAC;IAAK;IAAK;GAAM;GACxB,SAAS;GACT,UAAU;GACV,MAAM;EACP;CACD,CAAC,EACA,QACA,8BACA,gEACD,EACC,QACA,8DACA,wEACD,GAEM;CAER,SAAS,OAAO,EACf,WACA,qBACA,iBACA,cACA,GAAG,QACE;EAGL,IAAI,IAAM,EACT,EAAE,UAAU,cAAc,GAC1B,GAAG,EAAuB,MAJL,EAA2B,GAAW,CAAI,GAI5B,CAAI,CACxC;EAaA,AAXA,IAAM,EAAU,GAAK,EAAK,kBAAkB,EAAK,mBAAmB,GAChE,MAAQ,IAAM,EAAY,GAAK,CAAG,IAClC,MACH,EAAO,MAAM,aAAa,CAAgB,GAC1C,IAAM,OAAO,YACZ,OAAO,QAAQ,CAAG,EAAE,QAClB,CAAC,OAAO,CAAC,EAAiB,SAAS,CAAC,CACtC,CACD,IAGD,EAAO,MAAM,uBAAuB,CAAG;EAEvC,IAAM,EAAE,WAAQ,WAAQ;EAExB,QAAQ,GAAR;GACC,KAAK;IACJ,MAAM,EAAiB,GAAK,GAAK,IAAM,CAAY;IACnD;GAGD,KAAK;IACJ,MAAM,EAAU,GAAK,GAAK,EAAI;IAC9B;GAGD,SACC,EAAO,MAAM,UAAU,EAAO,gBAAgB;EAEhD;CACD;AACD"}
|
package/commands/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { envCommand } from './env.command';
|
|
2
|
-
export { exportCommand } from './export.command';
|
|
3
|
-
export { pullCommand } from './pull.command';
|
|
4
|
-
export { pushCommand } from './push.command';
|
|
5
|
-
export { schemaCommand } from './schema.command';
|
|
1
|
+
export { envCommand } from './env.command.js';
|
|
2
|
+
export { exportCommand } from './export.command.js';
|
|
3
|
+
export { pullCommand } from './pull.command.js';
|
|
4
|
+
export { pushCommand } from './push.command.js';
|
|
5
|
+
export { schemaCommand } from './schema.command.js';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/commands/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
|
package/commands/index.js
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var export_command_1 = require("./export.command");
|
|
7
|
-
Object.defineProperty(exports, "exportCommand", { enumerable: true, get: function () { return export_command_1.exportCommand; } });
|
|
8
|
-
var pull_command_1 = require("./pull.command");
|
|
9
|
-
Object.defineProperty(exports, "pullCommand", { enumerable: true, get: function () { return pull_command_1.pullCommand; } });
|
|
10
|
-
var push_command_1 = require("./push.command");
|
|
11
|
-
Object.defineProperty(exports, "pushCommand", { enumerable: true, get: function () { return push_command_1.pushCommand; } });
|
|
12
|
-
var schema_command_1 = require("./schema.command");
|
|
13
|
-
Object.defineProperty(exports, "schemaCommand", { enumerable: true, get: function () { return schema_command_1.schemaCommand; } });
|
|
14
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import "./env.command.js";
|
|
2
|
+
import "./export.command.js";
|
|
3
|
+
import "./pull.command.js";
|
|
4
|
+
import "./push.command.js";
|
|
5
|
+
import "./schema.command.js";
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { CommandModule } from 'yargs';
|
|
2
|
-
import { CommandArguments } from '../arguments';
|
|
2
|
+
import { CommandArguments } from '../arguments.js';
|
|
3
3
|
export interface PullCommandArguments extends CommandArguments {
|
|
4
4
|
overwrite: boolean;
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Pulls environment variables from providers.
|
|
8
|
+
*
|
|
9
|
+
* @example [>_]: env pull -e dev
|
|
10
|
+
*/
|
|
6
11
|
export declare const pullCommand: CommandModule<any, PullCommandArguments>;
|
|
7
12
|
//# sourceMappingURL=pull.command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pull.command.d.ts","sourceRoot":"","sources":["../../src/commands/pull.command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"pull.command.d.ts","sourceRoot":"","sources":["../../src/commands/pull.command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAGxD,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAE7D,SAAS,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,GAAG,EAAE,oBAAoB,CAqChE,CAAC"}
|
package/commands/pull.command.js
CHANGED
|
@@ -1,39 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
default: false,
|
|
19
|
-
describe: 'Overwrite local variables'
|
|
20
|
-
}
|
|
21
|
-
})
|
|
22
|
-
.example('env pull -e dev', 'Download "dev" environment secrets')
|
|
23
|
-
.example('env pull -e dev -o', 'Download and overwrite (if any exists) "dev" environment secrets');
|
|
24
|
-
return builder;
|
|
25
|
-
},
|
|
26
|
-
handler: async ({ providers, ...argv }) => {
|
|
27
|
-
const promises = await Promise.all(providers
|
|
28
|
-
.filter(({ handler: { pull } }) => !!pull)
|
|
29
|
-
.map(({ handler: { key, pull }, config }) => {
|
|
30
|
-
utils_1.logger.silly(`pulling from ${picocolors_1.default.yellow(key)} provider`);
|
|
31
|
-
return pull(argv, config);
|
|
32
|
-
}));
|
|
33
|
-
if (promises.length > 0)
|
|
34
|
-
utils_1.logger.info('environment variables pulled successfully');
|
|
35
|
-
else
|
|
36
|
-
utils_1.logger.warn('no providers for pull variables');
|
|
37
|
-
}
|
|
1
|
+
import { logger as e } from "../utils/logger.js";
|
|
2
|
+
import "../utils/index.js";
|
|
3
|
+
import t from "picocolors";
|
|
4
|
+
//#region src/commands/pull.command.ts
|
|
5
|
+
var n = {
|
|
6
|
+
command: "pull [options..]",
|
|
7
|
+
describe: "Pulls environment variables from providers",
|
|
8
|
+
builder: (e) => (e.options({ overwrite: {
|
|
9
|
+
alias: "o",
|
|
10
|
+
default: !1,
|
|
11
|
+
describe: "Overwrite local variables",
|
|
12
|
+
type: "boolean"
|
|
13
|
+
} }).example("env pull -e dev", "Download \"dev\" environment secrets").example("env pull -e dev -o", "Download and overwrite (if any exists) \"dev\" environment secrets"), e),
|
|
14
|
+
handler: async ({ providers: n, ...r }) => {
|
|
15
|
+
let i = n.filter(({ handler: { pull: e } }) => !!e);
|
|
16
|
+
(await Promise.all(i.map(({ config: n, handler: { key: i, pull: a } }) => (e.silly(`pulling from ${t.yellow(i)} provider`), a(r, n))))).length > 0 ? e.info("environment variables pulled successfully") : e.warn("no providers for pull variables");
|
|
17
|
+
}
|
|
38
18
|
};
|
|
19
|
+
//#endregion
|
|
20
|
+
export { n as pullCommand };
|
|
21
|
+
|
|
39
22
|
//# sourceMappingURL=pull.command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pull.command.js","
|
|
1
|
+
{"version":3,"file":"pull.command.js","names":[],"sources":["../../src/commands/pull.command.ts"],"sourcesContent":["import pc from 'picocolors';\r\nimport type { CommandModule } from 'yargs';\r\nimport type { CommandArguments } from '../arguments.js';\r\nimport { logger } from '../utils/index.js';\r\n\r\nexport interface PullCommandArguments extends CommandArguments {\r\n\t// whether variables should be overwritten in already exists\r\n\toverwrite: boolean;\r\n}\r\n\r\n/**\r\n * Pulls environment variables from providers.\r\n *\r\n * @example [>_]: env pull -e dev\r\n */\r\nexport const pullCommand: CommandModule<any, PullCommandArguments> = {\r\n\tcommand: 'pull [options..]',\r\n\tdescribe: 'Pulls environment variables from providers',\r\n\tbuilder: (builder) => {\r\n\t\tbuilder\r\n\t\t\t.options({\r\n\t\t\t\toverwrite: {\r\n\t\t\t\t\talias: 'o',\r\n\t\t\t\t\tdefault: false,\r\n\t\t\t\t\tdescribe: 'Overwrite local variables',\r\n\t\t\t\t\ttype: 'boolean',\r\n\t\t\t\t},\r\n\t\t\t})\r\n\t\t\t.example('env pull -e dev', 'Download \"dev\" environment secrets')\r\n\t\t\t.example(\r\n\t\t\t\t'env pull -e dev -o',\r\n\t\t\t\t'Download and overwrite (if any exists) \"dev\" environment secrets',\r\n\t\t\t);\r\n\r\n\t\treturn builder;\r\n\t},\r\n\thandler: async ({ providers, ...argv }) => {\r\n\t\tconst pullProviders = providers.filter(\r\n\t\t\t({ handler: { pull } }) => !!pull,\r\n\t\t);\r\n\t\tconst promises = await Promise.all(\r\n\t\t\tpullProviders.map(({ config, handler: { key, pull } }) => {\r\n\t\t\t\tlogger.silly(`pulling from ${pc.yellow(key)} provider`);\r\n\r\n\t\t\t\treturn pull!(argv, config);\r\n\t\t\t}),\r\n\t\t);\r\n\r\n\t\tif (promises.length > 0)\r\n\t\t\tlogger.info('environment variables pulled successfully');\r\n\t\telse logger.warn('no providers for pull variables');\r\n\t},\r\n};\r\n"],"mappings":";;;;AAeA,IAAa,IAAwD;CACpE,SAAS;CACT,UAAU;CACV,UAAU,OACT,EACE,QAAQ,EACR,WAAW;EACV,OAAO;EACP,SAAS;EACT,UAAU;EACV,MAAM;CACP,EACD,CAAC,EACA,QAAQ,mBAAmB,sCAAoC,EAC/D,QACA,sBACA,oEACD,GAEM;CAER,SAAS,OAAO,EAAE,cAAW,GAAG,QAAW;EAC1C,IAAM,IAAgB,EAAU,QAC9B,EAAE,SAAS,EAAE,gBAAa,CAAC,CAAC,CAC9B;EASA,CAAI,MARmB,QAAQ,IAC9B,EAAc,KAAK,EAAE,WAAQ,SAAS,EAAE,QAAK,iBAC5C,EAAO,MAAM,gBAAgB,EAAG,OAAO,CAAG,EAAE,UAAU,GAE/C,EAAM,GAAM,CAAM,EACzB,CACF,GAEa,SAAS,IACrB,EAAO,KAAK,2CAA2C,IACnD,EAAO,KAAK,iCAAiC;CACnD;AACD"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { CommandModule } from 'yargs';
|
|
2
|
-
import { CommandArguments } from '../arguments';
|
|
2
|
+
import { CommandArguments } from '../arguments.js';
|
|
3
3
|
export interface PushCommandArguments extends CommandArguments {
|
|
4
4
|
force: boolean;
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Pushes environment variables to providers store.
|
|
8
|
+
*
|
|
9
|
+
* @example [>_]: env push -e dev
|
|
10
|
+
*/
|
|
6
11
|
export declare const pushCommand: CommandModule<any, PushCommandArguments>;
|
|
7
12
|
//# sourceMappingURL=push.command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push.command.d.ts","sourceRoot":"","sources":["../../src/commands/push.command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"push.command.d.ts","sourceRoot":"","sources":["../../src/commands/push.command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAGxD,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB;IAE7D,KAAK,EAAE,OAAO,CAAC;CACf;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,aAAa,CAAC,GAAG,EAAE,oBAAoB,CAiChE,CAAC"}
|
package/commands/push.command.js
CHANGED
|
@@ -1,38 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
default: false,
|
|
19
|
-
describe: 'Force push for secrets'
|
|
20
|
-
}
|
|
21
|
-
})
|
|
22
|
-
.example('env push -e dev', 'Download "dev" environment secrets');
|
|
23
|
-
return builder;
|
|
24
|
-
},
|
|
25
|
-
handler: async ({ providers, ...argv }) => {
|
|
26
|
-
const promises = await Promise.all(providers
|
|
27
|
-
.filter(({ handler: { push } }) => !!push)
|
|
28
|
-
.map(({ handler: { key, push }, config }) => {
|
|
29
|
-
utils_1.logger.debug(`pushing to ${picocolors_1.default.yellow(key)} provider`);
|
|
30
|
-
return push(argv, config);
|
|
31
|
-
}));
|
|
32
|
-
if (promises.length > 0)
|
|
33
|
-
utils_1.logger.info('environment variables pushed successfully');
|
|
34
|
-
else
|
|
35
|
-
utils_1.logger.warn('no providers for push variables');
|
|
36
|
-
}
|
|
1
|
+
import { logger as e } from "../utils/logger.js";
|
|
2
|
+
import "../utils/index.js";
|
|
3
|
+
import t from "picocolors";
|
|
4
|
+
//#region src/commands/push.command.ts
|
|
5
|
+
var n = {
|
|
6
|
+
command: "push [options..]",
|
|
7
|
+
describe: "Pushes environment variables to providers store",
|
|
8
|
+
builder: (e) => (e.options({ force: {
|
|
9
|
+
alias: "f",
|
|
10
|
+
default: !1,
|
|
11
|
+
describe: "Force push for secrets",
|
|
12
|
+
type: "boolean"
|
|
13
|
+
} }).example("env push -e dev", "Download \"dev\" environment secrets"), e),
|
|
14
|
+
handler: async ({ providers: n, ...r }) => {
|
|
15
|
+
let i = n.filter(({ handler: { push: e } }) => !!e);
|
|
16
|
+
(await Promise.all(i.map(({ config: n, handler: { key: i, push: a } }) => (e.debug(`pushing to ${t.yellow(i)} provider`), a(r, n))))).length > 0 ? e.info("environment variables pushed successfully") : e.warn("no providers for push variables");
|
|
17
|
+
}
|
|
37
18
|
};
|
|
19
|
+
//#endregion
|
|
20
|
+
export { n as pushCommand };
|
|
21
|
+
|
|
38
22
|
//# sourceMappingURL=push.command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push.command.js","
|
|
1
|
+
{"version":3,"file":"push.command.js","names":[],"sources":["../../src/commands/push.command.ts"],"sourcesContent":["import pc from 'picocolors';\r\nimport type { CommandModule } from 'yargs';\r\nimport type { CommandArguments } from '../arguments.js';\r\nimport { logger } from '../utils/index.js';\r\n\r\nexport interface PushCommandArguments extends CommandArguments {\r\n\t// forces to push in case of conflict\r\n\tforce: boolean;\r\n}\r\n\r\n/**\r\n * Pushes environment variables to providers store.\r\n *\r\n * @example [>_]: env push -e dev\r\n */\r\nexport const pushCommand: CommandModule<any, PushCommandArguments> = {\r\n\tcommand: 'push [options..]',\r\n\tdescribe: 'Pushes environment variables to providers store',\r\n\tbuilder: (builder) => {\r\n\t\tbuilder\r\n\t\t\t.options({\r\n\t\t\t\tforce: {\r\n\t\t\t\t\talias: 'f',\r\n\t\t\t\t\tdefault: false,\r\n\t\t\t\t\tdescribe: 'Force push for secrets',\r\n\t\t\t\t\ttype: 'boolean',\r\n\t\t\t\t},\r\n\t\t\t})\r\n\t\t\t.example('env push -e dev', 'Download \"dev\" environment secrets');\r\n\r\n\t\treturn builder;\r\n\t},\r\n\thandler: async ({ providers, ...argv }) => {\r\n\t\tconst pushProviders = providers.filter(\r\n\t\t\t({ handler: { push } }) => !!push,\r\n\t\t);\r\n\t\tconst promises = await Promise.all(\r\n\t\t\tpushProviders.map(({ config, handler: { key, push } }) => {\r\n\t\t\t\tlogger.debug(`pushing to ${pc.yellow(key)} provider`);\r\n\r\n\t\t\t\treturn push!(argv, config);\r\n\t\t\t}),\r\n\t\t);\r\n\r\n\t\tif (promises.length > 0)\r\n\t\t\tlogger.info('environment variables pushed successfully');\r\n\t\telse logger.warn('no providers for push variables');\r\n\t},\r\n};\r\n"],"mappings":";;;;AAeA,IAAa,IAAwD;CACpE,SAAS;CACT,UAAU;CACV,UAAU,OACT,EACE,QAAQ,EACR,OAAO;EACN,OAAO;EACP,SAAS;EACT,UAAU;EACV,MAAM;CACP,EACD,CAAC,EACA,QAAQ,mBAAmB,sCAAoC,GAE1D;CAER,SAAS,OAAO,EAAE,cAAW,GAAG,QAAW;EAC1C,IAAM,IAAgB,EAAU,QAC9B,EAAE,SAAS,EAAE,gBAAa,CAAC,CAAC,CAC9B;EASA,CAAI,MARmB,QAAQ,IAC9B,EAAc,KAAK,EAAE,WAAQ,SAAS,EAAE,QAAK,iBAC5C,EAAO,MAAM,cAAc,EAAG,OAAO,CAAG,EAAE,UAAU,GAE7C,EAAM,GAAM,CAAM,EACzB,CACF,GAEa,SAAS,IACrB,EAAO,KAAK,2CAA2C,IACnD,EAAO,KAAK,iCAAiC;CACnD;AACD"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { CommandModule } from 'yargs';
|
|
2
|
-
import { CommandArguments } from '../arguments';
|
|
2
|
+
import { CommandArguments } from '../arguments.js';
|
|
3
|
+
/**
|
|
4
|
+
* Generates validation schema from providers environment variables.
|
|
5
|
+
*
|
|
6
|
+
* @example [>_]: env schema -e dev -m build
|
|
7
|
+
*/
|
|
3
8
|
export declare const schemaCommand: CommandModule<any, CommandArguments>;
|
|
4
9
|
//# sourceMappingURL=schema.command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.command.d.ts","sourceRoot":"","sources":["../../src/commands/schema.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.command.d.ts","sourceRoot":"","sources":["../../src/commands/schema.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAOxD;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,GAAG,EAAE,gBAAgB,CAmB9D,CAAC"}
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const schema = await (0, utils_1.generateSchemaFrom)(results, argv);
|
|
15
|
-
utils_1.logger.silly('schema:', schema);
|
|
16
|
-
utils_1.logger.info('schema updated successfully');
|
|
17
|
-
}
|
|
1
|
+
import { generateSchemaFrom as e, loadVariablesFromProviders as t } from "../utils/command.util.js";
|
|
2
|
+
import { logger as n } from "../utils/logger.js";
|
|
3
|
+
import "../utils/index.js";
|
|
4
|
+
//#region src/commands/schema.command.ts
|
|
5
|
+
var r = {
|
|
6
|
+
command: "schema [options..]",
|
|
7
|
+
describe: "Generates validation schema from providers",
|
|
8
|
+
builder: (e) => e.example("env schema --generate -e dev -m debug unit", "Updates JSON schema"),
|
|
9
|
+
handler: async (r) => {
|
|
10
|
+
r.ci = !0;
|
|
11
|
+
let i = await e(await t(r.providers, r), r);
|
|
12
|
+
n.silly("schema:", i), n.info("schema updated successfully");
|
|
13
|
+
}
|
|
18
14
|
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { r as schemaCommand };
|
|
17
|
+
|
|
19
18
|
//# sourceMappingURL=schema.command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.command.js","
|
|
1
|
+
{"version":3,"file":"schema.command.js","names":[],"sources":["../../src/commands/schema.command.ts"],"sourcesContent":["import type { CommandModule } from 'yargs';\r\nimport type { CommandArguments } from '../arguments.js';\r\nimport {\r\n\tgenerateSchemaFrom,\r\n\tloadVariablesFromProviders,\r\n\tlogger,\r\n} from '../utils/index.js';\r\n\r\n/**\r\n * Generates validation schema from providers environment variables.\r\n *\r\n * @example [>_]: env schema -e dev -m build\r\n */\r\nexport const schemaCommand: CommandModule<any, CommandArguments> = {\r\n\tcommand: 'schema [options..]',\r\n\tdescribe: 'Generates validation schema from providers',\r\n\tbuilder: (builder) => {\r\n\t\treturn builder.example(\r\n\t\t\t'env schema --generate -e dev -m debug unit',\r\n\t\t\t'Updates JSON schema',\r\n\t\t);\r\n\t},\r\n\thandler: async (argv) => {\r\n\t\targv.ci = true;\r\n\r\n\t\tconst results = await loadVariablesFromProviders(argv.providers, argv);\r\n\r\n\t\tconst schema = await generateSchemaFrom(results, argv);\r\n\r\n\t\tlogger.silly('schema:', schema);\r\n\t\tlogger.info('schema updated successfully');\r\n\t},\r\n};\r\n"],"mappings":";;;;AAaA,IAAa,IAAsD;CAClE,SAAS;CACT,UAAU;CACV,UAAU,MACF,EAAQ,QACd,8CACA,qBACD;CAED,SAAS,OAAO,MAAS;EACxB,EAAK,KAAK;EAIV,IAAM,IAAS,MAAM,EAAmB,MAFlB,EAA2B,EAAK,WAAW,CAAI,GAEpB,CAAI;EAGrD,AADA,EAAO,MAAM,WAAW,CAAM,GAC9B,EAAO,KAAK,6BAA6B;CAC1C;AACD"}
|
package/exec.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Command preprocessing and lib info
|
|
3
|
+
* reading from package.json.
|
|
4
|
+
* Preloads config file and setup basic config.
|
|
5
|
+
*
|
|
6
|
+
* @param {string[]} rawArgv process.argv
|
|
7
|
+
*/
|
|
2
8
|
export declare function exec(rawArgv: string[]): Promise<void>;
|
|
3
9
|
//# sourceMappingURL=exec.d.ts.map
|
package/exec.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../src/exec.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../src/exec.ts"],"names":[],"mappings":"AAsFA;;;;;;GAMG;AACH,wBAAsB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,iBAkE3C"}
|