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:
@@ -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