update default web-library files

Signed-off-by: Kurt King <kurt.king@procore.com>
Signed-off-by: Kurt King <kurtaking@gmail.com>
This commit is contained in:
Kurt King
2022-12-06 07:49:16 -06:00
committed by Kurt King
parent b063ad50c2
commit b028a2a228
10 changed files with 81 additions and 42 deletions
+1
View File
@@ -60,6 +60,7 @@
"@backstage/plugin-techdocs": "workspace:^",
"@backstage/plugin-techdocs-module-addons-contrib": "workspace:^",
"@backstage/plugin-techdocs-react": "workspace:^",
"@backstage/plugin-test": "^0.0.0",
"@backstage/plugin-todo": "workspace:^",
"@backstage/plugin-user-settings": "workspace:^",
"@backstage/theme": "workspace:^",
+1
View File
@@ -108,6 +108,7 @@ import { PlaylistIndexPage } from '@backstage/plugin-playlist';
import { TwoColumnLayout } from './components/scaffolder/customScaffolderLayouts';
import { ScoreBoardPage } from '@oriflame/backstage-plugin-score-card';
const app = createApp({
apis,
plugins: Object.values(plugins),
+1 -1
View File
@@ -16,6 +16,6 @@
export { frontendPlugin } from './frontendPlugin';
export { backendPlugin } from './backendPlugin';
export { webLibraryPackage } from './webLibraryPackage';
export { webLibrary } from './webLibrary';
export { pluginCommon } from './pluginCommon';
export { scaffolderModule } from './scaffolderModule';
@@ -31,8 +31,8 @@ type Options = {
codeOwnersPath?: string;
};
export const webLibraryPackage = createFactory<Options>({
name: 'web-library-package',
export const webLibrary = createFactory<Options>({
name: 'web-library',
description: 'A new web-library package',
optionsDiscovery: async () => ({
codeOwnersPath: await getCodeownersFilePath(paths.targetRoot),
@@ -42,7 +42,7 @@ export const webLibraryPackage = createFactory<Options>({
const { id } = options;
const name = ctx.scope
? `@${ctx.scope}/plugin-${id}`
? `@${ctx.scope}/${id}`
: `backstage-plugin-${id}`;
const extensionName = `${upperFirst(camelCase(id))}Page`;
@@ -50,7 +50,7 @@ export const webLibraryPackage = createFactory<Options>({
Task.log(`Creating web-library package ${chalk.cyan(name)}`);
const targetDir = ctx.isMonoRepo
? paths.resolveTargetRoot('plugins', id)
? paths.resolveTargetRoot('packages', id)
: paths.resolveTargetRoot(`backstage-plugin-${id}`);
await executePluginPackageTemplate(ctx, {
@@ -117,7 +117,7 @@ export const webLibraryPackage = createFactory<Options>({
}
if (options.owner) {
await addCodeownersEntry(`/plugins/${id}`, options.owner);
await addCodeownersEntry(`/packages/${id}`, options.owner);
}
await Task.forCommand('yarn install', { cwd: targetDir, optional: true });
@@ -1,14 +1,12 @@
# {{id}}
Welcome to the {{id}} web-library plugin!
_This package was created through the Backstage CLI_.
_This plugin was created through the Backstage CLI_
## Installation
## Getting started
Install the package via Yarn:
Your plugin has been added to the example app in this repository, meaning you'll be able to access it by running `yarn
start` in the root directory, and then navigating to [/{{id}}](http://localhost:3000/{{id}}).
You can also serve the plugin in isolation by running `yarn start` in the plugin directory.
This method of serving the plugin provides quicker iteration speed and a faster startup and hot reloads.
It is only meant for local development, and the setup for it can be found inside the [/dev](./dev) directory.
```sh
cd <package-dir> # if within a monorepo
yarn add @internal/{{id}}
```
@@ -1 +1,23 @@
export { {{ pluginVar }}, {{ extensionName }} } from './plugin';
/*
* Copyright 2020 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Core API used by Backstage plugins
*
* @packageDocumentation
*/
// export as needed from this file
@@ -1,7 +0,0 @@
import { {{ pluginVar }} } from './plugin';
describe('{{ id }}', () => {
it('should export plugin', () => {
expect({{ pluginVar }}).toBeDefined();
});
});
@@ -1,19 +0,0 @@
import { createPlugin, createRoutableExtension } from '@backstage/core-plugin-api';
import { rootRouteRef } from './routes';
export const {{ pluginVar }} = createPlugin({
id: '{{ id }}',
routes: {
root: rootRouteRef,
},
});
export const {{ extensionName }} = {{ pluginVar }}.provide(
createRoutableExtension({
name: '{{ extensionName }}',
component: () =>
import('./components/ExampleComponent').then(m => m.ExampleComponent),
mountPoint: rootRouteRef,
}),
);
@@ -1,2 +1,18 @@
/*
* Copyright 2020 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import '@testing-library/jest-dom';
import 'cross-fetch/polyfill';
+27
View File
@@ -8280,6 +8280,32 @@ __metadata:
languageName: unknown
linkType: soft
"@backstage/plugin-test@^0.0.0, @backstage/plugin-test@workspace:plugins/test":
version: 0.0.0-use.local
resolution: "@backstage/plugin-test@workspace:plugins/test"
dependencies:
"@backstage/cli": "workspace:^"
"@backstage/core-app-api": "workspace:^"
"@backstage/core-components": "workspace:^"
"@backstage/core-plugin-api": "workspace:^"
"@backstage/dev-utils": "workspace:^"
"@backstage/test-utils": "workspace:^"
"@backstage/theme": "workspace:^"
"@material-ui/core": ^4.9.13
"@material-ui/icons": ^4.9.1
"@material-ui/lab": ^4.0.0-alpha.57
"@testing-library/jest-dom": ^5.10.1
"@testing-library/react": ^12.1.3
"@testing-library/user-event": ^14.0.0
"@types/node": "*"
cross-fetch: ^3.1.5
msw: ^0.49.0
react-use: ^17.2.4
peerDependencies:
react: ^16.13.1 || ^17.0.0
languageName: unknown
linkType: soft
"@backstage/plugin-todo-backend@workspace:^, @backstage/plugin-todo-backend@workspace:plugins/todo-backend":
version: 0.0.0-use.local
resolution: "@backstage/plugin-todo-backend@workspace:plugins/todo-backend"
@@ -21987,6 +22013,7 @@ __metadata:
"@backstage/plugin-techdocs": "workspace:^"
"@backstage/plugin-techdocs-module-addons-contrib": "workspace:^"
"@backstage/plugin-techdocs-react": "workspace:^"
"@backstage/plugin-test": ^0.0.0
"@backstage/plugin-todo": "workspace:^"
"@backstage/plugin-user-settings": "workspace:^"
"@backstage/test-utils": "workspace:^"