cli: fix non-monorepo package naming for create
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -73,7 +73,7 @@ describe('backendPlugin factory', () => {
|
||||
|
||||
expect(output).toEqual([
|
||||
'',
|
||||
'Creating backend plugin plugin-test-backend',
|
||||
'Creating backend plugin backstage-plugin-test-backend',
|
||||
'Checking Prerequisites:',
|
||||
'availability plugins/test-backend ✔',
|
||||
'creating temp dir ✔',
|
||||
@@ -97,7 +97,7 @@ describe('backendPlugin factory', () => {
|
||||
fs.readJson('/root/packages/backend/package.json'),
|
||||
).resolves.toEqual({
|
||||
dependencies: {
|
||||
'plugin-test-backend': '^1.0.0',
|
||||
'backstage-plugin-test-backend': '^1.0.0',
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -39,7 +39,9 @@ export const backendPlugin = createFactory<Options>({
|
||||
optionsPrompts: [pluginIdPrompt(), ownerPrompt()],
|
||||
async create(options: Options, ctx: CreateContext) {
|
||||
const id = `${options.id}-backend`;
|
||||
const name = ctx.scope ? `@${ctx.scope}/plugin-${id}` : `plugin-${id}`;
|
||||
const name = ctx.scope
|
||||
? `@${ctx.scope}/plugin-${id}`
|
||||
: `backstage-plugin-${id}`;
|
||||
|
||||
Task.log();
|
||||
Task.log(`Creating backend plugin ${chalk.cyan(name)}`);
|
||||
|
||||
@@ -86,7 +86,7 @@ describe('frontendPlugin factory', () => {
|
||||
|
||||
expect(output).toEqual([
|
||||
'',
|
||||
'Creating backend plugin plugin-test',
|
||||
'Creating backend plugin backstage-plugin-test',
|
||||
'Checking Prerequisites:',
|
||||
'availability plugins/test ✔',
|
||||
'creating temp dir ✔',
|
||||
@@ -117,14 +117,14 @@ describe('frontendPlugin factory', () => {
|
||||
fs.readJson('/root/packages/app/package.json'),
|
||||
).resolves.toEqual({
|
||||
dependencies: {
|
||||
'plugin-test': '^1.0.0',
|
||||
'backstage-plugin-test': '^1.0.0',
|
||||
},
|
||||
});
|
||||
|
||||
await expect(fs.readFile('/root/packages/app/src/App.tsx', 'utf8')).resolves
|
||||
.toBe(`
|
||||
import { createApp } from '@backstage/app-defaults';
|
||||
import { TestPage } from 'plugin-test';
|
||||
import { TestPage } from 'backstage-plugin-test';
|
||||
|
||||
const router = (
|
||||
<FlatRoutes>
|
||||
|
||||
@@ -41,7 +41,9 @@ export const frontendPlugin = createFactory<Options>({
|
||||
async create(options: Options, ctx: CreateContext) {
|
||||
const { id } = options;
|
||||
|
||||
const name = ctx.scope ? `@${ctx.scope}/plugin-${id}` : `plugin-${id}`;
|
||||
const name = ctx.scope
|
||||
? `@${ctx.scope}/plugin-${id}`
|
||||
: `backstage-plugin-${id}`;
|
||||
const extensionName = `${upperFirst(camelCase(id))}Page`;
|
||||
|
||||
Task.log();
|
||||
|
||||
@@ -68,7 +68,7 @@ describe('pluginCommon factory', () => {
|
||||
|
||||
expect(output).toEqual([
|
||||
'',
|
||||
'Creating backend plugin plugin-test-common',
|
||||
'Creating backend plugin backstage-plugin-test-common',
|
||||
'Checking Prerequisites:',
|
||||
'availability plugins/test-common ✔',
|
||||
'creating temp dir ✔',
|
||||
@@ -87,7 +87,7 @@ describe('pluginCommon factory', () => {
|
||||
fs.readJson('/root/plugins/test-common/package.json'),
|
||||
).resolves.toEqual(
|
||||
expect.objectContaining({
|
||||
name: 'plugin-test-common',
|
||||
name: 'backstage-plugin-test-common',
|
||||
description: 'Common functionalities for the test plugin',
|
||||
private: true,
|
||||
version: '1.0.0',
|
||||
|
||||
@@ -40,7 +40,7 @@ export const pluginCommon = createFactory<Options>({
|
||||
const suffix = `${id}-common`;
|
||||
const name = ctx.scope
|
||||
? `@${ctx.scope}/plugin-${suffix}`
|
||||
: `plugin-${suffix}`;
|
||||
: `backstage-plugin-${suffix}`;
|
||||
|
||||
Task.log();
|
||||
Task.log(`Creating backend plugin ${chalk.cyan(name)}`);
|
||||
|
||||
Reference in New Issue
Block a user