Skip to content
This repository has been archived by the owner on Jun 28, 2023. It is now read-only.

Commit

Permalink
Add script to run lighthouse reports in bulk (#97)
Browse files Browse the repository at this point in the history
* Add script to run lighthouse reports in bulk

* Add node-version and set drone ci to use the same version

* Get all the images switched and sign file
  • Loading branch information
coreyja authored Jun 2, 2019
1 parent 4938912 commit f3d0531
Show file tree
Hide file tree
Showing 6 changed files with 397 additions and 20 deletions.
10 changes: 5 additions & 5 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ steps:
- clone

- name: install
image: node:8
image: node:11.9
commands:
- "echo \"//my-registry.dokku.coreyja.com/:_authToken=$NPM_AUTH_TOKEN\" >> .npmrc"
- "echo \"//npm.fontawesome.com/:_authToken=$FONTAWESOME_AUTH_TOKEN\" >> .npmrc"
Expand All @@ -35,15 +35,15 @@ steps:
- restore

- name: test
image: node:8
image: node:11.9
commands:
- yarn install --frozen
- yarn test
depends_on:
- install

- name: build
image: node:8
image: node:11.9
commands:
- yarn install --frozen
- yarn build
Expand All @@ -54,7 +54,7 @@ steps:
- test

- name: deploy
image: node:8
image: node:11.9
commands:
- yarn install --frozen
- yarn deploy
Expand Down Expand Up @@ -92,6 +92,6 @@ steps:

---
kind: signature
hmac: 0b151e541035a20b11475beb8a86b57987e494a335aaa2f8dc3115f5efdc8847
hmac: 24df2c6eb14906098ca9da46b7e3133a9b6842cde2726cf17903f2b5c1cdd86b

...
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,5 @@ yarn-error.log
.yarn-integrity

secrets.yml

report/
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
11.9.0
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
},
"devDependencies": {
"husky": "^2.3.0",
"lighthouse": "^5.1.0",
"lighthouse-batch": "^4.0.0",
"lint-staged": "^8.1.7",
"prettier": "^1.17.1"
},
Expand Down
19 changes: 19 additions & 0 deletions scripts/bulk-lighthouse.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

SITEMAP_URL="https://coreyja.com/sitemap.xml"

# $1 - xml url
parse_xml() {
urls=`curl -s $1 | sed -n 's/^.*<loc>\(.*\)<\/loc>.*$/\1/p'`
xmls=(`grep -e ".xml$" <<< $urls`)
for xml_url in "${xmls[@]}"
do
parse_xml $xml_url
done
pages=(`grep -v -e ".xml$" <<< $urls`)
printf '%s\n' "${pages[@]}" >&1
}
urls=$(parse_xml $SITEMAP_URL | paste -sd "," -)
yarn run lighthouse-batch -s "$urls"
Loading

0 comments on commit f3d0531

Please sign in to comment.