Lighthouse CI for Local Auditing.
Lighthouse is a tool for auditing web pages for accessibility and performance.
- Navigate to your projects/dev/code directory.
git clone https://github.com/rawnet/rawnet-ci.gitcd rawnet-cinvm use 16+or lighthouse packages will not audit pages.npm install
-
In your editor open
lighthouserc.js -
Set the
numberOfRunsper url you want to audit. -
Amend the
url: []array to contain the pages you want to audit. -
npm run lhci:serverstarts the Lighthouse CI server. -
npm run lhci:wizardstarts the Lighthouse CI wizard.- Will prompt you with questions regarding the audit.
- Generates a build token in the CLI (store this somewhere safe).
- Generates an admin token in the CLI (store this somewhere safe).
- Replace the current token here with the one just generated:
upload: { token: "###" }.- This is required so that lhci can generate a new project on the local server for different urls passed through in the steps above.
-
If it has not already, navigate to
http://localhost:9001/.
- Add Lighthouse CI Server so we can persist running Lighthouse audits long term.
- Host externally so our audits don;t affect normal CI-CD.
- Refactor into an npm package we can import into each of our projects to audit.
- Fix concurrently script command.
- Add budgets.json to the config.
Currently using the --additive flag to audit all the pages in the url array rather than using lhci autorun as we need to gather the results for desktop and mobile separately.
This means that we need to lhci collect as specified in the npm run lhci:mobile || npm run lhci:desktop commands which run the --additive flags respectively.
I have grouped these commands under npm run lhci:all which run both mobile and desktop audits.
We then need to run lhci upload to upload the results to the server or our specified solution.
lhci collectlhci assertlhci upload
Instead of
lhci autorun