diff --git a/.gitignore b/.gitignore index 6d3213da..59d3cb09 100644 --- a/.gitignore +++ b/.gitignore @@ -31,4 +31,3 @@ package-lock.json .lighthouseci/ -audit/ diff --git a/README.md b/README.md index 1fef78d0..37c03126 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ [![Build Status](https://github.com/TAMULib/CAP/workflows/Build/badge.svg)](https://github.com/TAMULib/CAP/actions?query=workflow%3ABuild) [![Coverage Status](https://coveralls.io/repos/github/TAMULib/CAP/badge.svg)](https://coveralls.io/github/TAMULib/CAP) - +[![Progressive Web App](https://tamulib.github.io/CAP/audit/assets/pwa.svg)](https://tamulib.github.io/CAP/audit/#pwa) # CAP diff --git a/scripts/build-cap-lighthouse-badges.js b/scripts/build-cap-lighthouse-badges.js index 2827ce96..918d0d73 100644 --- a/scripts/build-cap-lighthouse-badges.js +++ b/scripts/build-cap-lighthouse-badges.js @@ -43,7 +43,7 @@ const createBadges = resultList => { }); } -const logSoreList = scoreList => { +const logScoreList = scoreList => { console.log('Finished generating report'); console.log('Results:'); scoreList.forEach(s => { @@ -52,15 +52,27 @@ const logSoreList = scoreList => { } const createGhPagesDir = () => { + const targetPath = 'target'; + const ghPagesPath = `src/main/resources/gh-pages`; + const targetGhPagesPath = `${targetPath}/gh-pages`; fs.ensureDir(ghPagesPath); - const targetPath = 'target/'; fs.ensureDir(targetPath); - fs.ensureDir(`${lighthousePath}`); - fs.copy(`./${ghPagesPath}/index.html`, `${targetPath}/gh-pages/index.html`); - fs.copy(`./${lighthousePath}/`, `${targetPath}/gh-pages/audit/`); - fs.copy(`./${lighthousePath}/assets/`, `${targetPath}/gh-pages/audit/assets/`); - fs.copy(`${targetPath}/generated-docs/`, `${targetPath}/gh-pages/api-docs/`); -} + + fs.copy(`${targetPath}/generated-docs/`, `${targetGhPagesPath}/api-docs/`, err => { + if (err) return console.error(' \n Unable to copy generated-docs to : ',`${targetGhPagesPath}/api-docs/` , '\n', err); + console.log(`Copied generated-docs to ${targetGhPagesPath}/api-docs/ !`); + }); + + fs.copy(`./${ghPagesPath}/index.html`, `${targetGhPagesPath}/index.html`, err => { + if (err) return console.error(' \n Unable to copy src index file to : ',`${targetGhPagesPath}/index.html` , '\n', err); + console.log(`Copied index file to ${targetGhPagesPath}/index.html !`); + }); + + fs.copy(`./${ghPagesPath}/audit/`, `${targetGhPagesPath}/audit/`, err => { + if (err) return console.error(' \n Unable to copy src audit to : ',`${targetGhPagesPath}/audit/` , '\n', err); + console.log(`Copied audit to ${targetGhPagesPath}/audit/ !`); + }); +}; if(fs.existsSync(lighthouseCiPath)) { fs.ensureDir(`${lighthousePath}`); @@ -71,7 +83,7 @@ if(fs.existsSync(lighthouseCiPath)) { const scoreList = createScoreList(jsonReport); createReport(htmlReportPath); createBadges(scoreList); - logSoreList(scoreList); + logScoreList(scoreList); createGhPagesDir(); } else { diff --git a/src/main/resources/gh-pages/audit/assets/accessibility.svg b/src/main/resources/gh-pages/audit/assets/accessibility.svg new file mode 100644 index 00000000..df9c08c7 --- /dev/null +++ b/src/main/resources/gh-pages/audit/assets/accessibility.svg @@ -0,0 +1 @@ +Accessibility: 96Accessibility96 \ No newline at end of file diff --git a/src/main/resources/gh-pages/audit/assets/best-practices.svg b/src/main/resources/gh-pages/audit/assets/best-practices.svg new file mode 100644 index 00000000..251ab4d0 --- /dev/null +++ b/src/main/resources/gh-pages/audit/assets/best-practices.svg @@ -0,0 +1 @@ +Best Practices: 79Best Practices79 \ No newline at end of file diff --git a/src/main/resources/gh-pages/audit/assets/performance.svg b/src/main/resources/gh-pages/audit/assets/performance.svg new file mode 100644 index 00000000..c2c7c9ec --- /dev/null +++ b/src/main/resources/gh-pages/audit/assets/performance.svg @@ -0,0 +1 @@ +Performance: 34Performance34 \ No newline at end of file diff --git a/src/main/resources/gh-pages/audit/assets/pwa.svg b/src/main/resources/gh-pages/audit/assets/pwa.svg new file mode 100644 index 00000000..8661e855 --- /dev/null +++ b/src/main/resources/gh-pages/audit/assets/pwa.svg @@ -0,0 +1 @@ +Progressive Web App: 21Progressive Web App21 \ No newline at end of file diff --git a/src/main/resources/gh-pages/audit/assets/seo.svg b/src/main/resources/gh-pages/audit/assets/seo.svg new file mode 100644 index 00000000..6d1616d3 --- /dev/null +++ b/src/main/resources/gh-pages/audit/assets/seo.svg @@ -0,0 +1 @@ +SEO: 80SEO80 \ No newline at end of file diff --git a/src/main/resources/gh-pages/audit/index.html b/src/main/resources/gh-pages/audit/index.html new file mode 100644 index 00000000..0a23e5ce --- /dev/null +++ b/src/main/resources/gh-pages/audit/index.html @@ -0,0 +1,7572 @@ + + + + + + + + Lighthouse Report + + + + + + +
+ +
+ + + + + + +