@dotenvx/dotenvx 1.38.3 → 1.38.4
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 +7 -1
- package/package.json +1 -1
- package/src/lib/helpers/replace.js +9 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,13 @@
|
|
|
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.38.
|
|
5
|
+
[Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.38.4...main)
|
|
6
|
+
|
|
7
|
+
## [1.38.4](https://github.com/dotenvx/dotenvx/compare/v1.38.3...v1.38.4)
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
* 🐞 Fix blank line disappearing after encrypting empty value ([#542](https://github.com/dotenvx/dotenvx/pull/542))
|
|
6
12
|
|
|
7
13
|
## [1.38.3](https://github.com/dotenvx/dotenvx/compare/v1.38.2...v1.38.3)
|
|
8
14
|
|
package/package.json
CHANGED
|
@@ -20,6 +20,15 @@ function replace (src, key, replaceValue) {
|
|
|
20
20
|
let enforceEndOfLine = ''
|
|
21
21
|
if (escapedOriginalValue === '') {
|
|
22
22
|
enforceEndOfLine = '$' // EMPTY scenario
|
|
23
|
+
|
|
24
|
+
// if empty quote and consecutive newlines
|
|
25
|
+
const newlineMatch = src.match(new RegExp(`${key}\\s*=\\s*\n\n`, 'm')) // match any consecutive newline scenario for a blank value
|
|
26
|
+
if (quote === '' && newlineMatch) {
|
|
27
|
+
const newlineCount = (newlineMatch[0].match(/\n/g)).length - 1
|
|
28
|
+
for (let i = 0; i < newlineCount; i++) {
|
|
29
|
+
newPart += '\n' // re-append the extra newline to preserve user's format choice
|
|
30
|
+
}
|
|
31
|
+
}
|
|
23
32
|
}
|
|
24
33
|
|
|
25
34
|
const currentPart = new RegExp(
|