@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.
- package/LICENSE +28 -0
- package/README.md +369 -215
- package/dist/cliHost.cjs +1078 -0
- package/dist/cliHost.d.cts +193 -0
- package/dist/cliHost.d.mts +193 -0
- package/dist/cliHost.d.ts +193 -0
- package/dist/cliHost.mjs +1074 -0
- package/dist/config.cjs +247 -0
- package/dist/config.d.cts +53 -0
- package/dist/config.d.mts +53 -0
- package/dist/config.d.ts +53 -0
- package/dist/config.mjs +242 -0
- package/dist/env-overlay.cjs +163 -0
- package/dist/env-overlay.d.cts +50 -0
- package/dist/env-overlay.d.mts +50 -0
- package/dist/env-overlay.d.ts +50 -0
- package/dist/env-overlay.mjs +161 -0
- package/dist/getdotenv.cli.mjs +2817 -40874
- package/dist/index.cjs +1482 -40965
- package/dist/index.d.cts +206 -67
- package/dist/index.d.mts +206 -67
- package/dist/index.d.ts +206 -67
- package/dist/index.mjs +1454 -40939
- package/dist/plugins-aws.cjs +618 -0
- package/dist/plugins-aws.d.cts +178 -0
- package/dist/plugins-aws.d.mts +178 -0
- package/dist/plugins-aws.d.ts +178 -0
- package/dist/plugins-aws.mjs +616 -0
- package/dist/plugins-batch.cjs +569 -0
- package/dist/plugins-batch.d.cts +200 -0
- package/dist/plugins-batch.d.mts +200 -0
- package/dist/plugins-batch.d.ts +200 -0
- package/dist/plugins-batch.mjs +567 -0
- package/dist/plugins-init.cjs +282 -0
- package/dist/plugins-init.d.cts +182 -0
- package/dist/plugins-init.d.mts +182 -0
- package/dist/plugins-init.d.ts +182 -0
- package/dist/plugins-init.mjs +280 -0
- package/getdotenv.config.json +19 -0
- package/package.json +228 -139
- package/templates/cli/ts/index.ts +9 -0
- package/templates/cli/ts/plugins/hello.ts +17 -0
- package/templates/config/js/getdotenv.config.js +15 -0
- package/templates/config/json/local/getdotenv.config.local.json +7 -0
- package/templates/config/json/public/getdotenv.config.json +12 -0
- package/templates/config/public/getdotenv.config.json +13 -0
- package/templates/config/ts/getdotenv.config.ts +16 -0
- package/templates/config/yaml/local/getdotenv.config.local.yaml +7 -0
- package/templates/config/yaml/public/getdotenv.config.yaml +10 -0
package/package.json
CHANGED
|
@@ -1,139 +1,228 @@
|
|
|
1
|
-
{
|
|
2
|
-
"author": "Jason Williscroft",
|
|
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
|
-
"@types/
|
|
36
|
-
"@types/
|
|
37
|
-
"@
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"eslint": "^
|
|
42
|
-
"eslint-config-prettier": "^
|
|
43
|
-
"eslint-plugin-
|
|
44
|
-
"eslint-plugin-
|
|
45
|
-
"eslint-plugin-
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"rollup
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
"
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
"
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
"
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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,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
|
+
};
|