@jsenv/lighthouse-impact 2.1.8 → 2.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +3 -14
- package/src/generateLighthouseReport.js +4 -10
- package/src/reportLighthouseImpact.js +7 -10
package/README.md
CHANGED
|
@@ -162,7 +162,7 @@ The example below assume code is executed by Travis.
|
|
|
162
162
|
|
|
163
163
|
reportLighthouseImpact({
|
|
164
164
|
- ...readGitHubWorkflowEnv(),
|
|
165
|
-
+
|
|
165
|
+
+ rootDirectoryUrl: process.env.TRAVIS_BUILD_DIR,
|
|
166
166
|
+ repositoryOwner: process.env.TRAVIS_REPO_SLUG.split("/")[0],
|
|
167
167
|
+ repositoryName: process.env.TRAVIS_REPO_SLUG.split("/")[1],
|
|
168
168
|
+ pullRequestNumber: process.env.TRAVIS_PULL_REQUEST,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/lighthouse-impact",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.11",
|
|
4
4
|
"description": "Package description",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
],
|
|
35
35
|
"scripts": {
|
|
36
36
|
"eslint": "npx eslint . --ext=.js,.mjs",
|
|
37
|
-
"importmap": "node ./script/importmap/importmap.mjs",
|
|
38
37
|
"snapshot": "node ./test/comment/generate_comment_snapshot_file.mjs",
|
|
39
38
|
"test": "node ./script/test/test.mjs",
|
|
40
39
|
"test-with-coverage": "npm run test -- --coverage",
|
|
@@ -43,20 +42,10 @@
|
|
|
43
42
|
"dependencies": {
|
|
44
43
|
"@jsenv/abort": "4.1.2",
|
|
45
44
|
"@jsenv/dynamic-import-worker": "1.0.1",
|
|
46
|
-
"@jsenv/filesystem": "
|
|
47
|
-
"@jsenv/github-pull-request-impact": "1.6.
|
|
45
|
+
"@jsenv/filesystem": "3.1.0",
|
|
46
|
+
"@jsenv/github-pull-request-impact": "1.6.11",
|
|
48
47
|
"@jsenv/logger": "4.0.1",
|
|
49
48
|
"chrome-launcher": "0.15.0",
|
|
50
49
|
"lighthouse": "9.2.0"
|
|
51
|
-
},
|
|
52
|
-
"devDependencies": {
|
|
53
|
-
"@jsenv/assert": "2.4.1",
|
|
54
|
-
"@jsenv/core": "25.3.0",
|
|
55
|
-
"@jsenv/eslint-config": "16.0.9",
|
|
56
|
-
"@jsenv/importmap-eslint-resolver": "5.2.5",
|
|
57
|
-
"@jsenv/importmap-node-module": "5.1.3",
|
|
58
|
-
"eslint": "8.7.0",
|
|
59
|
-
"eslint-plugin-import": "2.25.4",
|
|
60
|
-
"prettier": "2.5.1"
|
|
61
50
|
}
|
|
62
51
|
}
|
|
@@ -31,7 +31,7 @@ export const generateLighthouseReport = async (
|
|
|
31
31
|
runCount = 1,
|
|
32
32
|
delayBetweenEachRunInSeconds = 1,
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
rootDirectoryUrl, // required only when jsonFile or htmlFile is passed
|
|
35
35
|
log = false,
|
|
36
36
|
jsonFile = false,
|
|
37
37
|
jsonFileRelativeUrl = "./lighthouse/lighthouse_report.json",
|
|
@@ -118,17 +118,14 @@ export const generateLighthouseReport = async (
|
|
|
118
118
|
await chrome.kill()
|
|
119
119
|
|
|
120
120
|
if (jsonFile || htmlFile) {
|
|
121
|
-
|
|
121
|
+
rootDirectoryUrl = assertAndNormalizeDirectoryUrl(rootDirectoryUrl)
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
const promises = []
|
|
125
125
|
if (jsonFile) {
|
|
126
126
|
promises.push(
|
|
127
127
|
(async () => {
|
|
128
|
-
const jsonFileUrl = resolveUrl(
|
|
129
|
-
jsonFileRelativeUrl,
|
|
130
|
-
projectDirectoryUrl,
|
|
131
|
-
)
|
|
128
|
+
const jsonFileUrl = resolveUrl(jsonFileRelativeUrl, rootDirectoryUrl)
|
|
132
129
|
const json = JSON.stringify(lighthouseReport, null, " ")
|
|
133
130
|
await writeFile(jsonFileUrl, json)
|
|
134
131
|
if (jsonFileLog) {
|
|
@@ -140,10 +137,7 @@ export const generateLighthouseReport = async (
|
|
|
140
137
|
if (htmlFile) {
|
|
141
138
|
promises.push(
|
|
142
139
|
(async () => {
|
|
143
|
-
const htmlFileUrl = resolveUrl(
|
|
144
|
-
htmlFileRelativeUrl,
|
|
145
|
-
projectDirectoryUrl,
|
|
146
|
-
)
|
|
140
|
+
const htmlFileUrl = resolveUrl(htmlFileRelativeUrl, rootDirectoryUrl)
|
|
147
141
|
const html = ReportGenerator.generateReportHtml(lighthouseReport)
|
|
148
142
|
await writeFile(htmlFileUrl, html)
|
|
149
143
|
if (htmlFileLog) {
|
|
@@ -9,7 +9,7 @@ export const reportLighthouseImpact = async ({
|
|
|
9
9
|
logLevel,
|
|
10
10
|
commandLogs = false,
|
|
11
11
|
cancelOnSIGINT,
|
|
12
|
-
|
|
12
|
+
rootDirectoryUrl,
|
|
13
13
|
|
|
14
14
|
githubToken,
|
|
15
15
|
repositoryOwner,
|
|
@@ -23,17 +23,14 @@ export const reportLighthouseImpact = async ({
|
|
|
23
23
|
catchError,
|
|
24
24
|
skipGistWarning = false,
|
|
25
25
|
}) => {
|
|
26
|
-
|
|
26
|
+
rootDirectoryUrl = assertAndNormalizeDirectoryUrl(rootDirectoryUrl)
|
|
27
27
|
if (typeof lighthouseReportPath !== "string") {
|
|
28
28
|
throw new TypeError(
|
|
29
29
|
`lighthouseReportPath must be a string but received ${lighthouseReportPath}`,
|
|
30
30
|
)
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
const lighthouseReportUrl = resolveUrl(
|
|
34
|
-
lighthouseReportPath,
|
|
35
|
-
projectDirectoryUrl,
|
|
36
|
-
)
|
|
32
|
+
rootDirectoryUrl = assertAndNormalizeDirectoryUrl(rootDirectoryUrl)
|
|
33
|
+
const lighthouseReportUrl = resolveUrl(lighthouseReportPath, rootDirectoryUrl)
|
|
37
34
|
|
|
38
35
|
return commentGitHubPullRequestImpact({
|
|
39
36
|
logLevel,
|
|
@@ -41,15 +38,15 @@ export const reportLighthouseImpact = async ({
|
|
|
41
38
|
// lighthouse report are super verbose, do not log them
|
|
42
39
|
infoLogs: false,
|
|
43
40
|
cancelOnSIGINT,
|
|
44
|
-
|
|
41
|
+
rootDirectoryUrl,
|
|
45
42
|
|
|
46
43
|
githubToken,
|
|
47
44
|
repositoryOwner,
|
|
48
45
|
repositoryName,
|
|
49
46
|
pullRequestNumber,
|
|
50
47
|
|
|
51
|
-
collectInfo: async ({
|
|
52
|
-
await
|
|
48
|
+
collectInfo: async ({ execCommandInRootDirectory }) => {
|
|
49
|
+
await execCommandInRootDirectory(installCommand)
|
|
53
50
|
const lighthouseReport = await importOneExportFromFile(
|
|
54
51
|
lighthouseReportUrl,
|
|
55
52
|
)
|