Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(envs): revert behavior of array in npm config #194

Merged
merged 5 commits into from
Jan 22, 2024
Merged

Conversation

wraithgar
Copy link
Member

@wraithgar wraithgar commented Jan 22, 2024

Reverts environment parsing of config arrays to use indexed names
instead of joining them with double newlines. That change appears to
have been introduced when the enviromnent values were added back into
npm, but not in the same way they were done before.

Fixes: npm/cli#3775

Credit: @siemhesda

siemhesda and others added 4 commits January 22, 2024 08:31
package.json:
```
{
"config": {
    "array": [
      "item1",
      "item2", "item3"
    ]
}}
```
Before:
```
{
  "npm_package_config_array": "item1\n\nitem2\n\nitem3"
}
```

After
```

{
  "npm_package_config_array_0": "item1",
  "npm_package_config_array_1": "item2",
  "npm_package_config_array_2": "item3"
}
```
@wraithgar wraithgar requested a review from a team as a code owner January 22, 2024 17:09
lukekarrys
lukekarrys previously approved these changes Jan 22, 2024
Copy link
Contributor

@lukekarrys lukekarrys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left 1 take-it-or-leave-it suggestion that makes env an optional parameter to packageEnvs which I think makes it clearer what the intent of the function is and avoids passing in an empty object on first call.

lib/package-envs.js Outdated Show resolved Hide resolved
lib/package-envs.js Outdated Show resolved Hide resolved
lib/package-envs.js Outdated Show resolved Hide resolved
lib/package-envs.js Outdated Show resolved Hide resolved
@wraithgar wraithgar merged commit 7ebc853 into main Jan 22, 2024
20 checks passed
@wraithgar wraithgar deleted the gar/pr191 branch January 22, 2024 22:16
@github-actions github-actions bot mentioned this pull request Jan 22, 2024
wraithgar pushed a commit that referenced this pull request Jan 23, 2024
🤖 I have created a release *beep* *boop*
---


## [7.0.4](v7.0.3...v7.0.4)
(2024-01-22)

### Bug Fixes

*
[`7ebc853`](7ebc853)
[#194](#194) envs: revert behavior
of array in npm config (#194) (@wraithgar, @siemhesda)
*
[`bf5f419`](bf5f419)
[#192](#192) code formatting
(@wraithgar)
*
[`b6f7f93`](b6f7f93)
[#192](#192) remove unreachable
code path (@wraithgar)
*
[`865d556`](865d556)
[#192](#192) remove is-windows
test fixture code from module (@wraithgar)
*
[`c47a91a`](c47a91a)
[#192](#192) update code to use
@npmcli/run-script (@wraithgar)

### Dependencies

*
[`648b0ed`](648b0ed)
[#192](#192) remove
read-package-json-fast
*
[`04a4600`](04a4600)
[#192](#192) add
`@npmcli/package-json@5.0.0`

### Chores

*
[`155c434`](155c434)
[#192](#192) rewrite tests
(@wraithgar)
*
[`64a3503`](64a3503)
[#192](#192) add spawk
(@wraithgar)
*
[`b47b660`](b47b660)
[#192](#192) remove require-inject
(@wraithgar)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] package.json#/config/*: Array changed behaviour to joining items with double new-line
3 participants