forked from backstage/backstage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request backstage#461 from spotify/lighthouse-plugin
Add plugin for lighthouse-audit-service
- Loading branch information
Showing
46 changed files
with
3,143 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
extends: [require.resolve('@backstage/cli/config/eslint.js')], | ||
}; |
1 change: 0 additions & 1 deletion
1
...mplates/default-plugin/src/components/ExampleFetchComponent/ExampleFetchComponent.tsx.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
/* eslint-disable react/prop-types */ | ||
/* | ||
* Copyright 2020 Spotify AB | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
extends: [require.resolve('@backstage/cli/config/eslint.js')], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
extends: [require.resolve('@backstage/cli/config/eslint.js')], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# @backstage/plugin-lighthouse | ||
|
||
A frontend for [lighthouse-audit-service](https://github.com/spotify/lighthouse-audit-service), this plugin allows you to trigger Lighthouse audits on websites and track them over time. | ||
|
||
## Getting Started | ||
|
||
### Use cases | ||
|
||
Google's [Lighthouse](https://developers.google.com/web/tools/lighthouse) auditing tool for websites | ||
is a great open-source resource forbenchmarking and improving the accessibility, performance, SEO, and best practices of your site. | ||
At Spotify, we keep track of Lighthouse audit scores over time to look at trends and overall areas for investment. | ||
|
||
This plugin allows you to generate on-demand Lighthouse audits for websites, and to track the trends for the | ||
top-level categories of Lighthouse at a glance. | ||
|
||
In the future, we hope to add support for scheduling audits (which we do internally), as well as allowing | ||
custom runs of Lighthouse to be ingested (for auditing sites that require authentication or some session state). | ||
|
||
### Installation | ||
|
||
To get started, you will need a running instance of [lighthouse-audit-service](https://github.com/spotify/lighthouse-audit-service). | ||
_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/spotify/backstage/blob/master/packages/app/src/plugins.ts) | ||
to enable the plugin: | ||
|
||
```js | ||
import { default as LighthousePlugin } from '@backstage/plugin-lighthouse'; | ||
export LighthousePlugin; | ||
``` | ||
|
||
Then, you need to use the `lighthouseApiRef` exported from the plugin to initialize the Rest API in | ||
your [`apis.ts`](https://github.com/spotify/backstage/blob/master/packages/app/src/apis.ts). | ||
|
||
```js | ||
import { ApiHolder, ApiRegistry } from '@backstage/core'; | ||
import { | ||
lighthouseApiRef, | ||
LighthouseRestApi, | ||
} from '@backstage/lighthouse-audits'; | ||
|
||
const builder = ApiRegistry.builder(); | ||
|
||
export const lighthouseApi = | ||
new LighthouseRestApi(/* your service url here! */); | ||
builder.add(lighthouseApiRef, lighthouseApi); | ||
|
||
export default builder.build() as ApiHolder; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"name": "@backstage/plugin-lighthouse", | ||
"version": "0.1.1-alpha.3", | ||
"main": "dist/index.cjs.js", | ||
"types": "dist/index.d.ts", | ||
"license": "Apache-2.0", | ||
"private": true, | ||
"scripts": { | ||
"build:watch": "backstage-cli plugin:build --watch", | ||
"build": "backstage-cli plugin:build", | ||
"lint": "backstage-cli lint", | ||
"test": "backstage-cli test" | ||
}, | ||
"dependencies": { | ||
"react-markdown": "^4.3.1", | ||
"react-sparklines": "^1.7.0" | ||
}, | ||
"devDependencies": { | ||
"@backstage/cli": "^0.1.1-alpha.3", | ||
"@backstage/core": "^0.1.1-alpha.3", | ||
"@backstage/test-utils": "^0.1.1-alpha.3", | ||
"@backstage/theme": "^0.1.1-alpha.3", | ||
"@material-ui/core": "^4.9.1", | ||
"@material-ui/icons": "^4.9.1", | ||
"@material-ui/lab": "4.0.0-alpha.45", | ||
"@testing-library/jest-dom": "^4.2.4", | ||
"@testing-library/react": "^9.3.2", | ||
"@testing-library/user-event": "^7.1.2", | ||
"@types/jest": "^24.0.0", | ||
"@types/node": "^12.0.0", | ||
"@types/react-sparklines": "^1.7.0", | ||
"@types/testing-library__jest-dom": "5.0.2", | ||
"jest-fetch-mock": "^3.0.3", | ||
"react": "^16.13.1", | ||
"react-dom": "^16.13.1", | ||
"react-router-dom": "^5.1.2", | ||
"react-use": "^13.24.0" | ||
}, | ||
"peerDependencies": { | ||
"@backstage/core": "^0.1.1-alpha.3", | ||
"@backstage/theme": "^0.1.1-alpha.3", | ||
"@material-ui/core": "^4.9.1", | ||
"@material-ui/icons": "^4.9.1", | ||
"@material-ui/lab": "4.0.0-alpha.45", | ||
"react": "^16.13.1", | ||
"react-dom": "^16.13.1", | ||
"react-router-dom": "^5.1.2", | ||
"react-use": "^13.24.0" | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
plugins/lighthouse/src/__fixtures__/create-audit-response.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"id": "80d92fff-52ec-4ef5-848f-9cec8b383e41", | ||
"url": "https://anchor.fm", | ||
"timeCreated": "2020-03-31T15:34:02.199-04:00", | ||
"status": "RUNNING" | ||
} |
Oops, something went wrong.