Skip to content

Commit

Permalink
fix(cli-helpers): Don't add spaces around = for env vars (#11414)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobbe authored Sep 2, 2024
1 parent 04a0050 commit 4c7199d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .changesets/11414.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- fix(cli-helpers): Don't add spaces around `=` for env vars (#11414) by @Tobbe

The `addEnvVar` helper function in `packages/cli-helpers` no longer adds spaces around `=` when setting environment variables.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ exports[`addEnvVar > addEnvVar adds environment variables as part of a setup tas
# Note: The existing environment variable EXISTING_VAR was not overwritten. Uncomment to use its new value.
# Updated existing variable Comment
# EXISTING_VAR = new_value
# EXISTING_VAR=new_value
"
`;

Expand All @@ -15,7 +15,7 @@ exports[`addEnvVar > addEnvVar adds environment variables as part of a setup tas
# CommentedVar = 123
# New Variable Comment
NEW_VAR = new_value
NEW_VAR=new_value
"
`;

Expand All @@ -24,7 +24,7 @@ exports[`addEnvVar > addEnvVar adds environment variables as part of a setup tas
# CommentedVar = 123
# New Variable Comment
NEW_VAR = new_value
NEW_VAR=new_value
"
`;

Expand All @@ -34,7 +34,7 @@ exports[`addEnvVar > addEnvVar adds environment variables as part of a setup tas
# Note: The existing environment variable EXISTING_VAR was not overwritten. Uncomment to use its new value.
# New Variable Comment
# EXISTING_VAR = new_value
# EXISTING_VAR=new_value
"
`;

Expand Down
4 changes: 2 additions & 2 deletions packages/cli-helpers/src/lib/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export const addEnvVar = (name: string, value: string, comment: string) => {
let envFile = ''
const newEnvironmentVariable = [
comment && `# ${comment}`,
`${name} = ${value}`,
`${name}=${value}`,
'',
]
.flat()
Expand All @@ -144,7 +144,7 @@ export const addEnvVar = (name: string, value: string, comment: string) => {
const p = [
`# Note: The existing environment variable ${name} was not overwritten. Uncomment to use its new value.`,
comment && `# ${comment}`,
`# ${name} = ${value}`,
`# ${name}=${value}`,
'',
]
.flat()
Expand Down

0 comments on commit 4c7199d

Please sign in to comment.