-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Labels
Description
User story
Our setup wizard should be able to configure a basic working version of each of our official plugins. Each plugin may prompt for its own specific configuration options and infer smart defaults from the user's repo. The resulting configuration code adds the plugin to the user's config and sets up some basic categories.
This issue is about @code-pushup/lighthouse-plugin specifically.
Output example
import lighthousePlugin, { lighthouseGroupRefs } from '@code-pushup/lighthouse-plugin';
import type { CoreConfig } from '@code-pushup/models';
const lhPlugin = await lighthousePlugin('http://localhost:4200');
const config: CoreConfig = {
plugins: [lhPlugin],
categories: [
{
slug: 'performance',
title: 'Performance',
description: 'Measure performance and find opportunities to speed up page loads.',
refs: lighthouseGroupRefs(lhPlugin, 'performance'),
},
{
slug: 'a11y',
title: 'Accessibility',
description: 'Determine if all users access content and navigate your site effectively.',
refs: lighthouseGroupRefs(lhPlugin, 'accessibility'),
},
{
slug: 'best-practices',
title: 'Best Practices',
description: 'Improve code health of your web page following these best practices.',
refs: lighthouseGroupRefs(lhPlugin, 'best-practices'),
},
{
slug: 'seo',
title: 'SEO',
description: 'Ensure that your page is optimized for search engine results ranking.',
refs: lighthouseGroupRefs(lhPlugin, 'seo'),
},
],
};
export default config;Acceptance criteria
- The Lighthouse plugin is unselected by default.
- The user is prompted (or provides a CLI argument) for at least 1 target URL.
- The user should confirm (via prompt or CLI argument) if they want to include all Lighthouse categories, or select a subset.
- By default, Performance, Accessibilty, Best Practices and SEO are all selected.
- The user should confirm (via prompt or CLI argument) if they want to also generate basic categories.
- The default answer is yes (create the categories).
- If confirmed, 1-4 categories are created - 1-to-1 with the selected Lighthouse categories.
- The generated config uses plugin-provided functions that resolve multiple URLs correctly.
- If denied, no categories are created.
- All of the above logic lives in
@code-pushup/lighthouse-plugin. The core of the setup wizard in@code-pushup/create-cliorchestrates plugin selection and generation, but doesn't know any specifics about individual plugins. - In general, it's possible for plugins to create the same category. This needs to be handled by the core logic in
@code-pushup/create-cli- the refs are merged into 1 category.
Reactions are currently unavailable