@dotenvx/dotenvx 1.45.2 → 1.46.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/package.json +2 -3
- package/src/cli/dotenvx.js +11 -0
- package/src/lib/helpers/errors.js +11 -0
- package/src/lib/helpers/getCommanderVersion.js +10 -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.46.0...main)
|
|
6
|
+
|
|
7
|
+
## Added
|
|
8
|
+
|
|
9
|
+
* Add error when hoisting issue experienced around commander.js ([#623](https://github.com/dotenvx/dotenvx/pull/623))
|
|
10
|
+
|
|
11
|
+
## Removed
|
|
12
|
+
|
|
13
|
+
* Remove `git-dotenvx` and `git dotenvx` shorthand ([#621](https://github.com/dotenvx/dotenvx/pull/621))
|
|
6
14
|
|
|
7
15
|
## 1.45.2
|
|
8
16
|
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.46.0",
|
|
3
3
|
"name": "@dotenvx/dotenvx",
|
|
4
4
|
"description": "a better dotenv–from the creator of `dotenv`",
|
|
5
5
|
"author": "@motdotla",
|
|
@@ -30,8 +30,7 @@
|
|
|
30
30
|
"./package.json": "./package.json"
|
|
31
31
|
},
|
|
32
32
|
"bin": {
|
|
33
|
-
"dotenvx": "./src/cli/dotenvx.js"
|
|
34
|
-
"git-dotenvx": "./src/cli/dotenvx.js"
|
|
33
|
+
"dotenvx": "./src/cli/dotenvx.js"
|
|
35
34
|
},
|
|
36
35
|
"scripts": {
|
|
37
36
|
"standard": "standard",
|
package/src/cli/dotenvx.js
CHANGED
|
@@ -7,6 +7,8 @@ const program = new Command()
|
|
|
7
7
|
const { setLogLevel, logger } = require('../shared/logger')
|
|
8
8
|
const examples = require('./examples')
|
|
9
9
|
const packageJson = require('./../lib/helpers/packageJson')
|
|
10
|
+
const Errors = require('./../lib/helpers/errors')
|
|
11
|
+
const getCommanderVersion = require('./../lib/helpers/getCommanderVersion')
|
|
10
12
|
const executeDynamic = require('./../lib/helpers/executeDynamic')
|
|
11
13
|
const removeDynamicHelpSection = require('./../lib/helpers/removeDynamicHelpSection')
|
|
12
14
|
const removeOptionsHelpParts = require('./../lib/helpers/removeOptionsHelpParts')
|
|
@@ -20,6 +22,15 @@ function collectEnvs (type) {
|
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
24
|
|
|
25
|
+
// surface hoisting problems
|
|
26
|
+
const commanderVersion = getCommanderVersion()
|
|
27
|
+
if (commanderVersion && parseInt(commanderVersion.split('.')[0], 10) >= 12) {
|
|
28
|
+
const message = `dotenvx depends on commander@11.x.x but you are attempting to hoist commander@${commanderVersion}`
|
|
29
|
+
const error = new Errors({ message }).dangerousDependencyHoist()
|
|
30
|
+
logger.error(error.message)
|
|
31
|
+
if (error.help) logger.error(error.help)
|
|
32
|
+
}
|
|
33
|
+
|
|
23
34
|
// global log levels
|
|
24
35
|
program
|
|
25
36
|
.usage('run -- yourcommand')
|
|
@@ -96,6 +96,17 @@ class Errors {
|
|
|
96
96
|
e.help = help
|
|
97
97
|
return e
|
|
98
98
|
}
|
|
99
|
+
|
|
100
|
+
dangerousDependencyHoist () {
|
|
101
|
+
const code = 'DANGEROUS_DEPENDENCY_HOIST'
|
|
102
|
+
const message = `[${code}] your environment has hoisted an incompatible version of a dotenvx dependency: ${this.message}`
|
|
103
|
+
const help = `[${code}] https://github.com/dotenvx/dotenvx/issues/622`
|
|
104
|
+
|
|
105
|
+
const e = new Error(message)
|
|
106
|
+
e.code = code
|
|
107
|
+
e.help = help
|
|
108
|
+
return e
|
|
109
|
+
}
|
|
99
110
|
}
|
|
100
111
|
|
|
101
112
|
module.exports = Errors
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const path = require('path')
|
|
3
|
+
|
|
4
|
+
function getCommanderVersion () {
|
|
5
|
+
const commanderMain = require.resolve('commander')
|
|
6
|
+
const pkgPath = path.join(commanderMain, '..', 'package.json')
|
|
7
|
+
return JSON.parse(fs.readFileSync(pkgPath, 'utf8')).version
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
module.exports = getCommanderVersion
|