README: updated instructions for creating plugin + yarn script and remove cookiecutter

This commit is contained in:
Patrik Oldsberg
2020-02-24 11:42:12 +01:00
parent 6e7d00e5eb
commit d3451aa5c9
18 changed files with 15 additions and 187 deletions
+14 -15
View File
@@ -50,29 +50,28 @@ The final `yarn start` command should open a local instance of Backstage in your
### Creating a Plugin
Run the following:
To create a new plugin, go to the `frontend/` directory and run the following:
```bash
$ make scaffold-new-frontend-plugin
$ yarn && yarn create-plugin
```
This will generate a plugin in the `frontend/packages/plugins` folder. It is important to note you will still need to include the plugin in your `frontend/packages/app` in the `package.json`. You will then be able to import it as follows:
This will prompt you to enter an ID for your plugin, and then create your plugin inside the `packages/plugins/` directory. Note that the plugin will not yet be included in the app, to include it add the following for a plugin called `my-plugin`:
```bash
$ make scaffold-new-frontend-plugin
plugin_name [example-plugin]: github-api
In `"dependencies"` inside [packages/app/package.json](frontend/packages/app/package.json) add the following:
$ vim frontend/packages/app/package.json
# Add the following line to your package.json
# Note all plugins are prefixed with "plugin-" by default with a version number of "0.0.0"
# "@backstage/plugin-github-api": "0.0.0",
$ vim frontend/packages/app/src/App.tsx
# Add the following line to import your generated component
# import { ExampleComponent } from '@backstage/plugin-github-api';
# <ExampleComponent />
```json
"@spotify-backstage/plugin-my-plugin": "0.0.0"
```
In [packages/app/src/plugins.ts](frontend/packages/app/src/plugins.ts), add the following:
```
export { default as MyPlugin } from '@spotify-backstage/plugin-my-plugin';
```
You should now be able to see the default plugin page at [localhost:3000/my-plugin](http://localhost:3000/my-plugin) if you're serving the frontend.
## Protobuf Definitions
The protobuf definitions are all found in the `/proto` folder in the project root. They are used to generate code for gRPC communication for both the frontend and backend. The generated code is checked into version control though, so unless you want to change the protobuf definitions you don't need to install any tooling.