From e3d7d1b63383fc8aca390459d944034f354e3b5e Mon Sep 17 00:00:00 2001 From: Andrea Sonny Date: Thu, 2 Jul 2020 17:18:20 +0100 Subject: [PATCH] Budget fix (#67) * 1.10.1 * fix(cli): Fix for wrong budget type Closes #66 --- bin/cli | 43 ++++++++++++++++++------------------------- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 20 insertions(+), 27 deletions(-) diff --git a/bin/cli b/bin/cli index 3ef583a..3719c0f 100644 --- a/bin/cli +++ b/bin/cli @@ -40,21 +40,21 @@ const cli = meow( $ lighthouse-ci https://example.com -report=folder --config-path=configs.json Options - -s, --silent Run Lighthouse without printing report log - --report= Generate an HTML report inside a specified folder - --filename= Specify the name of the generated HTML report file (requires --report) - -json, --jsonReport Generate JSON report in addition to HTML (requires --report) - --config-path The path to the Lighthouse config JSON (read more here: https://github.com/GoogleChrome/lighthouse/blob/master/docs/configuration.md) - --budget-path The path to the Lighthouse budgets config JSON (read more here: https://developers.google.com/web/tools/lighthouse/audits/budgets) - --score= Specify a score threshold for the CI to pass - --performance= Specify a minimal performance score for the CI to pass - --pwa= Specify a minimal pwa score for the CI to pass - --accessibility= Specify a minimal accessibility score for the CI to pass - --best-practice= [DEPRECATED] Use best-practices instead - --best-practices= Specify a minimal best-practice score for the CI to pass - --seo= Specify a minimal seo score for the CI to pass - --fail-on-budgets Specify CI should fail if budgets are exceeded - --budget.. Specify individual budget threshold (if --budget-path not set) + -s, --silent Run Lighthouse without printing report log + --report= Generate an HTML report inside a specified folder + --filename= Specify the name of the generated HTML report file (requires --report) + -json, --jsonReport Generate JSON report in addition to HTML (requires --report) + --config-path The path to the Lighthouse config JSON (read more here: https://github.com/GoogleChrome/lighthouse/blob/master/docs/configuration.md) + --budget-path The path to the Lighthouse budgets config JSON (read more here: https://developers.google.com/web/tools/lighthouse/audits/budgets) + --score= Specify a score threshold for the CI to pass + --performance= Specify a minimal performance score for the CI to pass + --pwa= Specify a minimal pwa score for the CI to pass + --accessibility= Specify a minimal accessibility score for the CI to pass + --best-practice= [DEPRECATED] Use best-practices instead + --best-practices= Specify a minimal best-practice score for the CI to pass + --seo= Specify a minimal seo score for the CI to pass + --fail-on-budgets Specify CI should fail if budgets are exceeded + --budget.. Specify individual budget threshold (if --budget-path not set) In addition to listed "lighthouse-ci" configuration flags, it is also possible to pass any native "lighthouse" flag To see the full list of available flags, please refer to the official Google Lighthouse documentation at https://github.com/GoogleChrome/lighthouse#cli-options @@ -105,8 +105,7 @@ const cli = meow( default: false, }, budget: { - type: 'object', - default: false, + type: 'string', }, }, }, @@ -197,11 +196,7 @@ Promise.resolve() continue; } - console.log( - `${chalk.yellow(category)}: ${chalk.yellow( - categoryReport[category], - )}`, - ); + console.log(`${chalk.yellow(category)}: ${chalk.yellow(categoryReport[category])}`); } for (const budget in budgetsReport) { @@ -210,9 +205,7 @@ Promise.resolve() } if (budgetsReport[budget]) { - console.log( - `Budget '${chalk.yellow(budget)}' exceeded by ${chalk.yellow(budgetsReport[budget])}`, - ); + console.log(`Budget '${chalk.yellow(budget)}' exceeded by ${chalk.yellow(budgetsReport[budget])}`); } } } diff --git a/package-lock.json b/package-lock.json index d9b1488..cfd25e3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "lighthouse-ci", - "version": "1.10.0", + "version": "1.10.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index f3bce6e..06e5480 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lighthouse-ci", - "version": "1.10.0", + "version": "1.10.1", "description": "CLI implementation for running Lighthouse with any CI tool", "scripts": { "test": "npm run format && xo && jest",