@dotenvx/dotenvx 2.28.2 → 2.30.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/CHANGELOG.md +20 -1
- package/README.md +47 -12
- package/package.json +3 -3
- package/src/cli/actions/armor/down.js +1 -1
- package/src/cli/actions/armor/move.js +1 -1
- package/src/cli/actions/armor/open.js +1 -1
- package/src/cli/actions/armor/pull.js +1 -1
- package/src/cli/actions/armor/push.js +1 -1
- package/src/cli/actions/armor/up.js +1 -1
- package/src/cli/actions/curl.js +2 -2
- package/src/cli/actions/decrypt.js +4 -10
- package/src/cli/actions/define.js +1 -1
- package/src/cli/actions/del.js +3 -5
- package/src/cli/actions/encrypt.js +4 -10
- package/src/cli/actions/ext/genexample.js +1 -1
- package/src/cli/actions/ext/gitignore.js +1 -0
- package/src/cli/actions/ext/prebuild.js +5 -28
- package/src/cli/actions/ext/precommit.js +8 -3
- package/src/cli/actions/ext/scan.js +2 -3
- package/src/cli/actions/get.js +4 -7
- package/src/cli/actions/keychain/down.js +1 -1
- package/src/cli/actions/keychain/pull.js +1 -1
- package/src/cli/actions/keychain/push.js +1 -1
- package/src/cli/actions/keychain/up.js +1 -1
- package/src/cli/actions/keypair.js +3 -3
- package/src/cli/actions/lock/down.js +2 -3
- package/src/cli/actions/lock/up.js +2 -3
- package/src/cli/actions/login.js +2 -2
- package/src/cli/actions/logout.js +1 -1
- package/src/cli/actions/ls.js +1 -1
- package/src/cli/actions/protect.js +75 -0
- package/src/cli/actions/protectDocker.js +30 -0
- package/src/cli/actions/protectProcess.js +126 -0
- package/src/cli/actions/protectStdin.js +64 -0
- package/src/cli/actions/run.js +5 -6
- package/src/cli/actions/set.js +5 -9
- package/src/cli/actions/settings/device.js +2 -2
- package/src/cli/actions/settings/hostname.js +2 -2
- package/src/cli/actions/settings/off.js +1 -1
- package/src/cli/actions/settings/on.js +1 -1
- package/src/cli/actions/settings/path.js +2 -2
- package/src/cli/actions/settings/token.js +2 -2
- package/src/cli/actions/settings/username.js +2 -2
- package/src/cli/actions/validate.js +2 -2
- package/src/cli/commandAction.js +16 -0
- package/src/cli/commands/armor.js +10 -9
- package/src/cli/commands/custody.js +6 -4
- package/src/cli/commands/ext.js +7 -7
- package/src/cli/commands/lock.js +3 -2
- package/src/cli/commands/native.js +5 -4
- package/src/cli/commands/settings.js +8 -7
- package/src/cli/dotenvx.js +31 -17
- package/src/cli/help.js +4 -3
- package/src/lib/events/backends/armor.js +31 -0
- package/src/lib/events/background.js +59 -0
- package/src/lib/events/catalog.js +14 -0
- package/src/lib/events/cli.js +40 -0
- package/src/lib/events/delivery.js +89 -0
- package/src/lib/events/index.js +73 -0
- package/src/lib/events/metadata.js +25 -0
- package/src/lib/events/sdk.js +44 -0
- package/src/lib/events/worker.js +29 -0
- package/src/lib/events/workerEnvironment.js +14 -0
- package/src/lib/helpers/checklist.js +50 -0
- package/src/lib/helpers/createProtectSpinner.js +13 -0
- package/src/lib/helpers/executeCommand.js +12 -1
- package/src/lib/helpers/hasPlaintextSecrets.js +7 -0
- package/src/lib/helpers/installPrecommitHook.js +1 -0
- package/src/lib/helpers/installProtectFilter.js +56 -0
- package/src/lib/helpers/installProtectIgnore.js +27 -0
- package/src/lib/helpers/logProtectedFiles.js +9 -0
- package/src/lib/helpers/precommitEnvPatterns.js +1 -0
- package/src/lib/helpers/prompts.js +24 -0
- package/src/lib/helpers/protectSettings.js +63 -0
- package/src/lib/helpers/removeLegacyProtectFilter.js +42 -0
- package/src/lib/helpers/uninstallPrecommitHook.js +66 -0
- package/src/lib/main.d.ts +14 -0
- package/src/lib/main.js +11 -3
- package/src/lib/services/prebuild.js +4 -5
- package/src/lib/services/precommit.js +2 -12
- package/src/cli/actions/ext/precommitClean.js +0 -21
- package/src/lib/helpers/installPrecommitFilter.js +0 -50
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
-
[Unreleased](https://github.com/dotenvx/dotenvx/compare/v2.
|
|
5
|
+
[Unreleased](https://github.com/dotenvx/dotenvx/compare/v2.30.0...main)
|
|
6
|
+
|
|
7
|
+
## [2.23.0](https://github.com/dotenvx/dotenvx/compare/v2.29.0...v2.30.0) (2026-09-22)
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
* Add support for secrets references as safe from `dotenvx protect` ([#985](https://github.com/dotenvx/dotenvx/pull/985))
|
|
12
|
+
* Add cli audit logging for Armor customers ([#983](https://github.com/dotenvx/dotenvx/pull/983))
|
|
13
|
+
|
|
14
|
+
## [2.29.0](https://github.com/dotenvx/dotenvx/compare/v2.28.2...v2.29.0) (2026-09-21)
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
* Add `dotenvx protect` to prevent plaintext .env files from being committed to code on a machine ([#980](https://github.com/dotenvx/dotenvx/pull/980))
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
* Deprecate `dotenvx gitignore`. Use `dotenvx protect`.
|
|
23
|
+
* Deprecate `dotenvx precommit`. Use `dotenvx protect`.
|
|
24
|
+
* Deprecate `dotenvx prebuild`. Use `dotenvx protect --docker`.
|
|
6
25
|
|
|
7
26
|
## [2.28.2](https://github.com/dotenvx/dotenvx/compare/v2.28.1...v2.28.2) (2026-09-19)
|
|
8
27
|
|
package/README.md
CHANGED
|
@@ -2924,6 +2924,8 @@ $ dotenvx gitignore --pattern .env.keys
|
|
|
2924
2924
|
</details>
|
|
2925
2925
|
<details><summary>`precommit`</summary><br>
|
|
2926
2926
|
|
|
2927
|
+
Deprecated in favor of `dotenvx protect`. Existing hooks continue checking files and print a migration notice on each invocation. Run `dotenvx protect` inside the repository to install global staging protection and remove its recognized dotenvx hook block. Other hook commands are preserved; customized or shared hooks may require manual cleanup.
|
|
2928
|
+
|
|
2927
2929
|
Prevent `.env` files from being committed to code.
|
|
2928
2930
|
|
|
2929
2931
|
```sh
|
|
@@ -2934,24 +2936,57 @@ $ dotenvx precommit
|
|
|
2934
2936
|
</details>
|
|
2935
2937
|
<details><summary>`precommit --install`</summary><br>
|
|
2936
2938
|
|
|
2937
|
-
Install a pre-commit hook
|
|
2939
|
+
Install a pre-commit hook in the current repository:
|
|
2940
|
+
|
|
2941
|
+
```sh
|
|
2942
|
+
$ dotenvx precommit --install
|
|
2943
|
+
▣ dotenvx precommit installed [.git/hooks/pre-commit]
|
|
2944
|
+
```
|
|
2945
|
+
|
|
2946
|
+
For protection during staging, use `dotenvx protect`.
|
|
2938
2947
|
|
|
2939
|
-
|
|
2948
|
+
</details>
|
|
2949
|
+
<details><summary>`precommit --uninstall`</summary><br>
|
|
2940
2950
|
|
|
2941
|
-
|
|
2951
|
+
Remove the installed dotenvx pre-commit hook without installing replacement protection:
|
|
2942
2952
|
|
|
2943
2953
|
```sh
|
|
2944
|
-
$ dotenvx precommit --
|
|
2954
|
+
$ dotenvx precommit --uninstall
|
|
2945
2955
|
```
|
|
2946
2956
|
|
|
2947
|
-
This
|
|
2957
|
+
This removes recognized dotenvx installer blocks while preserving other hook commands. It also supports `dotenvx ext precommit --uninstall`. Unrecognized, symlinked, or external shared hooks are left unchanged with a manual-cleanup message.
|
|
2958
|
+
|
|
2959
|
+
</details>
|
|
2960
|
+
<details><summary>`protect` (hidden)</summary><br>
|
|
2961
|
+
|
|
2962
|
+
For a Docker build-time check instead of Git setup, use `RUN dotenvx protect --docker` in your Dockerfile, or `RUN dotenvx protect --docker apps/backend` for a specific directory. This replaces `prebuild` with the same checks, without prompts or Git configuration changes. It does not edit Dockerfiles or prevent files from reaching the builder; use `.dockerignore` for that.
|
|
2963
|
+
|
|
2964
|
+
Install a required Git clean filter for all existing and future repositories for your user. Run this once, even outside a Git repository:
|
|
2948
2965
|
|
|
2949
2966
|
```sh
|
|
2950
|
-
$ dotenvx
|
|
2951
|
-
|
|
2952
|
-
|
|
2967
|
+
$ dotenvx protect
|
|
2968
|
+
```
|
|
2969
|
+
|
|
2970
|
+
Interactive setup shows one checklist with both protections selected every time, even if you previously turned them off:
|
|
2971
|
+
|
|
2972
|
+
```text
|
|
2973
|
+
Set protections
|
|
2974
|
+
● Protect plaintext secrets from code commits (.env*)
|
|
2975
|
+
● Protect private keys from code commits (.env.keys*)
|
|
2976
|
+
|
|
2977
|
+
Install protections
|
|
2953
2978
|
```
|
|
2954
2979
|
|
|
2980
|
+
Use arrow keys to move and Enter or Space to toggle a choice. The action row changes to **Install protections**, **Apply changes**, **Remove protections**, or **Done**. Press Enter on that row to apply. Unchecking removes that protection; clearing both reports `⛉ unprotected (none)`. Cancelling leaves settings unchanged.
|
|
2981
|
+
|
|
2982
|
+
The first installs the staging filter. The second adds `.env.keys*` to your global Git ignore file, preserving existing rules and any configured `core.excludesFile`. Otherwise, it uses `$XDG_CONFIG_HOME/git/ignore` or `~/.config/git/ignore`. This skips private-key files during normal adds; the filter still rejects forced adds when enabled. Only dotenvx-owned ignore rules are removed. Older or manually added `.env.keys*` rules without an ownership record require manual removal. Noninteractive and CI runs retain filter-only installation without prompting or removing existing protections.
|
|
2983
|
+
|
|
2984
|
+
When run inside a repository with the filter selected, this also removes recognized dotenvx pre-commit hook blocks and legacy repo-local `precommit --clean` filter registrations after global protection is successfully installed. Custom filter commands are preserved. Run it in each repository with an old hook or filter override to migrate that repository.
|
|
2985
|
+
|
|
2986
|
+
The filter rejects plaintext `.env*`, `*.env`, `.flaskenv`, `.dev.vars*`, and files directly inside `.env.d/` directories at any depth before staging, including with `git add -A` or `git add -f`. Encrypted files pass through unchanged. `.env.example`, `.env.vault`, and `.env.x` retain their exemptions; `.env.keys*` files are always rejected.
|
|
2987
|
+
|
|
2988
|
+
This writes the filter configuration to your global Git config and adds the env-file rules to your global attributes file. Re-run `dotenvx protect` with the filter selected to refresh it after upgrading or moving the executable. It preserves an existing `core.attributesFile`; otherwise it uses `$XDG_CONFIG_HOME/git/attributes` or `~/.config/git/attributes`. It does not inspect content already staged before installation. Repository attributes and configuration can override the global protection. Use a persistent dotenvx installation.
|
|
2989
|
+
|
|
2955
2990
|
</details>
|
|
2956
2991
|
<details><summary>`precommit directory`</summary><br>
|
|
2957
2992
|
|
|
@@ -2969,7 +3004,7 @@ $ dotenvx precommit apps/backend
|
|
|
2969
3004
|
</details>
|
|
2970
3005
|
<details><summary>`prebuild`</summary><br>
|
|
2971
3006
|
|
|
2972
|
-
|
|
3007
|
+
Deprecated. Use `dotenvx protect --docker` for the same build-time check.
|
|
2973
3008
|
|
|
2974
3009
|
Add it to your `Dockerfile`.
|
|
2975
3010
|
|
|
@@ -2982,14 +3017,14 @@ COPY --from=dotenv/dotenvx:latest /usr/local/bin/dotenvx /bin/local/bin
|
|
|
2982
3017
|
|
|
2983
3018
|
# ... orther container commands
|
|
2984
3019
|
|
|
2985
|
-
RUN dotenvx
|
|
3020
|
+
RUN dotenvx protect --docker
|
|
2986
3021
|
CMD ["/usr/local/bin/dotenvx", "run", "--", "node", "index.js"]
|
|
2987
3022
|
```
|
|
2988
3023
|
|
|
2989
3024
|
</details>
|
|
2990
3025
|
<details><summary>`prebuild directory`</summary><br>
|
|
2991
3026
|
|
|
2992
|
-
|
|
3027
|
+
Deprecated. Use `dotenvx protect --docker <directory>` for the same build-time check in a specified directory.
|
|
2993
3028
|
|
|
2994
3029
|
Add it to your `Dockerfile`.
|
|
2995
3030
|
|
|
@@ -3002,7 +3037,7 @@ COPY --from=dotenv/dotenvx:latest /usr/local/bin/dotenvx /bin/local/bin
|
|
|
3002
3037
|
|
|
3003
3038
|
# ... orther container commands
|
|
3004
3039
|
|
|
3005
|
-
RUN dotenvx
|
|
3040
|
+
RUN dotenvx protect --docker apps/backend
|
|
3006
3041
|
CMD ["/usr/local/bin/dotenvx", "run", "--", "node", "apps/backend/index.js"]
|
|
3007
3042
|
```
|
|
3008
3043
|
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.
|
|
2
|
+
"version": "2.30.0",
|
|
3
3
|
"name": "@dotenvx/dotenvx",
|
|
4
4
|
"description": "a secure dotenv–from the creator of `dotenv`",
|
|
5
5
|
"author": "@motdotla",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"scripts": {
|
|
46
46
|
"standard": "standard",
|
|
47
47
|
"standard:fix": "standard --fix",
|
|
48
|
-
"test": "tap run --test-env=DOTENVX_NO_ARMOR=true --allow-empty-coverage --disable-coverage --timeout=60000",
|
|
48
|
+
"test": "tap run --test-env=DOTENVX_NO_ARMOR=true --allow-empty-coverage --allow-incomplete-coverage --disable-coverage --timeout=60000",
|
|
49
49
|
"testshell": "shellspec --shell /bin/bash",
|
|
50
50
|
"release:check": "npm test && npm run testshell",
|
|
51
51
|
"prerelease": "npm run release:check",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
},
|
|
55
55
|
"funding": "https://dotenvx.com",
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@dotenvx/primitives": "^3.0.
|
|
57
|
+
"@dotenvx/primitives": "^3.0.3",
|
|
58
58
|
"@dotenvx/tooling": "^1.0.3",
|
|
59
59
|
"global-agent": "^3.0.0",
|
|
60
60
|
"node-forge": "^1.4.0",
|
package/src/cli/actions/curl.js
CHANGED
|
@@ -58,10 +58,10 @@ async function curl () {
|
|
|
58
58
|
const text = await response.body.text()
|
|
59
59
|
console.log(outputBody(text))
|
|
60
60
|
|
|
61
|
-
if (response.statusCode >= 400)
|
|
61
|
+
if (response.statusCode >= 400) return { exitCode: 1 }
|
|
62
62
|
} catch (error) {
|
|
63
63
|
catchAndLog(error)
|
|
64
|
-
|
|
64
|
+
return { exitCode: 1, error }
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
|
|
@@ -59,11 +59,7 @@ async function decrypt () {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
process.exit(1)
|
|
64
|
-
} else {
|
|
65
|
-
process.exit(0) // exit early
|
|
66
|
-
}
|
|
62
|
+
return { exitCode: errorCount > 0 ? 1 : 0, errorCount }
|
|
67
63
|
} else {
|
|
68
64
|
try {
|
|
69
65
|
const {
|
|
@@ -110,15 +106,13 @@ async function decrypt () {
|
|
|
110
106
|
// do nothing - scenario when no .env files found
|
|
111
107
|
}
|
|
112
108
|
|
|
113
|
-
|
|
114
|
-
process.exit(1)
|
|
115
|
-
}
|
|
109
|
+
return { exitCode: errorCount > 0 ? 1 : 0, errorCount }
|
|
116
110
|
} catch (error) {
|
|
117
111
|
if (spinner) spinner.stop()
|
|
118
112
|
catchAndLog(error)
|
|
119
|
-
|
|
113
|
+
return { exitCode: 1, error }
|
|
120
114
|
}
|
|
121
115
|
}
|
|
122
116
|
}
|
|
123
117
|
|
|
124
|
-
module.exports = decrypt
|
|
118
|
+
module.exports = require('../../lib/events/cli')('decrypt', decrypt)
|
package/src/cli/actions/del.js
CHANGED
|
@@ -43,14 +43,12 @@ async function del (key) {
|
|
|
43
43
|
// do nothing - scenario when no .env files found
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
process.exit(1)
|
|
48
|
-
}
|
|
46
|
+
return { exitCode: errorCount > 0 ? 1 : 0, errorCount }
|
|
49
47
|
} catch (error) {
|
|
50
48
|
if (spinner) spinner.stop()
|
|
51
49
|
catchAndLog(error)
|
|
52
|
-
|
|
50
|
+
return { exitCode: 1, error }
|
|
53
51
|
}
|
|
54
52
|
}
|
|
55
53
|
|
|
56
|
-
module.exports = del
|
|
54
|
+
module.exports = require('../../lib/events/cli')('del', del)
|
|
@@ -43,11 +43,7 @@ async function encryptAction () {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
process.exit(1)
|
|
48
|
-
} else {
|
|
49
|
-
process.exit(0) // exit early
|
|
50
|
-
}
|
|
46
|
+
return { exitCode: errorCount > 0 ? 1 : 0, errorCount }
|
|
51
47
|
}
|
|
52
48
|
|
|
53
49
|
try {
|
|
@@ -84,14 +80,12 @@ async function encryptAction () {
|
|
|
84
80
|
// do nothing - scenario when no .env files found
|
|
85
81
|
}
|
|
86
82
|
|
|
87
|
-
|
|
88
|
-
process.exit(1)
|
|
89
|
-
}
|
|
83
|
+
return { exitCode: errorCount > 0 ? 1 : 0, errorCount }
|
|
90
84
|
} catch (error) {
|
|
91
85
|
if (spinner) spinner.stop()
|
|
92
86
|
catchAndLog(error)
|
|
93
|
-
|
|
87
|
+
return { exitCode: 1, error }
|
|
94
88
|
}
|
|
95
89
|
}
|
|
96
90
|
|
|
97
|
-
module.exports = encryptAction
|
|
91
|
+
module.exports = require('../../lib/events/cli')('encrypt', encryptAction)
|
|
@@ -1,30 +1,7 @@
|
|
|
1
|
-
const { logger } = require('
|
|
1
|
+
const { logger } = require('../../../shared/logger')
|
|
2
|
+
const protectDocker = require('../../../lib/events/cli')('protect', require('../protectDocker'))
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function prebuild (directory) {
|
|
7
|
-
// debug args
|
|
8
|
-
logger.debug(`directory: ${directory}`)
|
|
9
|
-
|
|
10
|
-
const options = this.opts()
|
|
11
|
-
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
12
|
-
|
|
13
|
-
try {
|
|
14
|
-
const {
|
|
15
|
-
successMessage,
|
|
16
|
-
warnings
|
|
17
|
-
} = new Prebuild(directory, options).run()
|
|
18
|
-
|
|
19
|
-
for (const warning of warnings) {
|
|
20
|
-
logger.warn(warning.messageWithHelp || warning.message)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
logger.success(successMessage)
|
|
24
|
-
} catch (error) {
|
|
25
|
-
catchAndLog(error)
|
|
26
|
-
process.exit(1)
|
|
27
|
-
}
|
|
4
|
+
module.exports = function prebuild (directory) {
|
|
5
|
+
logger.warn('[DEPRECATED] dotenvx prebuild. fix: run [dotenvx protect --docker]')
|
|
6
|
+
return protectDocker.call(this, directory)
|
|
28
7
|
}
|
|
29
|
-
|
|
30
|
-
module.exports = prebuild
|
|
@@ -4,9 +4,6 @@ const Precommit = require('./../../../lib/services/precommit')
|
|
|
4
4
|
const catchAndLog = require('./../../../lib/helpers/catchAndLog')
|
|
5
5
|
|
|
6
6
|
function precommit (directory) {
|
|
7
|
-
if (this.opts().clean !== undefined) {
|
|
8
|
-
return require('./precommitClean')(this.opts().clean)
|
|
9
|
-
}
|
|
10
7
|
// debug args
|
|
11
8
|
logger.debug(`directory: ${directory}`)
|
|
12
9
|
|
|
@@ -14,6 +11,14 @@ function precommit (directory) {
|
|
|
14
11
|
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
15
12
|
|
|
16
13
|
try {
|
|
14
|
+
if (options.uninstall) {
|
|
15
|
+
if (options.install) throw new Error('--install and --uninstall cannot be used together')
|
|
16
|
+
const { removed, warning } = require('../../../lib/helpers/uninstallPrecommitHook')(directory)
|
|
17
|
+
if (warning) logger.warn(warning)
|
|
18
|
+
else logger.success(removed ? '▣ uninstalled (dotenvx precommit hook)' : '○ no dotenvx precommit hook found')
|
|
19
|
+
return
|
|
20
|
+
}
|
|
21
|
+
logger.warn('[DEPRECATED] dotenvx precommit. fix: run [dotenvx protect]')
|
|
17
22
|
const {
|
|
18
23
|
successMessage,
|
|
19
24
|
warnings
|
|
@@ -14,8 +14,7 @@ function scan () {
|
|
|
14
14
|
logger.error('gitleaks: command not found')
|
|
15
15
|
logger.help('fix: install gitleaks: [brew install gitleaks]')
|
|
16
16
|
logger.help('fix: other install options: [https://github.com/gitleaks/gitleaks]')
|
|
17
|
-
|
|
18
|
-
return
|
|
17
|
+
return { exitCode: 1, error }
|
|
19
18
|
}
|
|
20
19
|
|
|
21
20
|
let output = ''
|
|
@@ -27,7 +26,7 @@ function scan () {
|
|
|
27
26
|
logger.error(chomp(error.stdout.toString()))
|
|
28
27
|
}
|
|
29
28
|
|
|
30
|
-
|
|
29
|
+
return { exitCode: 1, error }
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
32
|
|
package/src/cli/actions/get.js
CHANGED
|
@@ -118,18 +118,15 @@ async function get (key) {
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
|
|
122
|
-
process.exit(1)
|
|
123
|
-
}
|
|
121
|
+
return { exitCode: errorCount > 0 ? 1 : 0, errorCount }
|
|
124
122
|
} catch (error) {
|
|
125
123
|
if (spinner) spinner.stop()
|
|
126
124
|
if (error.code === 'PROMPT_CANCELLED') {
|
|
127
|
-
|
|
128
|
-
return
|
|
125
|
+
return { exitCode: 130, error }
|
|
129
126
|
}
|
|
130
127
|
catchAndLog(error)
|
|
131
|
-
|
|
128
|
+
return { exitCode: 1, error }
|
|
132
129
|
}
|
|
133
130
|
}
|
|
134
131
|
|
|
135
|
-
module.exports = get
|
|
132
|
+
module.exports = require('../../lib/events/cli')('get', get)
|
|
@@ -65,7 +65,7 @@ async function keypair (key) {
|
|
|
65
65
|
} else {
|
|
66
66
|
if (results === undefined) {
|
|
67
67
|
console.log('')
|
|
68
|
-
|
|
68
|
+
return { exitCode: 1 }
|
|
69
69
|
} else if (options.format === 'colon' && key) {
|
|
70
70
|
console.log(`${key}:${results}`)
|
|
71
71
|
} else {
|
|
@@ -75,8 +75,8 @@ async function keypair (key) {
|
|
|
75
75
|
} catch (error) {
|
|
76
76
|
if (spinner) spinner.stop()
|
|
77
77
|
catchAndLog(error)
|
|
78
|
-
|
|
78
|
+
return { exitCode: 1, error }
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
module.exports = keypair
|
|
82
|
+
module.exports = require('../../lib/events/cli')('keypair', keypair)
|
|
@@ -42,12 +42,11 @@ async function down () {
|
|
|
42
42
|
}
|
|
43
43
|
} catch (error) {
|
|
44
44
|
if (error.code === 'PROMPT_CANCELLED') {
|
|
45
|
-
|
|
46
|
-
return
|
|
45
|
+
return { exitCode: 130, error }
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
logger.error(error.message)
|
|
50
|
-
|
|
49
|
+
return { exitCode: 1, error }
|
|
51
50
|
}
|
|
52
51
|
}
|
|
53
52
|
|
|
@@ -50,12 +50,11 @@ async function up () {
|
|
|
50
50
|
}
|
|
51
51
|
} catch (error) {
|
|
52
52
|
if (error.code === 'PROMPT_CANCELLED') {
|
|
53
|
-
|
|
54
|
-
return
|
|
53
|
+
return { exitCode: 130, error }
|
|
55
54
|
}
|
|
56
55
|
|
|
57
56
|
logger.error(error.message)
|
|
58
|
-
|
|
57
|
+
return { exitCode: 1, error }
|
|
59
58
|
}
|
|
60
59
|
}
|
|
61
60
|
|
package/src/cli/actions/login.js
CHANGED
|
@@ -45,7 +45,7 @@ async function login () {
|
|
|
45
45
|
cleanupOpenKeyListener()
|
|
46
46
|
if (spinner) spinner.stop()
|
|
47
47
|
logger.success(`◉ logged in (${data.username})`)
|
|
48
|
-
|
|
48
|
+
return { exitCode: 0 }
|
|
49
49
|
} catch (error) {
|
|
50
50
|
cleanupOpenKeyListener()
|
|
51
51
|
if (spinner) spinner.stop()
|
|
@@ -57,7 +57,7 @@ async function login () {
|
|
|
57
57
|
if (error.stack) {
|
|
58
58
|
logger.debug(error.stack)
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
return { exitCode: 1, error }
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|