Skip to content

Commit

Permalink
[Chore] Rework temp config formatting (#1787)
Browse files Browse the repository at this point in the history
* [Chore] Rework temp config formatting for RAV + nextjs
  • Loading branch information
art-alexeyenko authored Apr 30, 2024
1 parent 4329759 commit ac30356
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ Our versioning strategy is as follows:

## Unreleased

### 🐛 Bug Fixes

* `[templates/nextjs]` `[templates/react]` `[templates/vue]` `[templates/angular]` Changed formatting in temp/config to prevent parse issues in Unix systems ([#1787](https://github.com/Sitecore/jss/pull/1787))

## 22.0.0

### 🛠 Breaking Changes
Expand Down
41 changes: 41 additions & 0 deletions docs/upgrades/unreleased.md
Original file line number Diff line number Diff line change
@@ -1 +1,42 @@
## Unreleased

# react

* Replace `scripts/generate-config.js` if you have not modified it. Otherwise:
* Replace comma before a newline (`,`) with semicolon (`;`) in configText prop assignment so it would look like this:

```
configText += `config.${prop} = process.env.REACT_APP_${constantCase(prop)} || "${
config[prop]
}";\n`;
```

# angular

* Replace `scripts/generate-config.ts` if you have not modified it. Otherwise:
* Replace comma before a newline (`,`) with semicolon (`;`) in configText prop assignment so it would look like this:

```
configText += `config.${prop} = process.env.${constantCase(prop)} || "${config[prop]}";\n`;
```


# vue

* Replace `scripts/generate-config.js` if you have not modified it. Otherwise:
* Replace comma before a newline (`,`) with semicolon (`;`) in configText prop assignment so it would look like this:

```
configText += `config.${prop} = process.env.VUE_APP_${constantCase(prop)} || "${
config[prop]
}";\n`;
```

# nextjs

* Replace `scripts/generate-config.ts` if you have not modified it. Otherwise:
* Replace comma before a newline (`,`) with semicolon (`;`) in configText prop assignment so it would look like this:

```
configText += `config.${prop} = process.env.${constantCase(prop)} || '${config[prop]}';\n`;
```
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const config = {};\n`;

// Set base configuration values, allowing override with environment variables
Object.keys(config).forEach((prop) => {
configText += `config.${prop} = process.env.${constantCase(prop)} || "${config[prop]}",\n`;
configText += `config.${prop} = process.env.${constantCase(prop)} || "${config[prop]}";\n`;
});
// Set computed values, allowing override with environment variables
Object.keys(computedConfig).forEach((prop) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const config = {};\n`;

// Set configuration values, allowing override with environment variables
Object.keys(config).forEach(prop => {
configText += `config.${prop} = process.env.${constantCase(prop)} || '${config[prop]}',\n`;
configText += `config.${prop} = process.env.${constantCase(prop)} || '${config[prop]}';\n`;
});

configText += `module.exports = config;`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const config = {};\n`;
Object.keys(config).forEach(prop => {
configText += `config.${prop} = process.env.REACT_APP_${constantCase(prop)} || "${
config[prop]
}",\n`;
}";\n`;
});
configText += 'module.exports = config;';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const config = {};\n`;
Object.keys(config).forEach((prop) => {
configText += `config.${prop} = process.env.VUE_APP_${constantCase(prop)} || "${
config[prop]
}",\n`;
}";\n`;
});
// Set computed values, allowing override with environment variables
Object.keys(computedConfig).forEach((prop) => {
Expand Down

0 comments on commit ac30356

Please sign in to comment.