@karmaniverous/get-dotenv 6.0.0-0 → 6.0.0
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/README.md +86 -334
- package/dist/cli.d.ts +569 -0
- package/dist/cli.mjs +18788 -0
- package/dist/cliHost.d.ts +548 -253
- package/dist/cliHost.mjs +1990 -1458
- package/dist/config.d.ts +192 -14
- package/dist/config.mjs +256 -81
- package/dist/env-overlay.d.ts +226 -18
- package/dist/env-overlay.mjs +181 -22
- package/dist/getdotenv.cli.mjs +18166 -3437
- package/dist/index.d.ts +729 -136
- package/dist/index.mjs +18207 -3457
- package/dist/plugins-aws.d.ts +289 -104
- package/dist/plugins-aws.mjs +2462 -350
- package/dist/plugins-batch.d.ts +355 -105
- package/dist/plugins-batch.mjs +2595 -420
- package/dist/plugins-cmd.d.ts +287 -118
- package/dist/plugins-cmd.mjs +2661 -839
- package/dist/plugins-init.d.ts +272 -100
- package/dist/plugins-init.mjs +2152 -37
- package/dist/plugins.d.ts +323 -140
- package/dist/plugins.mjs +18006 -2025
- package/dist/templates/cli/index.ts +26 -0
- package/dist/templates/cli/plugins/hello.ts +43 -0
- package/dist/templates/config/js/getdotenv.config.js +20 -0
- package/dist/templates/config/json/local/getdotenv.config.local.json +7 -0
- package/dist/templates/config/json/public/getdotenv.config.json +9 -0
- package/dist/templates/config/public/getdotenv.config.json +8 -0
- package/dist/templates/config/ts/getdotenv.config.ts +28 -0
- package/dist/templates/config/yaml/local/getdotenv.config.local.yaml +7 -0
- package/dist/templates/config/yaml/public/getdotenv.config.yaml +7 -0
- package/dist/templates/getdotenv.config.js +20 -0
- package/dist/templates/getdotenv.config.json +9 -0
- package/dist/templates/getdotenv.config.local.json +7 -0
- package/dist/templates/getdotenv.config.local.yaml +7 -0
- package/dist/templates/getdotenv.config.ts +28 -0
- package/dist/templates/getdotenv.config.yaml +7 -0
- package/dist/templates/hello.ts +43 -0
- package/dist/templates/index.ts +26 -0
- package/dist/templates/js/getdotenv.config.js +20 -0
- package/dist/templates/json/local/getdotenv.config.local.json +7 -0
- package/dist/templates/json/public/getdotenv.config.json +9 -0
- package/dist/templates/local/getdotenv.config.local.json +7 -0
- package/dist/templates/local/getdotenv.config.local.yaml +7 -0
- package/dist/templates/plugins/hello.ts +43 -0
- package/dist/templates/public/getdotenv.config.json +9 -0
- package/dist/templates/public/getdotenv.config.yaml +7 -0
- package/dist/templates/ts/getdotenv.config.ts +28 -0
- package/dist/templates/yaml/local/getdotenv.config.local.yaml +7 -0
- package/dist/templates/yaml/public/getdotenv.config.yaml +7 -0
- package/getdotenv.config.json +1 -19
- package/package.json +52 -89
- package/templates/cli/index.ts +26 -0
- package/templates/cli/plugins/hello.ts +43 -0
- package/templates/config/js/getdotenv.config.js +9 -4
- package/templates/config/json/public/getdotenv.config.json +0 -3
- package/templates/config/public/getdotenv.config.json +0 -5
- package/templates/config/ts/getdotenv.config.ts +17 -5
- package/templates/config/yaml/public/getdotenv.config.yaml +0 -3
- package/dist/cliHost.cjs +0 -2078
- package/dist/cliHost.d.cts +0 -451
- package/dist/cliHost.d.mts +0 -451
- package/dist/config.cjs +0 -252
- package/dist/config.d.cts +0 -55
- package/dist/config.d.mts +0 -55
- package/dist/env-overlay.cjs +0 -163
- package/dist/env-overlay.d.cts +0 -50
- package/dist/env-overlay.d.mts +0 -50
- package/dist/index.cjs +0 -4077
- package/dist/index.d.cts +0 -318
- package/dist/index.d.mts +0 -318
- package/dist/plugins-aws.cjs +0 -666
- package/dist/plugins-aws.d.cts +0 -158
- package/dist/plugins-aws.d.mts +0 -158
- package/dist/plugins-batch.cjs +0 -658
- package/dist/plugins-batch.d.cts +0 -181
- package/dist/plugins-batch.d.mts +0 -181
- package/dist/plugins-cmd.cjs +0 -1112
- package/dist/plugins-cmd.d.cts +0 -178
- package/dist/plugins-cmd.d.mts +0 -178
- package/dist/plugins-demo.cjs +0 -352
- package/dist/plugins-demo.d.cts +0 -158
- package/dist/plugins-demo.d.mts +0 -158
- package/dist/plugins-demo.d.ts +0 -158
- package/dist/plugins-demo.mjs +0 -350
- package/dist/plugins-init.cjs +0 -289
- package/dist/plugins-init.d.cts +0 -162
- package/dist/plugins-init.d.mts +0 -162
- package/dist/plugins.cjs +0 -2327
- package/dist/plugins.d.cts +0 -211
- package/dist/plugins.d.mts +0 -211
- package/templates/cli/ts/index.ts +0 -9
- package/templates/cli/ts/plugins/hello.ts +0 -17
package/package.json
CHANGED
|
@@ -13,58 +13,61 @@
|
|
|
13
13
|
"url": "https://github.com/karmaniverous/get-dotenv/issues"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"commander": "^14.0.
|
|
16
|
+
"@commander-js/extra-typings": "^14.0.0",
|
|
17
|
+
"commander": "^14.0.2",
|
|
17
18
|
"dotenv": "^17.2.3",
|
|
18
|
-
"execa": "^9.6.
|
|
19
|
+
"execa": "^9.6.1",
|
|
19
20
|
"fs-extra": "^11.3.2",
|
|
20
|
-
"globby": "^
|
|
21
|
+
"globby": "^16",
|
|
21
22
|
"nanoid": "^5.1.6",
|
|
22
23
|
"package-directory": "^8.1.0",
|
|
23
|
-
"yaml": "^2.8.
|
|
24
|
-
"zod": "^4.1.
|
|
24
|
+
"yaml": "^2.8.2",
|
|
25
|
+
"zod": "^4.1.13"
|
|
25
26
|
},
|
|
26
27
|
"description": "Process dotenv files in an arbitrary location & optionally populate environment variables.",
|
|
27
28
|
"devDependencies": {
|
|
28
|
-
"@
|
|
29
|
-
"@
|
|
30
|
-
"@
|
|
31
|
-
"@rollup/plugin-
|
|
29
|
+
"@aws-sdk/client-sts": "^3.948.0",
|
|
30
|
+
"@dotenvx/dotenvx": "^1.51.2",
|
|
31
|
+
"@eslint/js": "^9.39.2",
|
|
32
|
+
"@rollup/plugin-alias": "^6.0.0",
|
|
33
|
+
"@rollup/plugin-commonjs": "^29.0.0",
|
|
32
34
|
"@rollup/plugin-json": "^6.1.0",
|
|
33
35
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
34
|
-
"@rollup/plugin-typescript": "^12.
|
|
36
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
35
37
|
"@types/fs-extra": "^11.0.4",
|
|
36
|
-
"@types/node": "^
|
|
37
|
-
"@vitest/coverage-v8": "^
|
|
38
|
-
"@vitest/eslint-plugin": "^1.
|
|
38
|
+
"@types/node": "^25",
|
|
39
|
+
"@vitest/coverage-v8": "^4.0.15",
|
|
40
|
+
"@vitest/eslint-plugin": "^1.5.2",
|
|
39
41
|
"auto-changelog": "^2.5.0",
|
|
40
42
|
"cross-env": "^10.1.0",
|
|
41
|
-
"esbuild": "^0.
|
|
42
|
-
"eslint": "^9.
|
|
43
|
+
"esbuild": "^0.27.1",
|
|
44
|
+
"eslint": "^9.39.2",
|
|
43
45
|
"eslint-config-prettier": "^10.1.8",
|
|
44
46
|
"eslint-plugin-jsonc": "^2.21.0",
|
|
45
47
|
"eslint-plugin-prettier": "^5.5.4",
|
|
46
48
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
47
|
-
"eslint-plugin-tsdoc": "^0.
|
|
49
|
+
"eslint-plugin-tsdoc": "^0.5.0",
|
|
48
50
|
"fs-extra": "^11.3.2",
|
|
49
|
-
"globals": "^16.
|
|
50
|
-
"jsonc-eslint-parser": "^2.4.
|
|
51
|
-
"knip": "^5.
|
|
52
|
-
"lefthook": "^2.0.
|
|
53
|
-
"npm-packlist": "^10.0.
|
|
54
|
-
"prettier": "^3.
|
|
55
|
-
"release-it": "^19.0
|
|
56
|
-
"rimraf": "^6.
|
|
57
|
-
"rollup": "^4.
|
|
58
|
-
"rollup-plugin-
|
|
51
|
+
"globals": "^16.5.0",
|
|
52
|
+
"jsonc-eslint-parser": "^2.4.2",
|
|
53
|
+
"knip": "^5.73.4",
|
|
54
|
+
"lefthook": "^2.0.11",
|
|
55
|
+
"npm-packlist": "^10.0.3",
|
|
56
|
+
"prettier": "^3.7.4",
|
|
57
|
+
"release-it": "^19.1.0",
|
|
58
|
+
"rimraf": "^6.1.2",
|
|
59
|
+
"rollup": "^4.53.3",
|
|
60
|
+
"rollup-plugin-copy": "^3.5.0",
|
|
61
|
+
"rollup-plugin-dts": "^6.3.0",
|
|
59
62
|
"tslib": "^2.8.1",
|
|
60
|
-
"tsx": "^4.
|
|
61
|
-
"typedoc": "^0.28.
|
|
63
|
+
"tsx": "^4.21.0",
|
|
64
|
+
"typedoc": "^0.28.15",
|
|
62
65
|
"typedoc-plugin-mdn-links": "^5.0.10",
|
|
63
66
|
"typedoc-plugin-replace-text": "^4.2.0",
|
|
64
67
|
"typescript": "^5.9.3",
|
|
65
|
-
"typescript-eslint": "^8.
|
|
68
|
+
"typescript-eslint": "^8.49.0",
|
|
66
69
|
"vite-tsconfig-paths": "^5.1.4",
|
|
67
|
-
"vitest": "^
|
|
70
|
+
"vitest": "^4.0.15"
|
|
68
71
|
},
|
|
69
72
|
"engines": {
|
|
70
73
|
"node": ">=20"
|
|
@@ -72,102 +75,62 @@
|
|
|
72
75
|
"exports": {
|
|
73
76
|
".": {
|
|
74
77
|
"import": {
|
|
75
|
-
"types": "./dist/index.d.
|
|
78
|
+
"types": "./dist/index.d.ts",
|
|
76
79
|
"default": "./dist/index.mjs"
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"./cli": {
|
|
83
|
+
"import": {
|
|
84
|
+
"types": "./dist/cli.d.ts",
|
|
85
|
+
"default": "./dist/cli.mjs"
|
|
81
86
|
}
|
|
82
87
|
},
|
|
83
88
|
"./cliHost": {
|
|
84
89
|
"import": {
|
|
85
|
-
"types": "./dist/cliHost.d.
|
|
90
|
+
"types": "./dist/cliHost.d.ts",
|
|
86
91
|
"default": "./dist/cliHost.mjs"
|
|
87
|
-
},
|
|
88
|
-
"require": {
|
|
89
|
-
"types": "./dist/cliHost.d.cts",
|
|
90
|
-
"default": "./dist/cliHost.cjs"
|
|
91
92
|
}
|
|
92
93
|
},
|
|
93
94
|
"./plugins": {
|
|
94
95
|
"import": {
|
|
95
|
-
"types": "./dist/plugins.d.
|
|
96
|
+
"types": "./dist/plugins.d.ts",
|
|
96
97
|
"default": "./dist/plugins.mjs"
|
|
97
|
-
},
|
|
98
|
-
"require": {
|
|
99
|
-
"types": "./dist/plugins.d.cts",
|
|
100
|
-
"default": "./dist/plugins.cjs"
|
|
101
98
|
}
|
|
102
99
|
},
|
|
103
100
|
"./plugins/aws": {
|
|
104
101
|
"import": {
|
|
105
|
-
"types": "./dist/plugins-aws.d.
|
|
102
|
+
"types": "./dist/plugins-aws.d.ts",
|
|
106
103
|
"default": "./dist/plugins-aws.mjs"
|
|
107
|
-
},
|
|
108
|
-
"require": {
|
|
109
|
-
"types": "./dist/plugins-aws.d.cts",
|
|
110
|
-
"default": "./dist/plugins-aws.cjs"
|
|
111
104
|
}
|
|
112
105
|
},
|
|
113
106
|
"./plugins/batch": {
|
|
114
107
|
"import": {
|
|
115
|
-
"types": "./dist/plugins-batch.d.
|
|
108
|
+
"types": "./dist/plugins-batch.d.ts",
|
|
116
109
|
"default": "./dist/plugins-batch.mjs"
|
|
117
|
-
},
|
|
118
|
-
"require": {
|
|
119
|
-
"types": "./dist/plugins-batch.d.cts",
|
|
120
|
-
"default": "./dist/plugins-batch.cjs"
|
|
121
110
|
}
|
|
122
111
|
},
|
|
123
112
|
"./plugins/init": {
|
|
124
113
|
"import": {
|
|
125
|
-
"types": "./dist/plugins-init.d.
|
|
114
|
+
"types": "./dist/plugins-init.d.ts",
|
|
126
115
|
"default": "./dist/plugins-init.mjs"
|
|
127
|
-
},
|
|
128
|
-
"require": {
|
|
129
|
-
"types": "./dist/plugins-init.d.cts",
|
|
130
|
-
"default": "./dist/plugins-init.cjs"
|
|
131
116
|
}
|
|
132
117
|
},
|
|
133
118
|
"./plugins/cmd": {
|
|
134
119
|
"import": {
|
|
135
|
-
"types": "./dist/plugins-cmd.d.
|
|
120
|
+
"types": "./dist/plugins-cmd.d.ts",
|
|
136
121
|
"default": "./dist/plugins-cmd.mjs"
|
|
137
|
-
},
|
|
138
|
-
"require": {
|
|
139
|
-
"types": "./dist/plugins-cmd.d.cts",
|
|
140
|
-
"default": "./dist/plugins-cmd.cjs"
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
"./plugins/demo": {
|
|
144
|
-
"import": {
|
|
145
|
-
"types": "./dist/plugins-demo.d.mts",
|
|
146
|
-
"default": "./dist/plugins-demo.mjs"
|
|
147
|
-
},
|
|
148
|
-
"require": {
|
|
149
|
-
"types": "./dist/plugins-demo.d.cts",
|
|
150
|
-
"default": "./dist/plugins-demo.cjs"
|
|
151
122
|
}
|
|
152
123
|
},
|
|
153
124
|
"./config": {
|
|
154
125
|
"import": {
|
|
155
|
-
"types": "./dist/config.d.
|
|
126
|
+
"types": "./dist/config.d.ts",
|
|
156
127
|
"default": "./dist/config.mjs"
|
|
157
|
-
},
|
|
158
|
-
"require": {
|
|
159
|
-
"types": "./dist/config.d.cts",
|
|
160
|
-
"default": "./dist/config.cjs"
|
|
161
128
|
}
|
|
162
129
|
},
|
|
163
130
|
"./env/overlay": {
|
|
164
131
|
"import": {
|
|
165
|
-
"types": "./dist/env-overlay.d.
|
|
132
|
+
"types": "./dist/env-overlay.d.ts",
|
|
166
133
|
"default": "./dist/env-overlay.mjs"
|
|
167
|
-
},
|
|
168
|
-
"require": {
|
|
169
|
-
"types": "./dist/env-overlay.d.cts",
|
|
170
|
-
"default": "./dist/env-overlay.cjs"
|
|
171
134
|
}
|
|
172
135
|
}
|
|
173
136
|
},
|
|
@@ -190,7 +153,7 @@
|
|
|
190
153
|
"typescript"
|
|
191
154
|
],
|
|
192
155
|
"license": "BSD-3-Clause",
|
|
193
|
-
"main": "dist/index.
|
|
156
|
+
"main": "dist/index.mjs",
|
|
194
157
|
"name": "@karmaniverous/get-dotenv",
|
|
195
158
|
"peerDependencies": {
|
|
196
159
|
"esbuild": "*"
|
|
@@ -229,7 +192,8 @@
|
|
|
229
192
|
]
|
|
230
193
|
},
|
|
231
194
|
"npm": {
|
|
232
|
-
"publish":
|
|
195
|
+
"publish": false,
|
|
196
|
+
"skipChecks": true
|
|
233
197
|
}
|
|
234
198
|
},
|
|
235
199
|
"repository": {
|
|
@@ -248,7 +212,6 @@
|
|
|
248
212
|
"lint:fix": "eslint --fix . eslint.config.ts",
|
|
249
213
|
"release": "dotenvx run -f .env.local -- release-it",
|
|
250
214
|
"release:pre": "dotenvx run -f .env.local -- release-it --no-git.requireBranch --github.prerelease --preRelease",
|
|
251
|
-
"stan:docs": "typedoc --emit none",
|
|
252
215
|
"test": "vitest run",
|
|
253
216
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
254
217
|
"verify:types": "node tools/verify-types.js",
|
|
@@ -259,5 +222,5 @@
|
|
|
259
222
|
},
|
|
260
223
|
"type": "module",
|
|
261
224
|
"types": "dist/index.d.ts",
|
|
262
|
-
"version": "6.0.0
|
|
225
|
+
"version": "6.0.0"
|
|
263
226
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { createCli } from '@karmaniverous/get-dotenv/cli';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
awsPlugin,
|
|
7
|
+
awsWhoamiPlugin,
|
|
8
|
+
batchPlugin,
|
|
9
|
+
cmdPlugin,
|
|
10
|
+
initPlugin,
|
|
11
|
+
} from '@/src/plugins';
|
|
12
|
+
|
|
13
|
+
import { helloPlugin } from './plugins/hello';
|
|
14
|
+
|
|
15
|
+
await createCli({
|
|
16
|
+
alias: 'mycli',
|
|
17
|
+
compose: (program) =>
|
|
18
|
+
program
|
|
19
|
+
.use(
|
|
20
|
+
cmdPlugin({ asDefault: true, optionAlias: '-c, --cmd <command...>' }),
|
|
21
|
+
)
|
|
22
|
+
.use(batchPlugin())
|
|
23
|
+
.use(awsPlugin().use(awsWhoamiPlugin()))
|
|
24
|
+
.use(initPlugin())
|
|
25
|
+
.use(helloPlugin()),
|
|
26
|
+
})();
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {
|
|
2
|
+
definePlugin,
|
|
3
|
+
getRootCommand,
|
|
4
|
+
} from '@karmaniverous/get-dotenv/cliHost';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
|
|
7
|
+
const HelloConfigSchema = z.object({
|
|
8
|
+
loud: z.boolean().optional().default(false),
|
|
9
|
+
color: z.string().optional(),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const helloPlugin = () => {
|
|
13
|
+
const plugin = definePlugin({
|
|
14
|
+
ns: 'hello',
|
|
15
|
+
configSchema: HelloConfigSchema,
|
|
16
|
+
setup(cli) {
|
|
17
|
+
cli
|
|
18
|
+
.ns('hello')
|
|
19
|
+
.description('Say hello with current dotenv context')
|
|
20
|
+
.addOption(
|
|
21
|
+
plugin.createPluginDynamicOption(
|
|
22
|
+
cli,
|
|
23
|
+
'--loud',
|
|
24
|
+
(_bag, cfg) =>
|
|
25
|
+
`print greeting in ALL CAPS${cfg.loud ? ' (default)' : ''}`,
|
|
26
|
+
),
|
|
27
|
+
)
|
|
28
|
+
.action(() => {
|
|
29
|
+
const ctx = cli.getCtx();
|
|
30
|
+
// Derive CLI name from the true root command using a typed helper.
|
|
31
|
+
const rootName = getRootCommand(cli).name();
|
|
32
|
+
|
|
33
|
+
const cfg = plugin.readConfig(cli);
|
|
34
|
+
const keys = Object.keys(ctx.dotenv);
|
|
35
|
+
const label = cfg.loud
|
|
36
|
+
? `[${rootName}] DOTENV KEYS (${String(keys.length)}):`
|
|
37
|
+
: `[${rootName}] dotenv keys (${String(keys.length)}):`;
|
|
38
|
+
console.log(label, keys.join(', '));
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
return plugin;
|
|
43
|
+
};
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
// Help-time root defaults (example):
|
|
3
|
+
// rootOptionDefaults: {
|
|
4
|
+
// redact: true,
|
|
5
|
+
// // redactPatterns: ['API_KEY', 'SECRET'],
|
|
6
|
+
// },
|
|
7
|
+
// Help-time visibility (example): hide selected root flags in -h
|
|
8
|
+
// rootOptionVisibility: { capture: false },
|
|
9
|
+
|
|
5
10
|
vars: { APP_SETTING: 'app_value' },
|
|
6
11
|
envVars: { dev: { ENV_SETTING: 'dev_value' } },
|
|
7
12
|
dynamic: {
|
|
@@ -12,4 +17,4 @@ export default {
|
|
|
12
17
|
// provided, this returns an empty string.
|
|
13
18
|
ENV_TAG: (_vars, env) => (env ? `for-${env}` : ''),
|
|
14
19
|
},
|
|
15
|
-
};
|
|
20
|
+
};
|
|
@@ -1,7 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { defineGetDotenvConfig } from '@karmaniverous/get-dotenv/core';
|
|
2
|
+
|
|
3
|
+
type Vars = {
|
|
4
|
+
APP_SETTING?: string;
|
|
5
|
+
ENV_SETTING?: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export default defineGetDotenvConfig<Vars>({
|
|
9
|
+
// Help-time root defaults (example):
|
|
10
|
+
// rootOptionDefaults: {
|
|
11
|
+
// redact: true,
|
|
12
|
+
// // redactPatterns: ['API_KEY', 'SECRET'],
|
|
13
|
+
// },
|
|
14
|
+
// Help-time visibility (example): hide selected root flags in -h
|
|
15
|
+
// rootOptionVisibility: { capture: false },
|
|
16
|
+
|
|
5
17
|
vars: { APP_SETTING: 'app_value' },
|
|
6
18
|
envVars: { dev: { ENV_SETTING: 'dev_value' } },
|
|
7
19
|
dynamic: {
|
|
@@ -13,4 +25,4 @@ export default {
|
|
|
13
25
|
ENV_TAG: (_vars: Record<string, string | undefined>, env?: string) =>
|
|
14
26
|
env ? `for-${env}` : '',
|
|
15
27
|
},
|
|
16
|
-
};
|
|
28
|
+
});
|