@dotenvx/dotenvx 1.1.0 โ 1.2.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 +13 -3
- package/package.json +6 -3
- package/src/cli/actions/run.js +21 -6
- package/src/cli/dotenvx.js +9 -3
- package/src/lib/services/ls.js +12 -15
package/CHANGELOG.md
CHANGED
|
@@ -2,19 +2,29 @@
|
|
|
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.2.0...main)
|
|
6
|
+
|
|
7
|
+
## 1.2.0
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
* handle nested `dotenvx` invocations - `dotenvx run -- dotenvx run -- env` ([#279](https://github.com/dotenvx/dotenvx/pull/279))
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
* replace `glob` with faster approach ([#278](https://github.com/dotenvx/dotenvx/pull/278))
|
|
6
16
|
|
|
7
17
|
## 1.1.0
|
|
8
18
|
|
|
9
19
|
### Added
|
|
10
20
|
|
|
11
|
-
*
|
|
21
|
+
* add TypeScript type definitions ([#272](https://github.com/dotenvx/dotenvx/pull/272))
|
|
12
22
|
|
|
13
23
|
## 1.0.1
|
|
14
24
|
|
|
15
25
|
### Changed
|
|
16
26
|
|
|
17
|
-
* ๐
|
|
27
|
+
* ๐ fix expansion when preset on `process.env` and/or with `--overload` ([#271](https://github.com/dotenvx/dotenvx/pull/271))
|
|
18
28
|
|
|
19
29
|
## 1.0.0
|
|
20
30
|
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.2.0",
|
|
3
3
|
"name": "@dotenvx/dotenvx",
|
|
4
4
|
"description": "a better dotenvโfrom the creator of `dotenv`",
|
|
5
5
|
"author": "@motdotla",
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"test": "tap run --show-full-coverage",
|
|
27
27
|
"testshell": "bash shellspec",
|
|
28
28
|
"prerelease": "npm test && npm run testshell",
|
|
29
|
-
"release": "standard-version"
|
|
29
|
+
"release": "standard-version",
|
|
30
|
+
"postinstall": "patch-package"
|
|
30
31
|
},
|
|
31
32
|
"funding": "https://dotenvx.com",
|
|
32
33
|
"dependencies": {
|
|
@@ -39,12 +40,13 @@
|
|
|
39
40
|
"dotenv": "^16.4.5",
|
|
40
41
|
"eciesjs": "^0.4.6",
|
|
41
42
|
"execa": "^5.1.1",
|
|
42
|
-
"
|
|
43
|
+
"fdir": "^6.1.1",
|
|
43
44
|
"ignore": "^5.3.0",
|
|
44
45
|
"is-wsl": "^2.1.1",
|
|
45
46
|
"object-treeify": "1.1.33",
|
|
46
47
|
"open": "^8.4.2",
|
|
47
48
|
"ora": "^5.4.1",
|
|
49
|
+
"picomatch": "^3.0.1",
|
|
48
50
|
"semver": "^7.3.4",
|
|
49
51
|
"undici": "^5.28.3",
|
|
50
52
|
"which": "^4.0.0",
|
|
@@ -53,6 +55,7 @@
|
|
|
53
55
|
},
|
|
54
56
|
"devDependencies": {
|
|
55
57
|
"capture-console": "^1.0.2",
|
|
58
|
+
"patch-package": "^8.0.0",
|
|
56
59
|
"pkg": "^5.8.1",
|
|
57
60
|
"proxyquire": "^2.1.3",
|
|
58
61
|
"sinon": "^14.0.1",
|
package/src/cli/actions/run.js
CHANGED
|
@@ -48,15 +48,31 @@ const executeCommand = async function (commandArgs, env) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
try {
|
|
51
|
-
|
|
51
|
+
// ensure the first command is expanded
|
|
52
52
|
try {
|
|
53
|
-
|
|
54
|
-
logger.debug(`expanding process command to [${
|
|
53
|
+
commandArgs[0] = path.resolve(which.sync(`${commandArgs[0]}`))
|
|
54
|
+
logger.debug(`expanding process command to [${commandArgs.join(' ')}]`)
|
|
55
55
|
} catch (e) {
|
|
56
|
-
logger.debug(`could not expand process command. using [${
|
|
56
|
+
logger.debug(`could not expand process command. using [${commandArgs.join(' ')}]`)
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
// expand any other commands that follow a --
|
|
60
|
+
let expandNext = false
|
|
61
|
+
for (let i = 0; i < commandArgs.length; i++) {
|
|
62
|
+
if (commandArgs[i] === '--') {
|
|
63
|
+
expandNext = true
|
|
64
|
+
} else if (expandNext) {
|
|
65
|
+
try {
|
|
66
|
+
commandArgs[i] = path.resolve(which.sync(`${commandArgs[i]}`))
|
|
67
|
+
logger.debug(`expanding process command to [${commandArgs.join(' ')}]`)
|
|
68
|
+
} catch (e) {
|
|
69
|
+
logger.debug(`could not expand process command. using [${commandArgs.join(' ')}]`)
|
|
70
|
+
}
|
|
71
|
+
expandNext = false
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
commandProcess = execa(commandArgs[0], commandArgs.slice(1), {
|
|
60
76
|
stdio: 'inherit',
|
|
61
77
|
env: { ...process.env, ...env }
|
|
62
78
|
})
|
|
@@ -197,7 +213,6 @@ async function run () {
|
|
|
197
213
|
logger.error(' or try: [dotenvx run -- npm run dev]')
|
|
198
214
|
process.exit(1)
|
|
199
215
|
} else {
|
|
200
|
-
// const commandArgs = process.argv.slice(commandIndex + 1)
|
|
201
216
|
await executeCommand(commandArgs, process.env)
|
|
202
217
|
}
|
|
203
218
|
}
|
package/src/cli/dotenvx.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const fs = require('fs')
|
|
4
4
|
const path = require('path')
|
|
5
|
+
const { execSync } = require('child_process')
|
|
5
6
|
const UpdateNotice = require('./../lib/helpers/updateNotice')
|
|
6
7
|
const { Command } = require('commander')
|
|
7
8
|
const program = new Command()
|
|
@@ -99,9 +100,14 @@ program.command('encrypt')
|
|
|
99
100
|
program.command('pro')
|
|
100
101
|
.description('๐ pro')
|
|
101
102
|
.action(function (...args) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
try {
|
|
104
|
+
// execute `dotenvx-pro` if available
|
|
105
|
+
execSync('dotenvx-pro', { stdio: ['inherit', 'inherit', 'ignore'] })
|
|
106
|
+
} catch (_error) {
|
|
107
|
+
const pro = fs.readFileSync(path.join(__dirname, './pro.txt'), 'utf8')
|
|
108
|
+
|
|
109
|
+
console.log(pro)
|
|
110
|
+
}
|
|
105
111
|
})
|
|
106
112
|
|
|
107
113
|
// // dotenvx ent
|
package/src/lib/services/ls.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
const { fdir: Fdir } = require('fdir')
|
|
1
2
|
const path = require('path')
|
|
2
|
-
const
|
|
3
|
+
const picomatch = require('picomatch')
|
|
3
4
|
|
|
4
5
|
class Ls {
|
|
5
6
|
constructor (directory = './', envFile = '.env*') {
|
|
@@ -14,27 +15,23 @@ class Ls {
|
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
_filepaths () {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
const ignoreMatchers = this.ignore.map(pattern => picomatch(pattern))
|
|
19
|
+
const pathMatchers = this._patterns().map(pattern => picomatch(pattern))
|
|
20
|
+
|
|
21
|
+
const api = new Fdir()
|
|
22
|
+
.withRelativePaths()
|
|
23
|
+
.exclude((dir, path) => ignoreMatchers.some(matcher => matcher(path)))
|
|
24
|
+
.filter((path) => pathMatchers.some(matcher => matcher(path)))
|
|
21
25
|
|
|
22
|
-
|
|
23
|
-
return globSync(patterns, options)
|
|
26
|
+
return api.crawl(this.cwd).sync()
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
_patterns () {
|
|
27
30
|
if (!Array.isArray(this.envFile)) {
|
|
28
|
-
return `**/${this.envFile}`
|
|
31
|
+
return [`**/${this.envFile}`]
|
|
29
32
|
}
|
|
30
33
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
for (let i = 0; i < this.envFile.length; i++) {
|
|
34
|
-
const part = this.envFile[i]
|
|
35
|
-
out.push(`**/${part}`)
|
|
36
|
-
}
|
|
37
|
-
return out
|
|
34
|
+
return this.envFile.map(part => `**/${part}`)
|
|
38
35
|
}
|
|
39
36
|
}
|
|
40
37
|
|