Skip to content

Commit

Permalink
docs(plugin-lighthouse): add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
BioPhoton committed Mar 8, 2024
1 parent 2bafe47 commit d96ae78
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
52 changes: 51 additions & 1 deletion packages/plugin-lighthouse/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,53 @@
# @code-pushup/lighthouse-plugin

TODO: docs
[![npm](https://img.shields.io/npm/v/%40code-pushup%2Flighthouse-plugin.svg)](https://www.npmjs.com/package/@code-pushup/lighthouse-plugin)
[![downloads](https://img.shields.io/npm/dm/%40code-pushup%2Flighthouse-plugin)](https://npmtrends.com/@code-pushup/lighthouse-plugin)
[![dependencies](https://img.shields.io/librariesio/release/npm/%40code-pushup/lighthouse-plugin)](https://www.npmjs.com/package/@code-pushup/lighthouse-plugin?activeTab=dependencies)

🕵️ **Code PushUp plugin for running lighthouse performance tests.** 📋

---

The plugin parses your lighthouse configuration and lints all audits of the official [lighthouse](https://github.com/GoogleChrome/lighthouse/blob/main/readme.md#lighthouse-------).

Detected lighthouse audits are mapped to Code PushUp audits. Audit reports are calculated based on the [original implementation](https://googlechrome.github.io/lighthouse/scorecalc/).

## Getting started

1. If you haven't already, install [@code-pushup/cli](../cli/README.md) and create a configuration file.

2. Install as a dev dependency with your package manager:

```sh
npm install --save-dev @code-pushup/lighthouse-plugin
```

```sh
yarn add --dev @code-pushup/lighthouse-plugin
```

```sh
pnpm add --save-dev @code-pushup/lighthouse-plugin
```

3. Add this plugin to the `plugins` array in your Code PushUp CLI config file (e.g. `code-pushup.config.ts`).

Pass in the path to your ESLint config file, along with glob patterns for which files you wish to target (relative to `process.cwd()`).
```ts
import lighthousePlugin from '@code-pushup/lighthouse-plugin';

export default {
// ...
plugins: [
// ...
await lighthousePlugin('https://example.com'),
],
};
```
4. Run the CLI with `npx code-pushup collect` and view or upload report (refer to [CLI docs](../cli/README.md)).
### Optionally set up categories
@TODO
1 change: 1 addition & 0 deletions packages/plugin-lighthouse/src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export const DEFAULT_CLI_FLAGS: Partial<CliFlags> = {
verbose: false,
quiet: false,
saveAssets: false,
// needed to pass CI on linux and windows (locally it works without headless too)
chromeFlags: '--headless=new',
port: 0,
hostname: '127.0.0.1',
Expand Down

0 comments on commit d96ae78

Please sign in to comment.