Skip to content

docs: fix audits sub-table array name #556

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 13, 2023
Merged

Conversation

anglepoised
Copy link
Contributor

Fixes the first example in the README, which has an incorrect sub-table array name - [plugins.inputs] instead of [plugins.inputs.audits] - that can lead to issues processing netlify.toml e.g. any header definitions in the file won't get parsed.

Anyone copypasta-ing this first example (like, er, me) would likely end up with issues in their config.

The other examples in README look good; just the first that has issues.

Using the version from the README with no changes:

[[plugins]]
  package = "@netlify/plugin-lighthouse"

  # optional, fails build when a category is below a threshold
  [plugins.inputs.thresholds]
    performance = 0.9
    accessibility = 0.9
    best-practices = 0.9
    seo = 0.9
    pwa = 0.9

  # optional, deploy the lighthouse report to a path under your site
  [plugins.inputs]
    output_path = "reports/lighthouse.html"

...gives a log that look something like this:

8:32:16 PM: Starting post processing
8:32:16 PM: Incorrect TOML configuration format: Key inputs is already used as table key
8:32:16 PM: Post processing - HTML
8:32:16 PM: Incorrect TOML configuration format: Key inputs is already used as table key
8:32:16 PM: Incorrect TOML configuration format: Key inputs is already used as table key
8:32:16 PM: Post processing - header rules
8:32:16 PM: Incorrect TOML configuration format: Key inputs is already used as table key
8:32:17 PM: Post processing - redirect rules
8:32:17 PM: Incorrect TOML configuration format: Key inputs is already used as table key
8:32:17 PM: Post processing done
8:32:17 PM: Section completed: postprocessing
8:32:17 PM: Site is live ✨

Adding a valid [[headers]] section, like this:

[[headers]]
  for = "/*"
  [headers.values]
    Referrer-Policy = "strict-origin-when-cross-origin"

[[plugins]]
  package = "@netlify/plugin-lighthouse"

  # optional, fails build when a category is below a threshold
  [plugins.inputs.thresholds]
    performance = 0.9
    accessibility = 0.9
    best-practices = 0.9
    seo = 0.9
    pwa = 0.9

  # optional, deploy the lighthouse report to a path under your site
  [plugins.inputs]
    output_path = "reports/lighthouse.html"

...gives an identical log to the above:

8:32:58 PM: Starting post processing
8:32:58 PM: Incorrect TOML configuration format: Key inputs is already used as table key
8:32:58 PM: Post processing - HTML
8:32:58 PM: Incorrect TOML configuration format: Key inputs is already used as table key
8:32:59 PM: Incorrect TOML configuration format: Key inputs is already used as table key
8:32:59 PM: Post processing - header rules
8:32:59 PM: Incorrect TOML configuration format: Key inputs is already used as table key
8:32:59 PM: Post processing - redirect rules
8:32:59 PM: Incorrect TOML configuration format: Key inputs is already used as table key
8:32:59 PM: Post processing done
8:32:59 PM: Section completed: postprocessing
8:33:00 PM: Site is live ✨

...but also fails to parse the headers, saying "No header rules processed" in the Deploy summary.

@anglepoised anglepoised requested a review from a team March 9, 2023 20:33
Copy link
Contributor

@aitchiss aitchiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for spotting and fixing this!

@netlify
Copy link

netlify bot commented Mar 13, 2023

👷 Deploy Preview for plugin-lighthouse processing.

Name Link
🔨 Latest commit 39845b9
🔍 Latest deploy log https://app.netlify.com/sites/plugin-lighthouse/deploys/640a429bce3e42000807952a

@aitchiss aitchiss merged commit 2a8bdd2 into netlify:main Mar 13, 2023
@anglepoised anglepoised deleted the patch-1 branch March 12, 2024 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants