-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from cagov/jbum-site-performance-review
Added performance measurements.
- Loading branch information
Showing
3 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module.exports = function () { | ||
return new Promise(async (resolve, reject) => { | ||
// console.log("FETCHING performance data"); | ||
// console.trace(); | ||
// see details about this API in readme | ||
const perfAudits = await fetch("https://18ap0iejha.execute-api.us-west-1.amazonaws.com/?site=hub.innovation.ca.gov"); | ||
const perfData = await perfAudits.json(); | ||
let pagePerformanceData = {}; | ||
perfData.forEach(item => { | ||
if(item.performance) { | ||
pagePerformanceData[item.pageURL.replace('https://hub.innovation.ca.gov/','/')] = { | ||
lighthouse: { | ||
performance: item.performance, | ||
accessibility: 1 | ||
} | ||
} | ||
} | ||
if(item.accessibility) { | ||
pagePerformanceData[item.pageURL.replace('https://hub.innovation.ca.gov/','/')].lighthouse.accessibility = item.accessibility; | ||
} | ||
}) | ||
|
||
console.log(pagePerformanceData); | ||
resolve(pagePerformanceData); | ||
}); | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters