@dotenvx/dotenvx 0.18.0 → 0.19.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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.18.0",
2
+ "version": "0.19.0",
3
3
  "name": "@dotenvx/dotenvx",
4
4
  "description": "a better dotenv–from the creator of `dotenv`",
5
5
  "author": "@motdotla",
@@ -0,0 +1,27 @@
1
+ const execa = require('execa')
2
+
3
+ const logger = require('./../../shared/logger')
4
+
5
+ async function scan () {
6
+ const options = this.opts()
7
+ logger.debug(`options: ${JSON.stringify(options)}`)
8
+
9
+ try {
10
+ await execa('gitleaks', ['version'])
11
+ } catch (error) {
12
+ logger.error('gitleaks command not found')
13
+ logger.help('? install gitleaks: [brew install gitleaks]')
14
+ logger.help2('? other install options: [https://github.com/gitleaks/gitleaks]')
15
+ process.exit(1)
16
+ }
17
+
18
+ try {
19
+ const { stderr } = await execa('gitleaks', ['detect', '-v'])
20
+ logger.blank(stderr) // gitleaks sends output as stderr for strange reason
21
+ } catch (error) {
22
+ logger.error(error.message)
23
+ process.exit(1)
24
+ }
25
+ }
26
+
27
+ module.exports = scan
@@ -97,6 +97,11 @@ program.command('genexample')
97
97
  .option('-f, --env-file <paths...>', 'path(s) to your env file(s)', '.env')
98
98
  .action(require('./actions/genexample'))
99
99
 
100
+ // dotenvx scan
101
+ program.command('scan')
102
+ .description('scan for leaked secrets')
103
+ .action(require('./actions/scan'))
104
+
100
105
  // dotenvx ls
101
106
  program.command('ls')
102
107
  .description('print all .env files in a tree structure')