rename the role to frontend-extensions

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2024-08-12 10:25:35 +02:00
parent 0f7452c030
commit 705794def5
14 changed files with 47 additions and 47 deletions
+1 -1
View File
@@ -4,4 +4,4 @@
'@backstage/eslint-plugin': patch
---
Added support for the `frontend-extensions-bundle` role, which is used in conjunction with the new frontend system to ship extensions to your apps.
Added support for the `frontend-extensions` role, which is used in conjunction with the new frontend system to ship extensions to your apps.
+13 -13
View File
@@ -93,19 +93,19 @@ defined in the `package.json` of each package like this:
These are the available roles that are currently supported by the Backstage build system:
| Role | Description | Example |
| -------------------------- | -------------------------------------------- | -------------------------------------------- |
| frontend | Bundled frontend application | `packages/app` |
| backend | Bundled backend application | `packages/backend` |
| cli | Package used as a command-line interface | `@backstage/cli`, `@backstage/codemods` |
| web-library | Web library for use by other packages | `@backstage/plugin-catalog-react` |
| node-library | Node.js library for use by other packages | `@backstage/plugin-techdocs-node` |
| common-library | Isomorphic library for use by other packages | `@backstage/plugin-permission-common` |
| frontend-plugin | Backstage frontend plugin | `@backstage/plugin-scaffolder` |
| frontend-extensions-bundle | Extensions for the Backstage frontend | Typically only appears in adopter repos |
| frontend-plugin-module | Backstage frontend plugin module | `@backstage/plugin-analytics-module-ga` |
| backend-plugin | Backstage backend plugin | `@backstage/plugin-auth-backend` |
| backend-plugin-module | Backstage backend plugin module | `@backstage/plugin-search-backend-module-pg` |
| Role | Description | Example |
| ---------------------- | ----------------------------------------------------------------------------- | -------------------------------------------- |
| frontend | Bundled frontend application | `packages/app` |
| backend | Bundled backend application | `packages/backend` |
| cli | Package used as a command-line interface | `@backstage/cli`, `@backstage/codemods` |
| web-library | Web library for use by other packages | `@backstage/plugin-catalog-react` |
| node-library | Node.js library for use by other packages | `@backstage/plugin-techdocs-node` |
| common-library | Isomorphic library for use by other packages | `@backstage/plugin-permission-common` |
| frontend-plugin | Backstage frontend plugin | `@backstage/plugin-scaffolder` |
| frontend-extensions | Extensions (customizations, private additions etc) for the Backstage frontend | Typically only appears in adopter repos |
| frontend-plugin-module | Backstage frontend plugin module | `@backstage/plugin-analytics-module-ga` |
| backend-plugin | Backstage backend plugin | `@backstage/plugin-auth-backend` |
| backend-plugin-module | Backstage backend plugin module | `@backstage/plugin-search-backend-module-pg` |
Most of the steps that we cover below have an accompanying command that is intended to be used as a package script. The commands are all available under the `backstage-cli package` category, and many of the commands will behave differently depending on the role of the package. The commands are intended to be used like this:
@@ -5,5 +5,5 @@ metadata:
title: '@internal/app-next-example-extensions'
spec:
lifecycle: experimental
type: backstage-frontend-extensions-bundle
type: backstage-frontend-extensions
owner: maintainers
@@ -1,27 +1,30 @@
{
"name": "@internal/app-next-example-extensions",
"version": "0.0.0",
"private": true,
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
"backstage": {
"role": "frontend-extensions"
},
"publishConfig": {
"access": "public",
"main": "dist/index.esm.js",
"types": "dist/index.d.ts"
},
"backstage": {
"role": "frontend-extensions-bundle"
},
"private": true,
"license": "Apache-2.0",
"sideEffects": false,
"main": "src/index.ts",
"types": "src/index.ts",
"files": [
"dist"
],
"scripts": {
"start": "backstage-cli package start",
"build": "backstage-cli package build",
"lint": "backstage-cli package lint",
"test": "backstage-cli package test",
"clean": "backstage-cli package clean",
"lint": "backstage-cli package lint",
"prepack": "backstage-cli package prepack",
"postpack": "backstage-cli package postpack"
"postpack": "backstage-cli package postpack",
"start": "backstage-cli package start",
"test": "backstage-cli package test"
},
"dependencies": {
"@backstage/core-components": "workspace:^",
@@ -34,11 +37,6 @@
"@material-ui/lab": "^4.0.0-alpha.61",
"react-use": "^17.2.4"
},
"peerDependencies": {
"react": "^16.13.1 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0",
"react-router-dom": "6.0.0-beta.0 || ^6.3.0"
},
"devDependencies": {
"@backstage/cli": "workspace:^",
"@backstage/core-app-api": "workspace:^",
@@ -49,7 +47,9 @@
"@testing-library/user-event": "^14.0.0",
"msw": "^1.0.0"
},
"files": [
"dist"
]
"peerDependencies": {
"react": "^16.13.1 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0",
"react-router-dom": "6.0.0-beta.0 || ^6.3.0"
}
}
+1 -1
View File
@@ -54,7 +54,7 @@ const packageRoleInfos: PackageRoleInfo[] = [
output: ['types', 'esm'],
},
{
role: 'frontend-extensions-bundle',
role: 'frontend-extensions',
platform: 'web',
output: ['types', 'esm'],
},
+1 -1
View File
@@ -27,7 +27,7 @@ export type PackageRole =
| 'node-library'
| 'common-library'
| 'frontend-plugin'
| 'frontend-extensions-bundle'
| 'frontend-extensions'
| 'frontend-plugin-module'
| 'backend-plugin'
| 'backend-plugin-module';
+1 -1
View File
@@ -200,7 +200,7 @@ function createConfigForRole(dir, role, extraConfig = {}) {
case 'web-library':
case 'frontend':
case 'frontend-plugin':
case 'frontend-extensions-bundle':
case 'frontend-extensions':
case 'frontend-plugin-module':
case 'frontend-dynamic-container':
return createConfig(dir, {
+1 -1
View File
@@ -54,7 +54,7 @@ function getRoleConfig(role) {
case 'web-library':
case 'common-library':
case 'frontend-plugin':
case 'frontend-extensions-bundle':
case 'frontend-extensions':
case 'frontend-plugin-module':
return { testEnvironment: require.resolve('jest-environment-jsdom') };
case 'cli':
+2 -2
View File
@@ -246,7 +246,7 @@ function guessPluginId(role: PackageRole, pkgName: string): string | undefined {
case 'frontend':
case 'frontend-plugin':
return pkgName.match(/plugin-(.*)/)?.[1];
case 'frontend-extensions-bundle':
case 'frontend-extensions':
return undefined;
case 'frontend-plugin-module':
return pkgName.match(/plugin-(.*)-module-/)?.[1];
@@ -366,7 +366,7 @@ export function fixPluginPackages(
role === 'common-library' ||
role === 'web-library' ||
role === 'node-library' ||
role === 'frontend-extensions-bundle' ||
role === 'frontend-extensions' ||
role === 'frontend-plugin-module' // TODO(Rugvip): Remove this once frontend modules are required to have a plugin ID
) {
return;
+1 -1
View File
@@ -46,7 +46,7 @@ export async function command(opts: OptionValues): Promise<void> {
});
case 'web-library':
case 'frontend-plugin':
case 'frontend-extensions-bundle':
case 'frontend-extensions':
case 'frontend-plugin-module':
return startFrontend({ entry: 'dev/index', ...options });
case 'frontend-dynamic-container' as PackageRole: // experimental
@@ -86,7 +86,7 @@ async function detectPackages(
if (
[
'frontend-plugin',
'frontend-extensions-bundle',
'frontend-extensions',
'frontend-plugin-module',
].includes(depPackageJson.backstage?.role ?? '')
) {
@@ -48,7 +48,7 @@ function getExpectedDepType(
case 'common-library':
case 'web-library':
case 'frontend-plugin':
case 'frontend-extensions-bundle':
case 'frontend-extensions':
case 'frontend-plugin-module':
case 'node-library':
case 'backend-plugin':
@@ -28,7 +28,7 @@ async function main() {
if (
pkgRole === 'frontend-plugin' ||
pkgRole === 'web-library' ||
pkgRole === 'frontend-extensions-bundle'
pkgRole === 'frontend-extensions'
) {
const depKeys = Object.keys(pkg.packageJson.dependencies);
if (depKeys.findIndex(d => d.includes('@material-ui')) !== -1) {
+3 -3
View File
@@ -45,7 +45,7 @@ const roleRules = [
'frontend-plugin',
'web-library',
'frontend-plugin-module',
'frontend-extensions-bundle',
'frontend-extensions',
],
message: `Package SOURCE_NAME with backend role SOURCE_ROLE has a dependency on package TARGET_NAME with frontend role TARGET_ROLE, which is not permitted`,
},
@@ -55,7 +55,7 @@ const roleRules = [
'frontend-plugin',
'web-library',
'frontend-plugin-module',
'frontend-extensions-bundle',
'frontend-extensions',
'backend-plugin',
'node-library',
'backend-plugin-module',
@@ -67,7 +67,7 @@ const roleRules = [
targetRole: [
'frontend-plugin',
'frontend-plugin-module',
'frontend-extensions-bundle',
'frontend-extensions',
],
except: [
// TODO(freben): Address these