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

[Chore] Rework temp config formatting #1787

Merged
merged 5 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

### 🎉 New Features & Improvements

* `[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))
art-alexeyenko marked this conversation as resolved.
Show resolved Hide resolved

## 22.0.0

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

# react
art-alexeyenko marked this conversation as resolved.
Show resolved Hide resolved

* Replace `scripts/generate-config.js` if you have not modified it. Otherwise:
* Replace ``const config = {};\n`;`` line with ``let config = {};\n`;``
* Replace
```
configText += `config.${prop} = process.env.REACT_APP_${constantCase(prop)} || "${
config[prop]
}",\n`;
```
with
```
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 ``const config = {};\n`;`` line with ``let config = {};\n`;``
* Replace
```
configText += `config.${prop} = process.env.${constantCase(prop)} || "${config[prop]}",\n`;
```
with
```
configText += `config.${prop} = process.env.${constantCase(prop)} || "${config[prop]}";\n`;
```

# vue

* Replace `scripts/generate-config.js` if you have not modified it. Otherwise:
* Replace ``const config = {};\n`;`` line with ``let config = {};\n`;``
* Replace
```
configText += `config.${prop} = process.env.VUE_APP_${constantCase(prop)} || "${
config[prop]
}",\n`;
```
with
```
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 ``const config = {};\n`;`` line with ``let config = {};\n`;``
* Replace
```
configText += `config.${prop} = process.env.${constantCase(prop)} || '${config[prop]}',\n`;
```
with
```
configText += `config.${prop} = process.env.${constantCase(prop)} || '${config[prop]}';\n`;
```
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ export function generateConfig(configOverrides?: { [key: string]: unknown }, out
let configText = `/* eslint-disable */
// Do not edit this file, it is auto-generated at build time!
// See scripts/bootstrap.ts to modify the generation of this file.
const config = {};\n`;
let config = {};\n`;
art-alexeyenko marked this conversation as resolved.
Show resolved Hide resolved

// 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 @@ -49,11 +49,11 @@ function writeConfig(config: JssConfig): void {
let configText = `/* eslint-disable */
// Do not edit this file, it is auto-generated at build time!
// See scripts/bootstrap.ts to modify the generation of this file.
const config = {};\n`;
let 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 @@ -46,13 +46,13 @@ function writeConfig(config) {
let configText = `/* eslint-disable */
// Do not edit this file, it is auto-generated at build time!
// See scripts/generate-config.js to modify the generation of this file.
const config = {};\n`;
let config = {};\n`;

// Set base configuration values, allowing override with environment variables
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 @@ -41,13 +41,13 @@ module.exports = function generateConfig(configOverrides) {
let configText = `/* eslint-disable */
// Do not edit this file, it is auto-generated at build time!
// See scripts/bootstrap.ts to modify the generation of this file.
const config = {};\n`;
let config = {};\n`;

// Set base configuration values, allowing override with environment variables
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