cli: rename plugin-x roles to x-plugin

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-02-13 22:59:30 +01:00
parent c77c5c7eb6
commit d3381edcb1
4 changed files with 20 additions and 20 deletions
+4 -4
View File
@@ -31,8 +31,8 @@ export async function command(cmd: Command): Promise<void> {
switch (role) {
case 'backend':
case 'plugin-backend':
case 'plugin-backend-module':
case 'backend-plugin':
case 'backend-plugin-module':
case 'node-library':
return startBackend(options);
case 'app':
@@ -42,8 +42,8 @@ export async function command(cmd: Command): Promise<void> {
verifyVersions: true,
});
case 'web-library':
case 'plugin-frontend':
case 'plugin-frontend-module':
case 'frontend-plugin':
case 'frontend-plugin-module':
return startFrontend({ entry: 'dev/index', ...options });
default:
throw new Error(
@@ -180,7 +180,7 @@ describe('detectRoleFromPackage', () => {
clean: 'backstage-cli clean',
},
}),
).toEqual('plugin-frontend');
).toEqual('frontend-plugin');
});
it('detects the role of @backstage/plugin-catalog-backend', () => {
@@ -204,7 +204,7 @@ describe('detectRoleFromPackage', () => {
clean: 'backstage-cli clean',
},
}),
).toEqual('plugin-backend');
).toEqual('backend-plugin');
});
it('detects the role of @backstage/plugin-catalog-react', () => {
@@ -274,7 +274,7 @@ describe('detectRoleFromPackage', () => {
clean: 'backstage-cli clean',
},
}),
).toEqual('plugin-backend-module');
).toEqual('backend-plugin-module');
});
it('detects the role of @backstage/plugin-permission-node', () => {
@@ -323,6 +323,6 @@ describe('detectRoleFromPackage', () => {
clean: 'backstage-cli clean',
},
}),
).toEqual('plugin-frontend-module');
).toEqual('frontend-plugin-module');
});
});
+8 -8
View File
@@ -52,22 +52,22 @@ const packageRoleInfos: PackageRoleInfo[] = [
output: ['types', 'esm', 'cjs'],
},
{
role: 'plugin-frontend',
role: 'frontend-plugin',
platform: 'web',
output: ['types', 'esm'],
},
{
role: 'plugin-frontend-module',
role: 'frontend-plugin-module',
platform: 'web',
output: ['types', 'esm'],
},
{
role: 'plugin-backend',
role: 'backend-plugin',
platform: 'node',
output: ['types', 'cjs'],
},
{
role: 'plugin-backend-module',
role: 'backend-plugin-module',
platform: 'node',
output: ['types', 'cjs'],
},
@@ -153,16 +153,16 @@ export function detectRoleFromPackage(
return 'backend';
}
if (pkg.name?.includes('plugin-') && pkg.name?.includes('-backend-module-')) {
return 'plugin-backend-module';
return 'backend-plugin-module';
}
if (pkg.name?.includes('plugin-') && pkg.name?.includes('-module-')) {
return 'plugin-frontend-module';
return 'frontend-plugin-module';
}
if (pkg.scripts?.start?.includes('plugin:serve')) {
return 'plugin-frontend';
return 'frontend-plugin';
}
if (pkg.scripts?.start?.includes('backend:dev')) {
return 'plugin-backend';
return 'backend-plugin';
}
const mainEntry = pkg.publishConfig?.main || pkg.main;
+4 -4
View File
@@ -21,10 +21,10 @@ export type PackageRole =
| 'web-library'
| 'node-library'
| 'common-library'
| 'plugin-frontend'
| 'plugin-frontend-module'
| 'plugin-backend'
| 'plugin-backend-module';
| 'frontend-plugin'
| 'frontend-plugin-module'
| 'backend-plugin'
| 'backend-plugin-module';
export type PackagePlatform = 'node' | 'web' | 'common';
export type PackageOutputType = 'bundle' | 'types' | 'esm' | 'cjs';