@jsenv/lighthouse-impact 2.1.7 → 2.1.10

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 CHANGED
@@ -115,7 +115,7 @@ _report_lighthouse_impact.mjs_
115
115
  * This file is executed by lighthouse_impact.yml GitHub workflow.
116
116
  * - it generates lighthouse report before and after merging a pull request
117
117
  * - Then, it creates or updates a comment in the pull request
118
- * See https://github.com/jsenv/lighthouse-impact#how-it-works
118
+ * See https://github.com/jsenv/workflow/tree/main/packages/jsenv-performance-impact
119
119
  */
120
120
 
121
121
  import {
@@ -162,7 +162,7 @@ The example below assume code is executed by Travis.
162
162
 
163
163
  reportLighthouseImpact({
164
164
  - ...readGitHubWorkflowEnv(),
165
- + projectDirectoryUrl: process.env.TRAVIS_BUILD_DIR,
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.7",
3
+ "version": "2.1.10",
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": "2.7.1",
47
- "@jsenv/github-pull-request-impact": "1.6.9",
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
- projectDirectoryUrl, // required only when jsonFile or htmlFile is passed
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
- projectDirectoryUrl = assertAndNormalizeDirectoryUrl(projectDirectoryUrl)
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
- projectDirectoryUrl,
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
- projectDirectoryUrl = assertAndNormalizeDirectoryUrl(projectDirectoryUrl)
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
- projectDirectoryUrl = assertAndNormalizeDirectoryUrl(projectDirectoryUrl)
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,7 +38,7 @@ export const reportLighthouseImpact = async ({
41
38
  // lighthouse report are super verbose, do not log them
42
39
  infoLogs: false,
43
40
  cancelOnSIGINT,
44
- projectDirectoryUrl,
41
+ rootDirectoryUrl,
45
42
 
46
43
  githubToken,
47
44
  repositoryOwner,
@@ -111,7 +108,7 @@ export const reportLighthouseImpact = async ({
111
108
  }
112
109
  },
113
110
  generatedByLink: {
114
- url: "https://github.com/jsenv/lighthouse-impact",
111
+ url: "https://github.com/jsenv/workflow/tree/main/packages/jsenv-lighthouse-impact",
115
112
  text: "@jsenv/lighthouse-impact",
116
113
  },
117
114
  runLink,