create-app: Make new frontend system the default
The new frontend system is now the default template when creating a new Backstage app. The previous `--next` flag has been replaced with a `--legacy` flag that can be used to create an app using the old frontend system instead. Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/create-app': minor
|
||||
---
|
||||
|
||||
**BREAKING**: The new frontend system is now the default template when creating a new Backstage app. The previous `--next` flag has been replaced with a `--legacy` flag that can be used to create an app using the old frontend system instead.
|
||||
@@ -20,10 +20,10 @@ The create-app CLI requires Node.js Active LTS Release, see the [prerequisites d
|
||||
```sh
|
||||
# The command bellow creates a Backstage App inside the current folder.
|
||||
# The name of the app-folder is the name that was provided when prompted.
|
||||
npx @backstage/create-app@latest --next
|
||||
npx @backstage/create-app@latest
|
||||
```
|
||||
|
||||
Using the `--next` flag will result in a Backstage app using the New Frontend System which will be further explained in the sections below.
|
||||
This will create a Backstage app using the new frontend system which will be further explained in the sections below.
|
||||
|
||||
## The app instance
|
||||
|
||||
|
||||
@@ -899,7 +899,7 @@ It's encouraged that once you switch over to using the new frontend system, that
|
||||
|
||||
This practice is also pretty important early on, as it's going to help you get familiar with the practices of the new frontend system.
|
||||
|
||||
When creating a new Backstage app with `create-app` and using the `--next` flag you'll automatically get these choices in the `yarn new` command, but if you want to bring these templates to an older app, you can add the following to your root `package.json`:
|
||||
When creating a new Backstage app with `create-app` you'll automatically get these choices in the `yarn new` command, but if you want to bring these templates to an older app, you can add the following to your root `package.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
Usage: backstage-create-app [options]
|
||||
|
||||
Options:
|
||||
--next
|
||||
--legacy
|
||||
--path [directory]
|
||||
--skip-install
|
||||
--template-path [directory]
|
||||
|
||||
@@ -69,7 +69,7 @@ describe('command entrypoint', () => {
|
||||
expect(tryInitGitRepositoryMock).toHaveBeenCalled();
|
||||
expect(templatingMock).toHaveBeenCalled();
|
||||
expect(templatingMock.mock.lastCall?.[0]).toEqual(
|
||||
findOwnPaths(__dirname).resolve('templates/default-app'),
|
||||
findOwnPaths(__dirname).resolve('templates/next-app'),
|
||||
);
|
||||
expect(templatingMock.mock.lastCall?.[1]).toContain(
|
||||
path.join(tmpdir(), 'MyApp'),
|
||||
@@ -85,20 +85,20 @@ describe('command entrypoint', () => {
|
||||
expect(tryInitGitRepositoryMock).toHaveBeenCalled();
|
||||
expect(templatingMock).toHaveBeenCalled();
|
||||
expect(templatingMock.mock.lastCall?.[0]).toEqual(
|
||||
findOwnPaths(__dirname).resolve('templates/default-app'),
|
||||
findOwnPaths(__dirname).resolve('templates/next-app'),
|
||||
);
|
||||
expect(templatingMock.mock.lastCall?.[1]).toEqual('myDirectory');
|
||||
expect(buildAppMock).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should call expected tasks when `--next` is supplied', async () => {
|
||||
const cmd = { next: true } as unknown as Command;
|
||||
it('should call expected tasks when `--legacy` is supplied', async () => {
|
||||
const cmd = { legacy: true } as unknown as Command;
|
||||
await createApp(cmd);
|
||||
expect(checkAppExistsMock).toHaveBeenCalled();
|
||||
expect(tryInitGitRepositoryMock).toHaveBeenCalled();
|
||||
expect(templatingMock).toHaveBeenCalled();
|
||||
expect(templatingMock.mock.lastCall?.[0]).toEqual(
|
||||
findOwnPaths(__dirname).resolve('templates/next-app'),
|
||||
findOwnPaths(__dirname).resolve('templates/default-app'),
|
||||
);
|
||||
expect(templatingMock.mock.lastCall?.[1]).toContain(
|
||||
path.join(tmpdir(), 'MyApp'),
|
||||
|
||||
@@ -63,12 +63,12 @@ export default async (opts: OptionValues): Promise<void> => {
|
||||
},
|
||||
]);
|
||||
|
||||
// Pick the built-in template based on the --next flag
|
||||
// Pick the built-in template based on the --legacy flag
|
||||
/* eslint-disable-next-line no-restricted-syntax */
|
||||
const ownPaths = findOwnPaths(__dirname);
|
||||
const builtInTemplate = opts.next
|
||||
? ownPaths.resolve('templates/next-app')
|
||||
: ownPaths.resolve('templates/default-app');
|
||||
const builtInTemplate = opts.legacy
|
||||
? ownPaths.resolve('templates/default-app')
|
||||
: ownPaths.resolve('templates/next-app');
|
||||
|
||||
// Use `--template-path` argument as template when specified. Otherwise, use the default template.
|
||||
const templateDir = opts.templatePath
|
||||
|
||||
@@ -31,7 +31,7 @@ const main = (argv: string[]) => {
|
||||
.name('backstage-create-app')
|
||||
.version(version)
|
||||
.description('Creates a new app in a new directory or specified path')
|
||||
.option('--next', 'Use the next generation of the app template')
|
||||
.option('--legacy', 'Use the legacy version of the app template')
|
||||
.option(
|
||||
'--path [directory]',
|
||||
'Location to store the app defaulting to a new folder with the app name',
|
||||
|
||||
Reference in New Issue
Block a user