Skip to content

Commit

Permalink
Use Coach 8.0.0 and display versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
soulgalore committed Aug 30, 2023
1 parent e7af25a commit fb3368d
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 29 deletions.
13 changes: 12 additions & 1 deletion lib/plugins/browsertime/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ import isEmpty from 'lodash.isempty';
import get from 'lodash.get';
import { Stats } from 'fast-stats';
import coach from 'coach-core';
const { pickAPage, analyseHar, merge } = coach;
const {
pickAPage,
analyseHar,
merge,
getThirdPartyWebVersion,
getWappalyzerCoreVersion
} = coach;
import { SitespeedioPlugin } from '@sitespeed.io/plugin';

import { summarizeStats } from '../../support/statsHelpers.js';
Expand Down Expand Up @@ -505,6 +511,11 @@ export default class BrowsertimePlugin extends SitespeedioPlugin {
);
advice = merge(coachAdvice, harResult);
}
const thirdPartyWebVersion = getThirdPartyWebVersion();
const wappalyzerVersion = getWappalyzerCoreVersion();
advice.thirdPartyWebVersion = thirdPartyWebVersion;
advice.wappalyzerVersion = wappalyzerVersion;

super.sendMessage('coach.run', advice, {
url,
group,
Expand Down
3 changes: 2 additions & 1 deletion lib/plugins/html/templates/url/coach/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ mixin adviceInfo(name, id, perfectScore, node)
p #{perfectScore}

- const advice = pageInfo.data.coach.run ? pageInfo.data.coach.run.advice : pageInfo.data.coach.pageSummary.advice;
- const coachVersion = pageInfo.data.coach.run ? pageInfo.data.coach.run.version : pageInfo.data.coach.pageSummary.version;

small
if advice
Expand All @@ -73,7 +74,7 @@ small
h2 Coach
p.small
a(href='https://github.com/sitespeedio/coach') The coach
|  helps you find performance problems on your web page using web performance best practice rules. And gives you advice on privacy and best practices.
|  helps you find performance problems on your web page using web performance best practice rules. And gives you advice on privacy and best practices. Tested using Coach-core version #{coachVersion}.

script(type='text/javascript').
function toggleRow(toggleElement) {
Expand Down
8 changes: 6 additions & 2 deletions lib/plugins/html/templates/url/coach/technology.pug
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
- const wappalyserVersion = pageInfo.data.coach.run ? pageInfo.data.coach.run.wappalyzerVersion : pageInfo.data.coach.pageSummary.wappalyzerVersion;
- const thirdPartyWebVersion = pageInfo.data.coach.run ? pageInfo.data.coach.run.thirdPartyWebVersion : pageInfo.data.coach.pageSummary.thirdPartyWebVersion;

a#technology
h2 Technologies used to build the page.
p Data collected using
a(href='https://github.com/AliasIO/wappalyzer') Wappalyzer.
a(href='https://github.com/dochne/wappalyzer') Wappalyzer
| version #{wappalyserVersion}.
| Use
code --browsertime.firefox.includeResponseBodies html
| or
Expand All @@ -27,7 +31,7 @@ else

if (advice.info.thirdparty && Object.keys(advice.info.thirdparty.toolsByCategory).length > 0)
p Data collected using
a(href='https://github.com/patrickhulce/third-party-web') Third Party Web.
a(href='https://github.com/patrickhulce/third-party-web') Third Party Web #{thirdPartyWebVersion}

table
each data, category in advice.info.thirdparty.toolsByCategory
Expand Down
3 changes: 2 additions & 1 deletion lib/plugins/html/templates/url/thirdparty/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ a#third-party
a#third-party-categories
h2 Third party

- const thirdPartyWebVersion = pageInfo.data.coach.run ? pageInfo.data.coach.run.thirdPartyWebVersion : pageInfo.data.coach.pageSummary.thirdPartyWebVersion;
p Third party requests categorised by
a(href='https://github.com/patrickhulce/third-party-web') Third party web
| .
|  version #{thirdPartyWebVersion}.

if thirdparty.category && Object.keys(thirdparty.category).length > 0
.row
Expand Down
47 changes: 24 additions & 23 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"aws-sdk": "2.1327.0",
"axe-core": "4.7.2",
"browsertime": "17.15.0",
"coach-core": "7.2.1",
"coach-core": "8.0.0",
"cli-color": "2.0.3",
"concurrent-queue": "7.0.2",
"dayjs": "1.11.9",
Expand Down

0 comments on commit fb3368d

Please sign in to comment.