@@ -0,0 +1,8 @@
|
||||
---
|
||||
'@backstage/cli': patch
|
||||
'@backstage/cli-common': patch
|
||||
---
|
||||
|
||||
Keep backstage.json in sync
|
||||
|
||||
The `versions:bump` script now takes care about updating the `version` property inside `backstage.json` file. The file is created if is not present.
|
||||
@@ -1,9 +1,11 @@
|
||||
---
|
||||
'@backstage/cli': patch
|
||||
'@backstage/cli-common': patch
|
||||
'@backstage/create-app': patch
|
||||
---
|
||||
|
||||
Add .backstage-version file
|
||||
Create backstage.json file
|
||||
|
||||
`@backstage/create-app` will create a new `.backstage.json` file containing the version of `@backstage/create-app` used for creating the application.
|
||||
`@backstage/create-app` will create a new `backstage.json` file. At this point, the file will contain a `version` property, representing the version of `@backstage/create-app` used for creating the application. If the backstage's application has been bootstrapped using an older version of `@backstage/create-app`, the `backstage.json` file can be created and kept in sync, together with all the changes of the latest version of backstage, by running the following script:
|
||||
|
||||
```bash
|
||||
yarn backstage-cli versions:bump
|
||||
```
|
||||
|
||||
@@ -3,10 +3,8 @@
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
// Warning: (ae-missing-release-tag) "BACKSTAGE_JSON" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public
|
||||
export const BACKSTAGE_JSON = '.backstage.json';
|
||||
export const BACKSTAGE_JSON = 'backstage.json';
|
||||
|
||||
// @public
|
||||
export function findPaths(searchDir: string): Paths;
|
||||
|
||||
@@ -170,5 +170,7 @@ export function findPaths(searchDir: string): Paths {
|
||||
|
||||
/**
|
||||
* The name of the backstage's config file
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export const BACKSTAGE_JSON = '.backstage.json';
|
||||
export const BACKSTAGE_JSON = 'backstage.json';
|
||||
|
||||
@@ -252,9 +252,9 @@ describe('bumpBackstageJsonVersion', () => {
|
||||
jest.resetAllMocks();
|
||||
});
|
||||
|
||||
it('should bump version in .backstage.json', async () => {
|
||||
it('should bump version in backstage.json', async () => {
|
||||
mockFs({
|
||||
'/.backstage.json': JSON.stringify({ version: '0.0.1' }),
|
||||
'/backstage.json': JSON.stringify({ version: '0.0.1' }),
|
||||
});
|
||||
paths.targetDir = '/';
|
||||
const latest = '1.4.1';
|
||||
@@ -276,11 +276,11 @@ describe('bumpBackstageJsonVersion', () => {
|
||||
|
||||
await bumpBackstageJsonVersion();
|
||||
|
||||
const json = await fs.readJson('/.backstage.json');
|
||||
const json = await fs.readJson('/backstage.json');
|
||||
expect(json).toEqual({ version: '1.4.1' });
|
||||
});
|
||||
|
||||
it("should create .backstage.json if doesn't exist", async () => {
|
||||
it("should create backstage.json if doesn't exist", async () => {
|
||||
mockFs({});
|
||||
paths.targetDir = '/';
|
||||
const latest = '1.4.1';
|
||||
@@ -302,7 +302,7 @@ describe('bumpBackstageJsonVersion', () => {
|
||||
|
||||
await bumpBackstageJsonVersion();
|
||||
|
||||
const json = await fs.readJson('/.backstage.json');
|
||||
const json = await fs.readJson('/backstage.json');
|
||||
expect(json).toEqual({ version: '1.4.1' });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -296,8 +296,8 @@ export async function bumpBackstageJsonVersion() {
|
||||
console.log(
|
||||
chalk.yellow(
|
||||
typeof backstageJson === 'undefined'
|
||||
? 'Creating .backstage.json'
|
||||
: 'Bumping version in .backstage.json',
|
||||
? `Creating ${BACKSTAGE_JSON}`
|
||||
: `Bumping version in ${BACKSTAGE_JSON}`,
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ describe('command entrypoint', () => {
|
||||
|
||||
test('should call expected tasks with no path option', async () => {
|
||||
const cmd = {} as unknown as Command;
|
||||
await createApp(cmd);
|
||||
await createApp(cmd, '1.0.0');
|
||||
expect(checkAppExistsMock).toHaveBeenCalled();
|
||||
expect(createTemporaryAppFolderMock).toHaveBeenCalled();
|
||||
expect(templatingMock).toHaveBeenCalled();
|
||||
@@ -69,7 +69,7 @@ describe('command entrypoint', () => {
|
||||
|
||||
it('should call expected tasks with path option', async () => {
|
||||
const cmd = { path: 'myDirectory' } as unknown as Command;
|
||||
await createApp(cmd);
|
||||
await createApp(cmd, '1.0.0');
|
||||
expect(checkPathExistsMock).toHaveBeenCalled();
|
||||
expect(templatingMock).toHaveBeenCalled();
|
||||
expect(buildAppMock).toHaveBeenCalled();
|
||||
@@ -77,7 +77,7 @@ describe('command entrypoint', () => {
|
||||
|
||||
it('should not call `buildAppTask` when `skipInstall` is supplied', async () => {
|
||||
const cmd = { skipInstall: true } as unknown as Command;
|
||||
await createApp(cmd);
|
||||
await createApp(cmd, '1.0.0');
|
||||
expect(buildAppMock).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -195,9 +195,12 @@ describe('templatingTask', () => {
|
||||
name: 'SuperCoolBackstageInstance',
|
||||
dbTypeSqlite: true,
|
||||
};
|
||||
await templatingTask(templateDir, destinationDir, context);
|
||||
await templatingTask(templateDir, destinationDir, context, '1.0.0');
|
||||
expect(fs.existsSync('templatedApp/package.json')).toBe(true);
|
||||
expect(fs.existsSync('templatedApp/.dockerignore')).toBe(true);
|
||||
await expect(fs.readJson('templatedApp/backstage.json')).resolves.toEqual({
|
||||
version: '1.0.0',
|
||||
});
|
||||
// catalog was populated with `context.name`
|
||||
expect(
|
||||
fs.readFileSync('templatedApp/catalog-info.yaml', 'utf-8'),
|
||||
|
||||
Reference in New Issue
Block a user