@dotenvx/dotenvx 0.3.9 → 0.4.12

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 ADDED
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2024, Scott Motte
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md CHANGED
@@ -1,302 +1,281 @@
1
- ![dotenvx](https://dotenvx.com/better-banner.png)
1
+ # dotenvx Node.js SDK
2
2
 
3
- *a better dotenv*–from the creator of [`dotenv`](https://github.com/motdotla/dotenv).
3
+ The Node.js adapter for Forge's shared Rust `dotenvx-sdk`. Parsing, expansion,
4
+ decryption, source selection, custody delegation, and Dotenvx.toml policy use
5
+ the same engine as Ruby and Python. JavaScript owns the public API, environment
6
+ updates, diagnostics, and output interception.
4
7
 
5
- * run anywhere (cross-platform)
6
- * multi-environment
7
- * encrypted envs
8
+ ## Local development
8
9
 
9
-  
10
-
11
-
12
- ### Quickstart
13
-
14
- ```sh
15
- brew install dotenvx/brew/dotenvx
16
- ```
17
- > * [other ways to install](#other-ways-to-install)
18
-
19
-  
20
-
21
- ## Run Anywhere
22
-
23
- ```sh
24
- $ echo "HELLO=World" > .env && echo "console.log('Hello ' + process.env.HELLO)" > index.js
25
-
26
- $ node index.js
27
- Hello undefined
28
-
29
- $ dotenvx run -- node index.js
30
- Hello World
31
- > :-D
32
- ```
33
-
34
- More examples
35
-
36
- * <details><summary>Python 🐍</summary><br>
37
-
38
- ```sh
39
- $ echo 'import os;print("Hello " + os.getenv("HELLO", ""))' > index.py
40
-
41
- $ dotenvx run -- python3 index.py
42
- Hello World
43
- ```
44
-
45
- </details>
46
- * <details><summary>PHP 🐘</summary><br>
47
-
48
- ```sh
49
- $ echo '<?php echo "Hello {$_SERVER["HELLO"]}\n";' > index.php
50
-
51
- $ dotenvx run -- php index.php
52
- Hello World
53
- ```
54
-
55
- </details>
56
- * <details><summary>Ruby 💎</summary><br>
57
-
58
- ```sh
59
- $ echo 'puts "Hello #{ENV["HELLO"]}"' > index.rb
60
-
61
- $ dotenvx run -- ruby index.rb
62
- Hello World
63
- ```
64
-
65
- </details>
66
- * <details><summary>Rust 🦀</summary><br>
67
-
68
- ```sh
69
- $ echo 'fn main() {let hello = std::env::var("HELLO").unwrap_or("".to_string());println!("Hello {hello}");}' > src/main.rs
70
-
71
- $ dotenvx run -- cargo run
72
- Hello World
73
- ```
74
-
75
- </details>
76
- * <details><summary>Frameworks ▲</summary><br>
77
-
78
- ```sh
79
- $ dotenvx run -- next dev
80
- $ dotenvx run -- npm start
81
- $ dotenvx run -- bin/rails s
82
- $ dotenvx run -- php artisan serve
83
- ```
84
-
85
- </details>
86
- * <details><summary>Docker 🐳</summary><br>
87
-
88
- ```sh
89
- $ docker run -it --rm -v $(pwd):/app dotenv/dotenvx run -- node index.js
90
- ```
91
-
92
- Or in any image:
93
-
94
- ```sh
95
- FROM node:latest
96
- RUN echo "HELLO=World" > .env && echo "console.log('Hello ' + process.env.HELLO)" > index.js
97
- RUN curl -fsS https://dotenvx.sh/ | sh
98
- CMD ["dotenvx", "run", "--", "echo", "Hello $HELLO"]
99
- ```
100
-
101
- </details>
102
-
103
- * <details><summary>CI/CDs 🐙</summary><br>
104
-
105
- ```sh
106
- examples coming soon
107
- ```
108
-
109
- </details>
110
- * <details><summary>Platforms</summary><br>
111
-
112
- ```sh
113
- examples coming soon
114
- ```
115
-
116
- </details>
117
- * <details><summary>npx</summary><br>
118
-
119
- ```sh
120
- # alternatively use npx
121
- $ npx @dotenvx/dotenvx run -- node index.js
122
- $ npx @dotenvx/dotenvx run -- next dev
123
- $ npx @dotenvx/dotenvx run -- npm start
124
- ```
125
-
126
- </details>
127
- * <details><summary>Git</summary><br>
128
-
129
- ```sh
130
- # use as a git submodule
131
- $ git dotenvx run -- node index.js
132
- $ git dotenvx run -- next dev
133
- $ git dotenvx run -- npm start
134
- ```
135
-
136
- </details>
137
-
138
- &nbsp;
139
-
140
- ## Multiple Environments
141
-
142
- Pass the `--env-file` flag (shorthand `-f`) to run any environment from a `.env.environment` file.
10
+ From Forge with Node.js 20+ and a Rust toolchain installed:
143
11
 
144
12
  ```sh
145
- $ dotenvx run --env-file=.env.production -- node index.js
146
- [dotenvx][INFO] Injecting 12 production environment variables into your application process
147
- ```
148
-
149
- Combine multiple `.env` files if you like.
150
-
151
- ```
152
- $ dotenvx run --env-file=.env.local --env-file=.env -- node index.js
153
- [dotenvx][INFO] Injecting 12 local, 1 development environment variables into your application process
13
+ npm run build:dotenvx-nodejs
14
+ npm run test:dotenvx-nodejs
154
15
  ```
155
16
 
156
- &nbsp;
17
+ To install the local prototype in another project, pack and install the main
18
+ and matching platform packages together as described below.
157
19
 
158
- ## Encrypt Your Env Files
159
-
160
- WIP
161
-
162
- &nbsp;
20
+ The package keeps the `@dotenvx/dotenvx` name and uses normal `0.4.x` versions
21
+ published under `next`. Install a specific version with
22
+ `npm install @dotenvx/dotenvx@0.4.11`, or follow Forge releases with
23
+ `npm install @dotenvx/dotenvx@next`. Unqualified installs continue to use `latest`.
24
+ There are no install-time downloads or compilation hooks. A local build writes
25
+ the current platform’s addon and default CLI to `native/` and prepares its npm
26
+ package under `dist/npm/`. The main npm package contains JavaScript only; native
27
+ files are delivered through exact-version optional platform dependencies.
163
28
 
164
29
  ## Usage
165
30
 
166
- ### Guide
167
-
168
- Begin by creating a simple 'hello world' program.
169
-
170
31
  ```js
171
- // index.js
172
- console.log(`Hello ${process.env.HELLO}`)
32
+ const dotenvx = require('@dotenvx/dotenvx')
33
+ const result = dotenvx.config()
34
+ console.log(process.env.HELLO)
173
35
  ```
174
36
 
175
- Run it.
37
+ ES modules support named and default imports:
176
38
 
177
39
  ```js
178
- $ node index.js
179
- Hello undefined
180
- ```
181
-
182
- Run it with `dotenvx`.
183
-
184
- ```sh
185
- $ dotenvx run -- node index.js
186
- [dotenvx@x.x.x][WARN] ENOENT: no such file or directory, open '/../../.env'
187
- Hello undefined
188
- ```
189
-
190
- It warns you when there is no `.env` file (pass the `--quiet` flag to suppress these warnings).
191
-
192
- Create the `.env` file.
193
-
194
- ```ini
195
- # env
196
- JELLO="World"
40
+ import dotenvx, { config } from '@dotenvx/dotenvx'
41
+ config({ path: '.env.production', strict: true })
197
42
  ```
198
43
 
199
- Run it again.
44
+ Preload before application modules execute:
200
45
 
201
46
  ```sh
202
- $ dotenvx run -- node index.js
203
- [dotenvx@x.x.x][INFO] Injecting 0 environment variables into your application process
204
- Hello undefined
47
+ node --require @dotenvx/dotenvx/config app.cjs
48
+ node --import @dotenvx/dotenvx/config app.mjs
205
49
  ```
206
50
 
207
- Hrm, still undefined. Pass the `--debug` flag to debug the issue. I'll give you a hint: 🍮
51
+ `import '@dotenvx/dotenvx/config'` also works. `DOTENV_CONFIG_PATH` selects a
52
+ preload file when `DOTENV_FILE` / `DOTENV_PATH` are absent. Quiet mode accepts
53
+ `DOTENV_QUIET` and the legacy `DOTENV_CONFIG_QUIET`.
54
+
55
+ ## Core API
56
+
57
+ - `config(options)` synchronously resolves values and populates `process.env`,
58
+ returning `{ parsed, error? }`. `processEnv` selects a different environment
59
+ object to read and populate. Existing values win unless `overload` / `override`
60
+ is enabled. Strict or fatal errors throw before any resolved values are injected.
61
+ - `parse(stringOrBuffer, options)` uses Rust primitives without filesystem,
62
+ policy, or custody lookups. It expands values and decrypts using supplied
63
+ environment keys or `privateKey`, without changing the supplied environment.
64
+ - `get(key?, options)` resolves synchronously and returns the value directly.
65
+ `getSync` is an alias of the same function (`getSync === get`). Neither mutates
66
+ the environment. Calls block while reading files or resolving custody, and
67
+ failures throw synchronously. `await get(...)` still works with the returned
68
+ value; Promise methods such as `.then()` and `.catch()` are not supported.
69
+ With no key, they return the resolved object; `all: true` includes existing
70
+ environment values. `format` supports `eval`, `eval-export`, `shell`, and `colon`.
71
+
72
+ Files can be paths, file URLs, arrays, or directories. `envs` selects ordered
73
+ `{ type: 'envFile', value: path }` and `{ type: 'env', value: source }` inputs.
74
+ Explicit `envs` override `path`. `envKeysFile` / `keyFiles`
75
+ select private-key files. Conventions and implicit discovery are resolved in Rust.
76
+ This prototype supports UTF-8 files and includes TypeScript declarations.
77
+
78
+ Local `.env.keys` and environment private keys work without the CLI. Stored-key
79
+ custody uses `dotenvx sdk keyring` on PATH, like the other language SDKs. The CLI
80
+ needs `sdk` and the requested custody feature. Keys returned by the CLI remain
81
+ in the internal keyring and are not injected into the application's environment.
82
+ When using a custom `processEnv`, include the PATH and provider settings it needs.
83
+ Secret reference resolution is opt-in with `resolveReferences: true`.
84
+
85
+ Dotenvx.toml redaction is installed before diagnostics and injection. Console
86
+ output and stream writes are protected, including secrets split between writes.
87
+
88
+ ## npm CLI
89
+
90
+ The matching optional platform package includes a default Rust CLI executable
91
+ alongside the SDK addon. The
92
+ npm launcher first looks for an installed standalone `dotenvx` on PATH, then
93
+ falls back to the bundled default CLI. An existing Armor or custom build is used
94
+ automatically, with its commands and features preserved. No separate curl
95
+ installation or install-time download is required for the bundled default.
208
96
 
209
97
  ```sh
210
- $ dotenvx run --debug -- node index.js
211
- [dotenvx@x.x.x][VERBOSE] Loading env from /../../.env
212
- [dotenvx@x.x.x][DEBUG] Reading env from /../../.env
213
- [dotenvx@x.x.x][DEBUG] Parsing env from /../../.env
214
- [dotenvx@x.x.x][DEBUG] {"JELLO":"World"}
215
-
216
- # Oops, HELLO not JELLO ^^
217
- ```
218
-
219
- Fix your `.env` file.
220
-
221
- ```ini
222
- # .env
223
- HELLO="World"
98
+ npx dotenvx encrypt
99
+ npx dotenvx run -- node app.cjs
224
100
  ```
225
101
 
226
- One last time. [Le tired](https://youtu.be/kCpjgl2baLs?t=45).
102
+ Existing npm scripts such as `"start": "dotenvx run -- node app.cjs"` use the same
103
+ launcher, which forwards arguments, terminal input/output, exit status, and
104
+ termination signals without interpreting commands. The bundled CLI uses the
105
+ default feature set from Forge's CLI catalog. Command behavior follows the
106
+ selected Rust CLI rather than the former JavaScript CLI. `dotenvx --version`
107
+ reports the selected CLI's version; the prototype SDK and CLI currently have
108
+ separate version numbers.
109
+
110
+ PATH discovery skips script wrappers, including npm's own shims and older
111
+ JavaScript dotenvx CLIs, to avoid recursion. It selects the first executable
112
+ native binary named `dotenvx` (`dotenvx.exe` on Windows). The launcher does not
113
+ fall back if that installed CLI rejects a command or exits with an error.
114
+ Installing or updating a standalone CLI therefore changes what `npx dotenvx`
115
+ runs, even if the npm dependency is pinned.
116
+
117
+ Optionally, `DOTENVX_CLI` selects an explicit executable path ahead of PATH
118
+ discovery. No override is needed for Armor or custom builds on PATH. This setting
119
+ selects both the npm CLI executable and the SDK's delegated custody executable.
120
+ SDK custody uses the same standalone-binary discovery and packaged fallback as
121
+ the launcher, so it also works without a global CLI on PATH.
122
+
123
+ Decryption first checks matching environment private keys, then configured local
124
+ key files (including `.env.keys`), then the custodian named in the public-key
125
+ header. `armor pull` leaves the Armor custody metadata in place, but the pulled
126
+ matching local key can decrypt without a remote lookup. `armor down` additionally
127
+ removes remote custody and updates the header; local fallback does neither.
128
+
129
+ ## Migrating from 2.x
130
+
131
+ The [central dotenvx 3.0 breaking-changes list](../README.md#dotenvx-30-breaking-changes)
132
+ records the removed SDK APIs (`set`, `ls`, `withEvents`, and public logging/color
133
+ helpers), migration guidance, and the decision to defer shared SDK event tracking.
134
+
135
+ ## Platform packages and releases
136
+
137
+ Forge publishes these packages at the same version as `@dotenvx/dotenvx`:
138
+
139
+ | Runtime | Package |
140
+ | --- | --- |
141
+ | macOS ARM64 | `@dotenvx/dotenvx-darwin-arm64` |
142
+ | macOS x64 | `@dotenvx/dotenvx-darwin-x86_64` |
143
+ | Linux glibc ARM64 | `@dotenvx/dotenvx-linux-arm64` |
144
+ | Linux glibc x64 | `@dotenvx/dotenvx-linux-x86_64` |
145
+ | Linux musl ARM64 | `@dotenvx/dotenvx-linux-arm64-musl` |
146
+ | Linux musl x64 | `@dotenvx/dotenvx-linux-x86_64-musl` |
147
+ | Windows ARM64 | `@dotenvx/dotenvx-windows-arm64` |
148
+ | Windows x64 | `@dotenvx/dotenvx-windows-x86_64` |
149
+
150
+ Each package contains `dotenvx.node` and `dotenvx` (`dotenvx.exe` on Windows),
151
+ with `os`, `cpu`, and Linux `libc` filters. Existing binary package names are
152
+ reused; historical architecture aliases such as `amd64` are not additional SDK
153
+ dependencies. Linux glibc builds target glibc 2.28 or newer. Alpine uses separate
154
+ musl builds. The loader has no JavaScript fallback.
155
+
156
+ Do not omit optional dependencies when using the SDK. If they are omitted,
157
+ CLI commands can still use an installed standalone CLI, but SDK loading fails
158
+ with a reinstall hint. Local development can use the current platform's files
159
+ in `native/`; those files are excluded from the main npm tarball.
160
+
161
+ For a local packaged install, build and pack both packages, then install the two
162
+ resulting tarballs together. Unpublished optional packages for other platforms
163
+ can be skipped with npm's `--offline` flag:
227
164
 
228
165
  ```sh
229
- $ dotenvx run -- node index.js
230
- [dotenvx@x.x.x][INFO] Injecting 1 environment variable into your application process
231
- Hello World
166
+ npm run build:dotenvx-nodejs
167
+ npm pack ./dotenvx-nodejs/dist/npm/dotenvx-darwin-arm64 --ignore-scripts
168
+ npm pack ./dotenvx-nodejs --ignore-scripts
169
+ npm install --offline ./dotenvx-dotenvx-0.4.11.tgz ./dotenvx-dotenvx-darwin-arm64-0.4.11.tgz
232
170
  ```
233
171
 
234
- 🎉 It worked!
235
-
236
- &nbsp;
172
+ Substitute the current platform package and version. A direct local directory
173
+ install alone does not assemble optional packages for the consuming project.
237
174
 
175
+ `.github/workflows/nodejs.yml` builds and tests all eight native targets.
176
+ Pushing a matching `nodejs-v<version>` tag publishes the eight platform packages
177
+ under `next`, waits for npm to serve all eight exact versions, then prepares and
178
+ tests the core `@dotenvx/dotenvx` wrapper across all eight platforms before
179
+ publishing it under `next`. **Existing `latest` tags stay unchanged.** The source
180
+ core package stays private; only the validated staged wrapper is publishable.
181
+ Releases require normal `major.minor.patch` versions; prereleases are rejected.
238
182
 
239
- ## Install
240
-
241
- Installing with [`brew`](https://brew.sh) is most straight forward:
183
+ From a clean working tree, prepare a Node.js release with:
242
184
 
243
185
  ```sh
244
- brew install dotenvx/brew/dotenvx
186
+ npm run version:nodejs patch
245
187
  ```
246
188
 
247
- ### Other Ways to Install
248
-
249
- 1. After `brew`, installing globally using [`npm`](https://www.npmjs.com/package/@dotenvx/dotenvx) is easiest:
189
+ `patch`, `minor`, and `major` perform normal version bumps. The helper synchronizes
190
+ npm/platform dependency versions, lockfile, and adapter Cargo versions, then
191
+ creates a local commit and `nodejs-v<version>` tag. It does not publish or push.
192
+ You can also include `nodejs` in `npm run version:batch -- cli,nodejs patch`
193
+ (with optional `--push`). It prints the exact atomic push command, for example:
250
194
 
251
195
  ```sh
252
- npm install @dotenvx/dotenvx --global
196
+ git push --atomic origin HEAD refs/tags/nodejs-v0.4.12
253
197
  ```
254
198
 
255
- 2. Or use with [`npx`](https://www.npmjs.com/package/npx):
199
+ Pushing the matching tag triggers the full platform-and-core release under `next`.
200
+ To backfill or retry an existing normal-version release, dispatch the workflow
201
+ from `main`, enter the exact version (for example `0.4.11`), choose
202
+ `target=platforms`, and enable `publish`. Every job checks out the corresponding
203
+ `nodejs-v0.4.11` tag, whose package version must match. The tag must exist;
204
+ CLI-only `cli-v*` tags and old beta tags cannot be used for this flow.
256
205
 
257
206
  ```sh
258
- npx @dotenvx/dotenvx help
207
+ gh workflow run nodejs.yml --ref main -f target=platforms -f version=0.4.11 -f publish=true
259
208
  ```
260
209
 
261
- 3. Or install in your `package.json`
210
+ Manual runs default to `publish=false` for build and test checks. Existing
211
+ `latest` tags remain untouched. Already published versions are reused only when
212
+ tarball integrity matches. A platform publication or core test failure stops the
213
+ release before core publication. Published npm versions cannot be overwritten.
262
214
 
263
- ```sh
264
- npm i @dotenvx/dotenvx --save
265
- ```
266
- ```json
267
- // package.json
268
- "scripts": {
269
- "start": "./node_modules/.bin/dotenvx run -- nodex index.js"
270
- }
271
- ```
215
+ Before the first release, configure npm trusted publishing for
216
+ every platform package: repository `dotenvx/forge`, workflow `nodejs.yml`,
217
+ environment `release`. The workflow uses Node 24 and npm with OIDC support. Forge is private, so
218
+ publication explicitly disables provenance; npm does not support provenance
219
+ from private repositories, even for public packages. See the
220
+ [npm trusted publishing documentation](https://docs.npmjs.com/trusted-publishers/).
221
+ The three new package names have been initialized at `0.1.0`. The release
222
+ workflow now uses trusted publishing only and does not read an `NPM_TOKEN`
223
+ secret. No credentials are needed for build-only runs. Platform manifests also
224
+ set `publishConfig.tag` to `next`, and artifact validation rejects any other tag.
272
225
 
273
- 3. Or download it directly as a standalone binary:
226
+ Forge owns the new `0.4.x` platform packages and core wrapper releases.
227
+ Existing 2.x versions remain unchanged.
274
228
 
275
- ```sh
276
- curl -fsS https://dotenvx.sh/ | sh
277
- ```
278
229
 
279
- ```sh
280
- # download it to `./dotenvx`
281
- curl -fsS https://dotenvx.sh/ | sh
230
+ ## Core publication from Forge
282
231
 
283
- # check it works
284
- ./dotenvx help
232
+ Core publication follows successful platform publication automatically in
233
+ `nodejs.yml` tag releases. Preparation waits for npm's processing delay, then the
234
+ core test matrix must pass on all eight platforms. A separate `core` manual
235
+ mode remains available to test or retry only the wrapper. It uses the
236
+ already-published, exact-version platform packages. It never rebuilds or
237
+ republishes the CLI or native addons and never copies code to
238
+ the legacy dotenvx repository.
285
239
 
286
- # move it to `/usr/local/bin/dotenvx`
287
- sudo install -m 755 dotenvx /usr/local/bin
240
+ The source `package.json` stays private. Preparation creates a staged tarball
241
+ with `private: false`, no lifecycle scripts, and `publishConfig.tag: next`.
242
+ It validates all eight published platform versions and their metadata before
243
+ preparing the wrapper. No native files are included in the wrapper tarball.
288
244
 
289
- # check it still works
290
- /usr/local/bin/dotenvx help
245
+ A local read-only registry check and package preparation is available:
291
246
 
292
- # check it is in your path
293
- which dotenv
294
- dotenvx help
247
+ ```sh
248
+ npm run prepare:nodejs:core
295
249
  ```
296
250
 
297
- ## Contributing
251
+ This produces `dist/nodejs-core/dotenvx-dotenvx-<version>.tgz` without publishing.
252
+ To exercise the staged wrapper against the published native dependencies on all
253
+ eight targets, after committing and pushing the workflow changes, dispatch:
298
254
 
299
- If you have questions or feedback:
255
+ ```sh
256
+ gh workflow run nodejs.yml --ref main -f target=core -f version=0.4.11 -f publish=false
257
+ ```
300
258
 
301
- * [github.com/dotenvx/dotenvx](https://github.com/dotenvx/dotenvx/issues) - bugs and discussions
302
- * [@dotenvx 𝕏](https://x.com/dotenvx) (DMs are open)
259
+ The core test matrix installs the existing npm binaries and tests the actual
260
+ staged tarball, SDK imports, preload entry points, CLI dispatch, encryption, and
261
+ decryption. No Rust toolchain or native rebuild is used in core mode.
262
+
263
+ To publish or retry only the core release, manually dispatch `nodejs.yml` from
264
+ `main`, choose `target=core`, enable `publish`, and enter the exact version
265
+ in the `version` input. All jobs check out its matching `nodejs-v<version>` tag.
266
+ Missing tags or mismatched package versions are rejected. Publication waits for the full core test matrix and uses
267
+ the `release` environment and GitHub OIDC, as do automatic tag releases.
268
+ The core package must trust
269
+ `dotenvx/forge`, workflow `nodejs.yml`, environment `release` on npm.
270
+
271
+ Only the validated `@dotenvx/dotenvx` tarball is published, with an explicit
272
+ `--tag next`, public npm registry, disabled lifecycle scripts, and disabled
273
+ provenance for this private repository. The publisher snapshots core/platform
274
+ tags, rechecks them before publication, and verifies them afterward. Only core's
275
+ `next` tag may change; `latest` and all platform tags must remain unchanged.
276
+ There is no `latest` publication option, platform-publish command, or dist-tag
277
+ mutation command in the core publisher. Existing versions are never overwritten. An
278
+ identical retry is accepted only if the published integrity and `next` tag match.
279
+
280
+ Both manual modes default to `publish=false`. Branch pushes do not publish;
281
+ matching `nodejs-v*` tag pushes publish platforms and core automatically.
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env node
2
+ const { spawn } = require('node:child_process')
3
+ const { resolveCli } = require('../lib/cli.cjs')
4
+
5
+ const libc = process.platform === 'linux' ? (process.report.getReport().header.glibcVersionRuntime ? '-gnu' : '-musl') : ''
6
+ const platform = `${process.platform}-${process.arch}${libc}`
7
+ let binary
8
+ try {
9
+ binary = resolveCli()
10
+ } catch (error) {
11
+ console.error(error.message)
12
+ process.exit(1)
13
+ }
14
+
15
+ const child = spawn(binary, process.argv.slice(2), { stdio: 'inherit' })
16
+ const signals = process.platform === 'win32' ? ['SIGINT', 'SIGTERM'] : ['SIGINT', 'SIGTERM', 'SIGHUP']
17
+ const handlers = new Map(signals.map(signal => [signal, () => child.kill(signal)]))
18
+ for (const [signal, handler] of handlers) process.on(signal, handler)
19
+ const cleanup = () => {
20
+ for (const [signal, handler] of handlers) process.removeListener(signal, handler)
21
+ }
22
+
23
+ child.on('error', error => {
24
+ cleanup()
25
+ console.error(`Could not launch the dotenvx CLI for ${platform}: ${error.message}`)
26
+ console.error('Reinstall @dotenvx/dotenvx with its native files included. For a local Forge checkout, run npm run build:dotenvx-nodejs.')
27
+ console.error('To use a standalone installation, set DOTENVX_CLI to the absolute path of its executable.')
28
+ process.exitCode = 1
29
+ })
30
+ child.on('exit', (code, signal) => {
31
+ cleanup()
32
+ if (signal) process.kill(process.pid, signal)
33
+ else process.exitCode = code
34
+ })
package/config.cjs ADDED
@@ -0,0 +1 @@
1
+ require('./index.cjs').config()
package/config.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {}
package/config.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import { config } from './index.mjs'
2
+ config()