@dotenvx/dotenvx 0.10.6 → 0.12.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
|
@@ -4,7 +4,6 @@ const main = require('./../../lib/main')
|
|
|
4
4
|
const logger = require('./../../shared/logger')
|
|
5
5
|
const helpers = require('./../helpers')
|
|
6
6
|
const createSpinner = require('./../../shared/createSpinner')
|
|
7
|
-
const { AppendToIgnores } = require('./../ignores')
|
|
8
7
|
|
|
9
8
|
const spinner = createSpinner('encrypting')
|
|
10
9
|
|
|
@@ -12,8 +11,6 @@ const spinner = createSpinner('encrypting')
|
|
|
12
11
|
const ENCODING = 'utf8'
|
|
13
12
|
|
|
14
13
|
async function encrypt () {
|
|
15
|
-
new AppendToIgnores().run()
|
|
16
|
-
|
|
17
14
|
spinner.start()
|
|
18
15
|
await helpers.sleep(500) // better dx
|
|
19
16
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const fs = require('fs')
|
|
2
2
|
|
|
3
3
|
const FORMATS = ['.env*', '!.env.vault']
|
|
4
|
+
const logger = require('./../../shared/logger')
|
|
4
5
|
|
|
5
6
|
class Generic {
|
|
6
7
|
constructor (filename, touchFile = false) {
|
|
@@ -16,6 +17,8 @@ class Generic {
|
|
|
16
17
|
run () {
|
|
17
18
|
if (!fs.existsSync(this.filename)) {
|
|
18
19
|
if (this.touchFile === true) {
|
|
20
|
+
logger.info(`creating ${this.filename}`)
|
|
21
|
+
|
|
19
22
|
fs.writeFileSync(this.filename, '')
|
|
20
23
|
} else {
|
|
21
24
|
return
|
|
@@ -25,6 +28,8 @@ class Generic {
|
|
|
25
28
|
const lines = fs.readFileSync(this.filename, 'utf8').split(/\r?\n/)
|
|
26
29
|
this.formats.forEach(format => {
|
|
27
30
|
if (!lines.includes(format.trim())) {
|
|
31
|
+
logger.info(`appending ${format} to ${this.filename}`)
|
|
32
|
+
|
|
28
33
|
this.append(format)
|
|
29
34
|
}
|
|
30
35
|
})
|
|
@@ -55,13 +60,23 @@ class Vercel {
|
|
|
55
60
|
}
|
|
56
61
|
}
|
|
57
62
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
function gitignore () {
|
|
64
|
+
const options = this.opts()
|
|
65
|
+
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
66
|
+
|
|
67
|
+
logger.verbose('appending to .gitignore')
|
|
68
|
+
new Git().run()
|
|
69
|
+
|
|
70
|
+
logger.verbose('appending to .dockerignore (if existing)')
|
|
71
|
+
new Docker().run()
|
|
72
|
+
|
|
73
|
+
logger.verbose('appending to .npmignore (if existing)')
|
|
74
|
+
new Npm().run()
|
|
75
|
+
|
|
76
|
+
logger.verbose('appending to .vercelignore (if existing)')
|
|
77
|
+
new Vercel().run()
|
|
78
|
+
|
|
79
|
+
logger.success('done')
|
|
65
80
|
}
|
|
66
81
|
|
|
67
|
-
module.exports =
|
|
82
|
+
module.exports = gitignore
|
package/src/cli/actions/run.js
CHANGED
|
@@ -2,13 +2,10 @@ const fs = require('fs')
|
|
|
2
2
|
const logger = require('./../../shared/logger')
|
|
3
3
|
const helpers = require('./../helpers')
|
|
4
4
|
const main = require('./../../lib/main')
|
|
5
|
-
const { AppendToIgnores } = require('./../ignores')
|
|
6
5
|
|
|
7
6
|
const ENCODING = 'utf8'
|
|
8
7
|
|
|
9
8
|
async function run () {
|
|
10
|
-
new AppendToIgnores().run()
|
|
11
|
-
|
|
12
9
|
const commandArgs = this.args
|
|
13
10
|
logger.debug(`process command [${commandArgs.join(' ')}]`)
|
|
14
11
|
|
package/src/cli/dotenvx.js
CHANGED
|
@@ -79,6 +79,12 @@ program.command('prebuild')
|
|
|
79
79
|
.addHelpText('after', examples.prebuild)
|
|
80
80
|
.action(require('./actions/prebuild'))
|
|
81
81
|
|
|
82
|
+
// dotenvx gitignore
|
|
83
|
+
program.command('gitignore')
|
|
84
|
+
.description('append to .gitignore file (and if existing, .dockerignore, .npmignore, and .vercelignore)')
|
|
85
|
+
.addHelpText('after', examples.gitignore)
|
|
86
|
+
.action(require('./actions/gitignore'))
|
|
87
|
+
|
|
82
88
|
// dotenvx hub
|
|
83
89
|
program.addCommand(require('./commands/hub'))
|
|
84
90
|
|
package/src/cli/examples.js
CHANGED
|
@@ -83,9 +83,27 @@ Try it:
|
|
|
83
83
|
`
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
const gitignore = function () {
|
|
87
|
+
return `
|
|
88
|
+
Examples:
|
|
89
|
+
|
|
90
|
+
\`\`\`
|
|
91
|
+
$ dotenvx gitignore
|
|
92
|
+
\`\`\`
|
|
93
|
+
|
|
94
|
+
Try it:
|
|
95
|
+
|
|
96
|
+
\`\`\`
|
|
97
|
+
$ dotenvx gitignore
|
|
98
|
+
done
|
|
99
|
+
\`\`\`
|
|
100
|
+
`
|
|
101
|
+
}
|
|
102
|
+
|
|
86
103
|
module.exports = {
|
|
87
104
|
run,
|
|
88
105
|
encrypt,
|
|
89
106
|
precommit,
|
|
90
|
-
prebuild
|
|
107
|
+
prebuild,
|
|
108
|
+
gitignore
|
|
91
109
|
}
|