@dotenvx/dotenvx 1.12.0 → 1.13.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 +9 -1
- package/README.md +3 -3
- package/package.json +1 -1
- package/src/cli/actions/get.js +1 -1
- package/src/cli/actions/{ext/ls.js → ls.js} +3 -3
- package/src/cli/commands/ext.js +12 -1
- package/src/cli/dotenvx.js +26 -5
- package/src/lib/helpers/executeExtension.js +1 -1
- package/src/lib/helpers/removeDynamicHelpSection.js +21 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,15 @@
|
|
|
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/v1.
|
|
5
|
+
## [Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.13.0...main)
|
|
6
|
+
|
|
7
|
+
## 1.13.0
|
|
8
|
+
|
|
9
|
+
* move `ls` to core commands ([#367](https://github.com/dotenvx/dotenvx/pull/367))
|
|
10
|
+
|
|
11
|
+
## 1.12.1
|
|
12
|
+
|
|
13
|
+
* return without quotations for `dotenvx get --format shell` ([#366](https://github.com/dotenvx/dotenvx/pull/366))
|
|
6
14
|
|
|
7
15
|
## 1.12.0
|
|
8
16
|
|
package/README.md
CHANGED
|
@@ -1047,11 +1047,11 @@ More examples
|
|
|
1047
1047
|
Return a shell formatted response of all key/value pairs in a `.env` file.
|
|
1048
1048
|
|
|
1049
1049
|
```sh
|
|
1050
|
-
$ echo "HELLO=World
|
|
1051
|
-
$ echo "KEY=value
|
|
1050
|
+
$ echo "HELLO=World" > .env
|
|
1051
|
+
$ echo "KEY=value" >> .env
|
|
1052
1052
|
|
|
1053
1053
|
$ dotenvx get --format shell
|
|
1054
|
-
HELLO=
|
|
1054
|
+
HELLO=World KEY=value
|
|
1055
1055
|
```
|
|
1056
1056
|
|
|
1057
1057
|
This can be useful when combined with `env` on the command line.
|
package/package.json
CHANGED
package/src/cli/actions/get.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const treeify = require('object-treeify')
|
|
2
2
|
|
|
3
|
-
const { logger } = require('
|
|
3
|
+
const { logger } = require('./../../shared/logger')
|
|
4
4
|
|
|
5
|
-
const main = require('
|
|
6
|
-
const ArrayToTree = require('
|
|
5
|
+
const main = require('./../../lib/main')
|
|
6
|
+
const ArrayToTree = require('./../../lib/helpers/arrayToTree')
|
|
7
7
|
|
|
8
8
|
function ls (directory) {
|
|
9
9
|
// debug args
|
package/src/cli/commands/ext.js
CHANGED
|
@@ -2,6 +2,7 @@ const { Command } = require('commander')
|
|
|
2
2
|
|
|
3
3
|
const examples = require('./../examples')
|
|
4
4
|
const executeExtension = require('../../lib/helpers/executeExtension')
|
|
5
|
+
const removeDynamicHelpSection = require('../../lib/helpers/removeDynamicHelpSection')
|
|
5
6
|
|
|
6
7
|
const ext = new Command('ext')
|
|
7
8
|
|
|
@@ -26,7 +27,7 @@ ext.command('ls')
|
|
|
26
27
|
.argument('[directory]', 'directory to list .env files from', '.')
|
|
27
28
|
.option('-f, --env-file <filenames...>', 'path(s) to your env file(s)', '.env*')
|
|
28
29
|
.option('-ef, --exclude-env-file <excludeFilenames...>', 'path(s) to exclude from your env file(s) (default: none)')
|
|
29
|
-
.action(require('./../actions/
|
|
30
|
+
.action(require('./../actions/ls'))
|
|
30
31
|
|
|
31
32
|
// dotenvx ext genexample
|
|
32
33
|
ext.command('genexample')
|
|
@@ -59,4 +60,14 @@ ext.command('scan')
|
|
|
59
60
|
.description('scan for leaked secrets')
|
|
60
61
|
.action(require('./../actions/ext/scan'))
|
|
61
62
|
|
|
63
|
+
// overide helpInformation to hide dynamic commands
|
|
64
|
+
ext.helpInformation = function () {
|
|
65
|
+
const originalHelp = Command.prototype.helpInformation.call(this)
|
|
66
|
+
const lines = originalHelp.split('\n')
|
|
67
|
+
|
|
68
|
+
removeDynamicHelpSection(lines)
|
|
69
|
+
|
|
70
|
+
return lines.join('\n')
|
|
71
|
+
}
|
|
72
|
+
|
|
62
73
|
module.exports = ext
|
package/src/cli/dotenvx.js
CHANGED
|
@@ -8,6 +8,7 @@ const { setLogLevel, logger } = require('../shared/logger')
|
|
|
8
8
|
const examples = require('./examples')
|
|
9
9
|
const packageJson = require('./../lib/helpers/packageJson')
|
|
10
10
|
const executeDynamic = require('./../lib/helpers/executeDynamic')
|
|
11
|
+
const removeDynamicHelpSection = require('./../lib/helpers/removeDynamicHelpSection')
|
|
11
12
|
|
|
12
13
|
// for use with run
|
|
13
14
|
const envs = []
|
|
@@ -30,8 +31,7 @@ program
|
|
|
30
31
|
setLogLevel(options)
|
|
31
32
|
})
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
// for dynamic loading of dotenvx-pro, etc
|
|
35
35
|
program
|
|
36
36
|
.argument('[command]', 'dynamic command')
|
|
37
37
|
.argument('[args...]', 'dynamic command arguments')
|
|
@@ -42,7 +42,7 @@ program
|
|
|
42
42
|
|
|
43
43
|
// cli
|
|
44
44
|
program
|
|
45
|
-
.name(
|
|
45
|
+
.name('dotenvx')
|
|
46
46
|
.description(packageJson.description)
|
|
47
47
|
.version(packageJson.version)
|
|
48
48
|
.allowUnknownOption()
|
|
@@ -115,6 +115,15 @@ program.command('decrypt')
|
|
|
115
115
|
.option('--stdout', 'send to stdout')
|
|
116
116
|
.action(decryptAction)
|
|
117
117
|
|
|
118
|
+
// dotenvx ls
|
|
119
|
+
const lsAction = require('./actions/ls')
|
|
120
|
+
program.command('ls')
|
|
121
|
+
.description('print all .env files in a tree structure')
|
|
122
|
+
.argument('[directory]', 'directory to list .env files from', '.')
|
|
123
|
+
.option('-f, --env-file <filenames...>', 'path(s) to your env file(s)', '.env*')
|
|
124
|
+
.option('-ef, --exclude-env-file <excludeFilenames...>', 'path(s) to exclude from your env file(s) (default: none)')
|
|
125
|
+
.action(lsAction)
|
|
126
|
+
|
|
118
127
|
// dotenvx help
|
|
119
128
|
program.command('help [command]')
|
|
120
129
|
.description('display help for command')
|
|
@@ -131,6 +140,12 @@ program.command('help [command]')
|
|
|
131
140
|
}
|
|
132
141
|
})
|
|
133
142
|
|
|
143
|
+
// dotenvx pro
|
|
144
|
+
program.addHelpText('after', ' ')
|
|
145
|
+
program.addHelpText('after', 'Advanced: ')
|
|
146
|
+
program.addHelpText('after', ' pro 🏆 pro')
|
|
147
|
+
program.addHelpText('after', ' ext 🔌 extensions')
|
|
148
|
+
|
|
134
149
|
// dotenvx ext
|
|
135
150
|
program.addCommand(require('./commands/ext'))
|
|
136
151
|
|
|
@@ -158,13 +173,19 @@ program.command('precommit')
|
|
|
158
173
|
precommitAction.apply(this, args)
|
|
159
174
|
})
|
|
160
175
|
|
|
161
|
-
// overide helpInformation to hide DEPRECATED commands
|
|
176
|
+
// overide helpInformation to hide DEPRECATED and 'ext' commands
|
|
162
177
|
program.helpInformation = function () {
|
|
163
178
|
const originalHelp = Command.prototype.helpInformation.call(this)
|
|
164
179
|
const lines = originalHelp.split('\n')
|
|
165
180
|
|
|
181
|
+
removeDynamicHelpSection(lines)
|
|
182
|
+
|
|
166
183
|
// Filter out the hidden command from the help output
|
|
167
|
-
const filteredLines = lines.filter(line =>
|
|
184
|
+
const filteredLines = lines.filter(line =>
|
|
185
|
+
!line.includes('DEPRECATED') &&
|
|
186
|
+
!line.includes('help [command]') &&
|
|
187
|
+
!line.includes('🔌 extensions')
|
|
188
|
+
)
|
|
168
189
|
|
|
169
190
|
return filteredLines.join('\n')
|
|
170
191
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Remove Arguments section from help text. example:
|
|
2
|
+
// Arguments:
|
|
3
|
+
// command dynamic command
|
|
4
|
+
// args dynamic command arguments
|
|
5
|
+
|
|
6
|
+
function removeDynamicHelpSection (lines) {
|
|
7
|
+
let argumentsHelpIndex
|
|
8
|
+
for (let i = 0; i < lines.length; i++) {
|
|
9
|
+
if (lines[i] === 'Arguments:') {
|
|
10
|
+
argumentsHelpIndex = i
|
|
11
|
+
break
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
if (argumentsHelpIndex) {
|
|
15
|
+
lines.splice(argumentsHelpIndex, 4) // remove Arguments and the following 3 lines
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return lines
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
module.exports = removeDynamicHelpSection
|