@karmaniverous/get-dotenv 4.5.2 → 5.0.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.
Files changed (49) hide show
  1. package/LICENSE +28 -0
  2. package/README.md +369 -215
  3. package/dist/cliHost.cjs +1078 -0
  4. package/dist/cliHost.d.cts +193 -0
  5. package/dist/cliHost.d.mts +193 -0
  6. package/dist/cliHost.d.ts +193 -0
  7. package/dist/cliHost.mjs +1074 -0
  8. package/dist/config.cjs +247 -0
  9. package/dist/config.d.cts +53 -0
  10. package/dist/config.d.mts +53 -0
  11. package/dist/config.d.ts +53 -0
  12. package/dist/config.mjs +242 -0
  13. package/dist/env-overlay.cjs +163 -0
  14. package/dist/env-overlay.d.cts +50 -0
  15. package/dist/env-overlay.d.mts +50 -0
  16. package/dist/env-overlay.d.ts +50 -0
  17. package/dist/env-overlay.mjs +161 -0
  18. package/dist/getdotenv.cli.mjs +2817 -40874
  19. package/dist/index.cjs +1482 -40965
  20. package/dist/index.d.cts +206 -67
  21. package/dist/index.d.mts +206 -67
  22. package/dist/index.d.ts +206 -67
  23. package/dist/index.mjs +1454 -40939
  24. package/dist/plugins-aws.cjs +618 -0
  25. package/dist/plugins-aws.d.cts +178 -0
  26. package/dist/plugins-aws.d.mts +178 -0
  27. package/dist/plugins-aws.d.ts +178 -0
  28. package/dist/plugins-aws.mjs +616 -0
  29. package/dist/plugins-batch.cjs +569 -0
  30. package/dist/plugins-batch.d.cts +200 -0
  31. package/dist/plugins-batch.d.mts +200 -0
  32. package/dist/plugins-batch.d.ts +200 -0
  33. package/dist/plugins-batch.mjs +567 -0
  34. package/dist/plugins-init.cjs +282 -0
  35. package/dist/plugins-init.d.cts +182 -0
  36. package/dist/plugins-init.d.mts +182 -0
  37. package/dist/plugins-init.d.ts +182 -0
  38. package/dist/plugins-init.mjs +280 -0
  39. package/getdotenv.config.json +19 -0
  40. package/package.json +228 -139
  41. package/templates/cli/ts/index.ts +9 -0
  42. package/templates/cli/ts/plugins/hello.ts +17 -0
  43. package/templates/config/js/getdotenv.config.js +15 -0
  44. package/templates/config/json/local/getdotenv.config.local.json +7 -0
  45. package/templates/config/json/public/getdotenv.config.json +12 -0
  46. package/templates/config/public/getdotenv.config.json +13 -0
  47. package/templates/config/ts/getdotenv.config.ts +16 -0
  48. package/templates/config/yaml/local/getdotenv.config.local.yaml +7 -0
  49. package/templates/config/yaml/public/getdotenv.config.yaml +10 -0
package/package.json CHANGED
@@ -1,139 +1,228 @@
1
- {
2
- "author": "Jason Williscroft",
3
- "bin": {
4
- "getdotenv": "./dist/getdotenv.cli.mjs"
5
- },
6
- "bugs": {
7
- "url": "https://github.com/karmaniverous/get-dotenv/issues"
8
- },
9
- "dependencies": {
10
- "commander": "^12.1.0",
11
- "dotenv": "^16.4.5",
12
- "execa": "^9.3.0",
13
- "fs-extra": "^11.2.0",
14
- "globby": "<14",
15
- "lodash": "^4.17.21",
16
- "nanoid": "^5.0.7",
17
- "pkg-dir": "^8.0.0",
18
- "tslog": "^4.9.3"
19
- },
20
- "description": "Process dotenv files in an arbitrary location & optionally populate environment variables.",
21
- "devDependencies": {
22
- "@commander-js/extra-typings": "^12.1.0",
23
- "@eslint/js": "^9.7.0",
24
- "@rollup/plugin-alias": "^5.1.0",
25
- "@rollup/plugin-commonjs": "^26.0.1",
26
- "@rollup/plugin-json": "^6.1.0",
27
- "@rollup/plugin-node-resolve": "^15.2.3",
28
- "@rollup/plugin-terser": "^0.4.4",
29
- "@rollup/plugin-typescript": "^11.1.6",
30
- "@types/chai": "^4.3.16",
31
- "@types/eslint__js": "^8.42.3",
32
- "@types/eslint-config-prettier": "^6.11.3",
33
- "@types/eslint-plugin-mocha": "^10.4.0",
34
- "@types/fs-extra": "^11.0.4",
35
- "@types/lodash": "^4.17.7",
36
- "@types/mocha": "^10.0.7",
37
- "@types/node": "^20.14.11",
38
- "auto-changelog": "^2.4.0",
39
- "chai": "^5.1.1",
40
- "cross-env": "^7.0.3",
41
- "eslint": "^8.57.0",
42
- "eslint-config-prettier": "^9.1.0",
43
- "eslint-plugin-mocha": "^10.4.3",
44
- "eslint-plugin-simple-import-sort": "^12.1.1",
45
- "eslint-plugin-tsdoc": "^0.2.17",
46
- "fs-extra": "^11.2.0",
47
- "jsdom-global": "^3.0.2",
48
- "knip": "^5.26.0",
49
- "lefthook": "^1.7.2",
50
- "mocha": "^10.6.0",
51
- "nyc": "^17.0.0",
52
- "prettier": "^3.3.3",
53
- "release-it": "^17.6.0",
54
- "rimraf": "^5.0.9",
55
- "rollup": "^4.18.1",
56
- "rollup-plugin-dts": "^6.1.1",
57
- "source-map-support": "^0.5.21",
58
- "ts-node": "^10.9.2",
59
- "tslib": "^2.6.3",
60
- "typescript": "^5.5.3",
61
- "typescript-eslint": "^7.16.1"
62
- },
63
- "exports": {
64
- ".": {
65
- "import": {
66
- "types": "./dist/index.d.mts",
67
- "default": "./dist/index.mjs"
68
- },
69
- "require": {
70
- "types": "./dist/index.d.cts",
71
- "default": "./dist/index.cjs"
72
- }
73
- }
74
- },
75
- "files": [
76
- "dist"
77
- ],
78
- "homepage": "https://github.com/karmaniverous/get-dotenv#readme",
79
- "keywords": [
80
- "cli",
81
- "configuration",
82
- "developer-tools",
83
- "development-environment",
84
- "devops",
85
- "dotenv-management",
86
- "environment-variables",
87
- "json",
88
- "nodejs",
89
- "typescript"
90
- ],
91
- "license": "BSD-3-Clause",
92
- "main": "./lib/index.js",
93
- "name": "@karmaniverous/get-dotenv",
94
- "publishConfig": {
95
- "access": "public"
96
- },
97
- "release-it": {
98
- "git": {
99
- "changelog": "npx auto-changelog --stdout --commit-limit false -u --template https://raw.githubusercontent.com/release-it/release-it/main/templates/changelog-compact.hbs",
100
- "commitMessage": "chore: release v${version}",
101
- "requireBranch": "main"
102
- },
103
- "github": {
104
- "release": true
105
- },
106
- "hooks": {
107
- "after:init": [
108
- "npm run lint",
109
- "npm run test",
110
- "npm run build"
111
- ],
112
- "after:release": [
113
- "git switch -c release/${version}",
114
- "git push -u origin release/${version}",
115
- "git switch ${branchName}"
116
- ]
117
- },
118
- "npm": {
119
- "publish": true
120
- }
121
- },
122
- "repository": {
123
- "type": "git",
124
- "url": "https://github.com/karmaniverous/get-dotenv"
125
- },
126
- "scripts": {
127
- "build": "rimraf dist && rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript",
128
- "cli": "node dist/getdotenv.cli.mjs",
129
- "knip": "knip",
130
- "lint": "eslint src/** && prettier -c src",
131
- "lint:fix": "eslint --fix src/** && prettier --write src",
132
- "release": "release-it",
133
- "release:pre": "vc -c \"release-it --no-git.requireBranch --github.prerelease --preRelease\"",
134
- "test": "cross-env LOG_LEVEL=debug nyc mocha"
135
- },
136
- "type": "module",
137
- "types": "dist/index.d.ts",
138
- "version": "4.5.2"
139
- }
1
+ {
2
+ "author": "Jason Williscroft",
3
+ "auto-changelog": {
4
+ "output": "CHANGELOG.md",
5
+ "unreleased": true,
6
+ "commitLimit": false,
7
+ "hideCredit": true
8
+ },
9
+ "bin": {
10
+ "getdotenv": "./dist/getdotenv.cli.mjs"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/karmaniverous/get-dotenv/issues"
14
+ },
15
+ "dependencies": {
16
+ "commander": "^14.0.1",
17
+ "dotenv": "^17.2.2",
18
+ "execa": "^9.6.0",
19
+ "fs-extra": "^11.3.2",
20
+ "globby": "^14",
21
+ "nanoid": "^5.1.5",
22
+ "package-directory": "^8.1.0",
23
+ "yaml": "^2.8.1",
24
+ "zod": "^4.1.9"
25
+ },
26
+ "description": "Process dotenv files in an arbitrary location & optionally populate environment variables.",
27
+ "devDependencies": {
28
+ "@dotenvx/dotenvx": "^1.50.1",
29
+ "@eslint/js": "^9.36.0",
30
+ "@rollup/plugin-alias": "^5.1.1",
31
+ "@rollup/plugin-commonjs": "^28.0.6",
32
+ "@rollup/plugin-json": "^6.1.0",
33
+ "@rollup/plugin-node-resolve": "^16.0.1",
34
+ "@rollup/plugin-typescript": "^12.1.4",
35
+ "@types/fs-extra": "^11.0.4",
36
+ "@types/node": "^22",
37
+ "@vitest/eslint-plugin": "^1.3.6",
38
+ "@vitest/coverage-v8": "^3.2.4",
39
+ "auto-changelog": "^2.5.0",
40
+ "esbuild": "^0.25.10",
41
+ "eslint": "^9.36.0",
42
+ "eslint-config-prettier": "^10.1.8",
43
+ "eslint-plugin-jsonc": "^2.20.1",
44
+ "eslint-plugin-prettier": "^5.5.4",
45
+ "eslint-plugin-simple-import-sort": "^12.1.1",
46
+ "eslint-plugin-tsdoc": "^0.4.0",
47
+ "fs-extra": "^11.3.2",
48
+ "globals": "^16.4.0",
49
+ "jsonc-eslint-parser": "^2.4.0",
50
+ "knip": "^5.63.1",
51
+ "npm-packlist": "^10.0.1",
52
+ "lefthook": "^1.13.1",
53
+ "prettier": "^3.6.2",
54
+ "release-it": "^19.0.5",
55
+ "rimraf": "^6.0.1",
56
+ "rollup": "^4.52.0",
57
+ "rollup-plugin-dts": "^6.2.3",
58
+ "tslib": "^2.8.1",
59
+ "tsx": "^4.20.5",
60
+ "typedoc": "^0.28.13",
61
+ "typedoc-plugin-mdn-links": "^5.0.9",
62
+ "typedoc-plugin-replace-text": "^4.2.0",
63
+ "typescript": "^5.9.2",
64
+ "typescript-eslint": "^8.44.0",
65
+ "vite-tsconfig-paths": "^5.1.4",
66
+ "vitest": "^3.2.4"
67
+ },
68
+ "engines": {
69
+ "node": ">=20"
70
+ },
71
+ "exports": {
72
+ ".": {
73
+ "import": {
74
+ "types": "./dist/index.d.mts",
75
+ "default": "./dist/index.mjs"
76
+ },
77
+ "require": {
78
+ "types": "./dist/index.d.cts",
79
+ "default": "./dist/index.cjs"
80
+ }
81
+ },
82
+ "./cliHost": {
83
+ "import": {
84
+ "types": "./dist/cliHost.d.mts",
85
+ "default": "./dist/cliHost.mjs"
86
+ },
87
+ "require": {
88
+ "types": "./dist/cliHost.d.cts",
89
+ "default": "./dist/cliHost.cjs"
90
+ }
91
+ },
92
+ "./plugins/aws": {
93
+ "import": {
94
+ "types": "./dist/plugins-aws.d.mts",
95
+ "default": "./dist/plugins-aws.mjs"
96
+ },
97
+ "require": {
98
+ "types": "./dist/plugins-aws.d.cts",
99
+ "default": "./dist/plugins-aws.cjs"
100
+ }
101
+ },
102
+ "./plugins/batch": {
103
+ "import": {
104
+ "types": "./dist/plugins-batch.d.mts",
105
+ "default": "./dist/plugins-batch.mjs"
106
+ },
107
+ "require": {
108
+ "types": "./dist/plugins-batch.d.cts",
109
+ "default": "./dist/plugins-batch.cjs"
110
+ }
111
+ },
112
+ "./plugins/init": {
113
+ "import": {
114
+ "types": "./dist/plugins-init.d.mts",
115
+ "default": "./dist/plugins-init.mjs"
116
+ },
117
+ "require": {
118
+ "types": "./dist/plugins-init.d.cts",
119
+ "default": "./dist/plugins-init.cjs"
120
+ }
121
+ },
122
+ "./config": {
123
+ "import": {
124
+ "types": "./dist/config.d.mts",
125
+ "default": "./dist/config.mjs"
126
+ },
127
+ "require": {
128
+ "types": "./dist/config.d.cts",
129
+ "default": "./dist/config.cjs"
130
+ }
131
+ },
132
+ "./env/overlay": {
133
+ "import": {
134
+ "types": "./dist/env-overlay.d.mts",
135
+ "default": "./dist/env-overlay.mjs"
136
+ },
137
+ "require": {
138
+ "types": "./dist/env-overlay.d.cts",
139
+ "default": "./dist/env-overlay.cjs"
140
+ }
141
+ }
142
+ },
143
+ "files": [
144
+ "dist",
145
+ "getdotenv.config.json",
146
+ "templates"
147
+ ],
148
+ "homepage": "https://github.com/karmaniverous/get-dotenv#readme",
149
+ "keywords": [
150
+ "cli",
151
+ "configuration",
152
+ "developer-tools",
153
+ "development-environment",
154
+ "devops",
155
+ "dotenv-management",
156
+ "environment-variables",
157
+ "json",
158
+ "nodejs",
159
+ "typescript"
160
+ ],
161
+ "license": "BSD-3-Clause",
162
+ "main": "dist/index.cjs",
163
+ "name": "@karmaniverous/get-dotenv",
164
+ "peerDependencies": {
165
+ "esbuild": "*"
166
+ },
167
+ "peerDependenciesMeta": {
168
+ "esbuild": {
169
+ "optional": true
170
+ }
171
+ },
172
+ "publishConfig": {
173
+ "access": "public"
174
+ },
175
+ "release-it": {
176
+ "git": {
177
+ "changelog": "npx auto-changelog --stdout --template https://raw.githubusercontent.com/release-it/release-it/main/templates/changelog-compact.hbs",
178
+ "commitMessage": "chore: release v${version}",
179
+ "requireBranch": "main"
180
+ },
181
+ "github": {
182
+ "release": true
183
+ },
184
+ "hooks": {
185
+ "after:init": [
186
+ "npm run lint",
187
+ "npm run test",
188
+ "npm run build",
189
+ "npm run verify:package",
190
+ "npm run verify:tarball"
191
+ ],
192
+ "after:release": [
193
+ "git switch -c release/${version}",
194
+ "git push -u origin release/${version}",
195
+ "git switch ${branchName}"
196
+ ]
197
+ },
198
+ "npm": {
199
+ "publish": true
200
+ }
201
+ },
202
+ "repository": {
203
+ "type": "git",
204
+ "url": "https://github.com/karmaniverous/get-dotenv"
205
+ },
206
+ "scripts": {
207
+ "build": "rimraf dist && rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript",
208
+ "cli": "tsx src/cli/getdotenv",
209
+ "cli:dist": "node dist/getdotenv.cli.mjs",
210
+ "changelog": "auto-changelog",
211
+ "docs": "typedoc",
212
+ "pack:dry": "npm pack --dry-run",
213
+ "knip": "knip",
214
+ "lint": "eslint . eslint.config.ts",
215
+ "lint:fix": "eslint --fix . eslint.config.ts",
216
+ "release": "dotenvx run -f .env.local -- release-it",
217
+ "release:pre": "dotenvx run -f .env.local -- release-it --no-git.requireBranch --github.prerelease --preRelease",
218
+ "stan:docs": "typedoc --emit none",
219
+ "test": "vitest run --coverage",
220
+ "typecheck": "tsc -p tsconfig.json --noEmit",
221
+ "verify:package": "node tools/verify-package.js",
222
+ "verify:smoke": "node tools/smoke.js",
223
+ "verify:tarball": "node tools/verify-tarball.js"
224
+ },
225
+ "type": "module",
226
+ "types": "dist/index.d.ts",
227
+ "version": "5.0.0-0"
228
+ }
@@ -0,0 +1,9 @@
1
+ import { GetDotenvCli } from '@karmaniverous/get-dotenv/cliHost';
2
+ import type { Command } from 'commander';
3
+
4
+ import { helloPlugin } from './plugins/hello';
5
+
6
+ const program: Command = new GetDotenvCli('__CLI_NAME__').use(helloPlugin());
7
+
8
+ await (program as unknown as GetDotenvCli).resolveAndLoad();
9
+ await program.parseAsync();
@@ -0,0 +1,17 @@
1
+ import { definePlugin } from '@karmaniverous/get-dotenv/cliHost';
2
+
3
+ export const helloPlugin = () =>
4
+ definePlugin({
5
+ id: 'hello',
6
+ setup(cli) {
7
+ cli
8
+ .ns('hello')
9
+ .description('Say hello with current dotenv context')
10
+ .action(async () => {
11
+ const ctx = cli.getCtx?.();
12
+ const name = '__CLI_NAME__';
13
+
14
+ console.log(`[${name}] dotenv keys:`, Object.keys(ctx?.dotenv ?? {}));
15
+ });
16
+ },
17
+ });
@@ -0,0 +1,15 @@
1
+ export default {
2
+ dotenvToken: '.env',
3
+ privateToken: 'local',
4
+ paths: './',
5
+ vars: { APP_SETTING: 'app_value' },
6
+ envVars: { dev: { ENV_SETTING: 'dev_value' } },
7
+ dynamic: {
8
+ GREETING: ({ APP_SETTING = '' }) => `Hello ${APP_SETTING}`,
9
+ // Example: env-aware dynamic value. The second argument receives the
10
+ // selected environment (if any); tailor behavior per environment.
11
+ // For example, with env='dev' this yields "for-dev"; when env is not
12
+ // provided, this returns an empty string.
13
+ ENV_TAG: (_vars, env) => (env ? `for-${env}` : ''),
14
+ },
15
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "vars": { "APP_SECRET": "secret_value" },
3
+ "envVars": {
4
+ "dev": { "ENV_SECRET": "dev_secret" },
5
+ "test": { "ENV_SECRET": "test_secret" }
6
+ }
7
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "dotenvToken": ".env",
3
+ "privateToken": "local",
4
+ "paths": "./",
5
+ "vars": {
6
+ "APP_SETTING": "app_value"
7
+ },
8
+ "envVars": {
9
+ "dev": { "ENV_SETTING": "dev_value" },
10
+ "test": { "ENV_SETTING": "test_value" }
11
+ }
12
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "dotenvToken": ".env",
3
+ "privateToken": "local",
4
+ "paths": "./",
5
+ "loadProcess": true,
6
+ "log": false,
7
+ "vars": {
8
+ "APP_NAME": "my-app"
9
+ },
10
+ "envVars": {
11
+ "dev": { "DEV_ONLY": "1" }
12
+ }
13
+ }
@@ -0,0 +1,16 @@
1
+ export default {
2
+ dotenvToken: '.env',
3
+ privateToken: 'local',
4
+ paths: './',
5
+ vars: { APP_SETTING: 'app_value' },
6
+ envVars: { dev: { ENV_SETTING: 'dev_value' } },
7
+ dynamic: {
8
+ GREETING: ({ APP_SETTING = '' }) => `${APP_SETTING}-ts`,
9
+ // Example: env-aware dynamic value. The second argument receives the
10
+ // selected environment (if any); tailor behavior per environment.
11
+ // For example, with env='dev' this yields "for-dev"; when env is not
12
+ // provided, this returns an empty string.
13
+ ENV_TAG: (_vars: Record<string, string | undefined>, env?: string) =>
14
+ env ? `for-${env}` : '',
15
+ },
16
+ };
@@ -0,0 +1,7 @@
1
+ vars:
2
+ APP_SECRET: "secret_value"
3
+ envVars:
4
+ dev:
5
+ ENV_SECRET: "dev_secret"
6
+ test:
7
+ ENV_SECRET: "test_secret"
@@ -0,0 +1,10 @@
1
+ dotenvToken: ".env"
2
+ privateToken: "local"
3
+ paths: "./"
4
+ vars:
5
+ APP_SETTING: "app_value"
6
+ envVars:
7
+ dev:
8
+ ENV_SETTING: "dev_value"
9
+ test:
10
+ ENV_SETTING: "test_value"