Adjust PR to review

- Add comment in local config indicating override

- Restructure files & folders to avoid folders with only one index file

Signed-off-by: Philipp Hugenroth <philipph@spotify.com>
This commit is contained in:
Philipp Hugenroth
2023-03-14 11:13:41 +01:00
parent 349b70af35
commit 3c5b436237
6 changed files with 31 additions and 23 deletions
+6 -7
View File
@@ -2,22 +2,21 @@
## Local dev
```bash
# Checkout the branch
cd backstage
git fetch
git checkout goa/cli-admin-command
# Create a new app
```bash
cd ..
npx @backstage/create-app
cd new-backstage-app
# Run the modded cli in the new app
../github/backstage/packages/cli/bin/backstage-cli onboard
../RELATIVE_PATH_TO_PROJECT/backstage/packages/cli/bin/backstage-cli onboard
? Do you want to set up Authentication for this project? (Y/n)
...
# Try the app with the new changes
yarn dev
```
@@ -16,8 +16,8 @@
import inquirer from 'inquirer';
import { Task } from '../../../lib/tasks';
import { github, Answers as GitHubAnswers } from './github';
import { gitlab, Answers as GitLabAnswers } from './gitlab';
import { github, Answers as GitHubAnswers } from './providers/github';
import { gitlab, Answers as GitLabAnswers } from './providers/gitlab';
export { type GitHubAnswers, type GitLabAnswers };
+19 -10
View File
@@ -22,15 +22,24 @@ const readYaml = async (file: string) => {
};
export const updateConfigFile = async <T>(file: string, config: T) => {
const content = fs.existsSync(file)
? { ...(await readYaml(file)), ...config }
: { ...config };
const staticContent =
'# Backstage override configuration for your local development environment \n';
return await fs.writeFile(
file,
yaml.stringify(content, {
indent: 2,
}),
'utf8',
);
const content = fs.existsSync(file)
? yaml.stringify(
{ ...(await readYaml(file)), ...config },
{
indent: 2,
},
)
: staticContent.concat(
yaml.stringify(
{ ...config },
{
indent: 2,
},
),
);
return await fs.writeFile(file, content, 'utf8');
};
@@ -16,10 +16,10 @@
import chalk from 'chalk';
import inquirer from 'inquirer';
import { Task } from '../../../../lib/tasks';
import { updateConfigFile } from '../../config';
import { APP_CONFIG_FILE } from '../../files';
import { GitHubAnswers } from '../../auth';
import { Task } from '../../../lib/tasks';
import { updateConfigFile } from '../config';
import { APP_CONFIG_FILE } from '../files';
import { GitHubAnswers } from '../auth';
type Answers = {
hasEnterprise: boolean;