[Lighthouse plugin] Change setup wording of intro card to latest

This commit is contained in:
Tadashi Nemoto
2021-03-01 19:48:25 +09:00
parent cf9a229a3e
commit dbea11072f
2 changed files with 26 additions and 15 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-lighthouse': patch
---
Change setup wording of intro card to latest
@@ -41,31 +41,37 @@ To get started, you will need a running instance of [lighthouse-audit-service](h
_It's likely you will need to enable CORS when running lighthouse-audit-service. Initialize the app
with the environment variable \`LAS_CORS\` set to \`true\`._
When you have an instance running that Backstage can hook into, make sure to export the plugin in
your app's [\`plugins.ts\`](https://github.com/backstage/backstage/blob/master/packages/app/src/plugins.ts)
to enable the plugin:
When you have an instance running that Backstage can hook into, first install the plugin into your app:
\`\`\`sh
$ yarn add @backstage/plugin-lighthouse
\`\`\`
Then make sure to export the plugin in your app's [\`plugins.ts\`](https://github.com/backstage/backstage/blob/master/packages/app/src/plugins.ts) to enable the plugin:
\`\`\`js
export { plugin as LighthousePlugin } from '@backstage/plugin-lighthouse';
\`\`\`
Then, you need to use the \`lighthouseApiRef\` exported from the plugin to initialize the Rest API in
your [\`apis.ts\`](https://github.com/backstage/backstage/blob/master/packages/app/src/apis.ts).
Modify your app routes in \`App.tsx\` to include the Router component exported from the plugin, for example:
\`\`\`js
import { ApiHolder, ApiRegistry } from '@backstage/core';
import {
lighthouseApiRef,
LighthouseRestApi,
} from '@backstage/plugin-lighthouse';
// At the top imports
import { Router as LighthouseRouter } from '@backstage/plugin-lighthouse';
const builder = ApiRegistry.builder();
// Inside App component
<Routes>
// ...
<Route path="/lighthouse/*" element={<LighthouseRouter />} />
// ...
</Routes>;
\`\`\`
export const lighthouseApi =
new LighthouseRestApi(/* your service url here! */);
builder.add(lighthouseApiRef, lighthouseApi);
Then configure the \`lighthouse-audit-service\` URL in your [\`app-config.yaml\`](https://github.com/backstage/backstage/blob/master/app-config.yaml).
export default builder.build() as ApiHolder;
\`\`\`yaml
lighthouse:
baseUrl: http://your-service-url
\`\`\`
`;