goldeneye-lighthouse 💡
AWS CDK Library
Overview
GoldenEye Lighthouse is an AWS CDK (Cloud Development Kit) library designed to seamlessly integrate Google Lighthouse tests into web applications onboarded into GoldenEye within an AWS CodePipeline. This allows you to automate the performance auditing process as part of your CI/CD pipeline.
Features
- Integration with AWS CodePipeline: Easily add Lighthouse tests as part of your CodePipeline.
- Detailed Reports: Access detailed reports generated by Google Lighthouse to identify performance bottlenecks.
Getting Started
Prerequisites
- AWS CLI installed and configured
- Node.js and npm installed
- AWS CDK installed (
npm install -g aws-cdk
)
Installation
Install the Lighthouse library using npm:
npm i @studyportals/goldeneye-lighthouse
Usage
import * as cdk from '@aws-cdk/core';
import { LighthouseTests } from '@studyportals/goldeneye-lighthouse';
const app = new cdk.App();
const stack = new cdk.Stack(app, 'LighthouseTestsStack');
new LighthouseTests(stack, 'MyLighthouseTests', {
lhci: {
categories: ['accessibility', 'best-practices', 'seo'],
chromeFlags: ['--no-sandbox', '--headless'],
extraHeaders: JSON.stringify({ 'x-foo': 'bar' }),
runs: 1,
urls: ['https://example.com']
},
persistResults: true,
serviceDescriptor: 'my-service',
sourceArtifact: mySourceArtifact,
testReportsBucket: myTestReportsBucket
});
Useful commands
-
npm run build
compile TypeScript to JavaScript -
npm run watch
watch for changes and compile -
npm run test
perform the jest unit tests