Merge pull request #15751 from sennyeya/carmen
`backstage-cli new` duplicated `-backend` in `standaloneServer.ts` stubs
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/cli': patch
|
||||
---
|
||||
|
||||
Updated backend plugin ID during creation to match user-entered input.
|
||||
@@ -100,6 +100,15 @@ describe('backendPlugin factory', () => {
|
||||
'backstage-plugin-test-backend': '^1.0.0',
|
||||
},
|
||||
});
|
||||
const standaloneServerFile = await fs.readFile(
|
||||
'/root/plugins/test-backend/src/service/standaloneServer.ts',
|
||||
'utf-8',
|
||||
);
|
||||
|
||||
expect(standaloneServerFile).toContain(
|
||||
`const logger = options.logger.child({ service: 'test-backend' });`,
|
||||
);
|
||||
expect(standaloneServerFile).toContain(`.addRouter('/test', router);`);
|
||||
|
||||
expect(Task.forCommand).toHaveBeenCalledTimes(2);
|
||||
expect(Task.forCommand).toHaveBeenCalledWith('yarn install', {
|
||||
|
||||
@@ -38,17 +38,18 @@ export const backendPlugin = createFactory<Options>({
|
||||
}),
|
||||
optionsPrompts: [pluginIdPrompt(), ownerPrompt()],
|
||||
async create(options: Options, ctx: CreateContext) {
|
||||
const id = `${options.id}-backend`;
|
||||
const { id } = options;
|
||||
const pluginId = `${id}-backend`;
|
||||
const name = ctx.scope
|
||||
? `@${ctx.scope}/plugin-${id}`
|
||||
: `backstage-plugin-${id}`;
|
||||
? `@${ctx.scope}/plugin-${pluginId}`
|
||||
: `backstage-plugin-${pluginId}`;
|
||||
|
||||
Task.log();
|
||||
Task.log(`Creating backend plugin ${chalk.cyan(name)}`);
|
||||
|
||||
const targetDir = ctx.isMonoRepo
|
||||
? paths.resolveTargetRoot('plugins', id)
|
||||
: paths.resolveTargetRoot(`backstage-plugin-${id}`);
|
||||
? paths.resolveTargetRoot('plugins', pluginId)
|
||||
: paths.resolveTargetRoot(`backstage-plugin-${pluginId}`);
|
||||
|
||||
await executePluginPackageTemplate(ctx, {
|
||||
targetDir,
|
||||
|
||||
Reference in New Issue
Block a user