@jsenv/performance-impact 2.2.9 → 2.3.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/performance-impact",
3
- "version": "2.2.9",
3
+ "version": "2.3.0",
4
4
  "description": "Report pull request impacts on performance metrics",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -42,7 +42,7 @@
42
42
  "dependencies": {
43
43
  "@jsenv/dynamic-import-worker": "1.0.1",
44
44
  "@jsenv/filesystem": "3.1.0",
45
- "@jsenv/github-pull-request-impact": "1.6.10",
45
+ "@jsenv/github-pull-request-impact": "1.6.11",
46
46
  "@jsenv/logger": "4.0.1",
47
47
  "bytes": "3.1.1",
48
48
  "humanize-duration": "3.27.1"
@@ -1,4 +1,4 @@
1
- import { resolveUrl, assertAndNormalizeDirectoryUrl } from "@jsenv/filesystem"
1
+ import { assertAndNormalizeDirectoryUrl } from "@jsenv/filesystem"
2
2
  import { commentGitHubPullRequestImpact } from "@jsenv/github-pull-request-impact"
3
3
  import { importOneExportFromFile } from "@jsenv/dynamic-import-worker"
4
4
 
@@ -27,16 +27,16 @@ export const reportPerformanceImpact = async ({
27
27
  commitInGeneratedByInfo,
28
28
  }) => {
29
29
  rootDirectoryUrl = assertAndNormalizeDirectoryUrl(rootDirectoryUrl)
30
- if (typeof performanceReportPath !== "string") {
30
+ let performanceReportUrl
31
+ if (performanceReportPath === "string") {
32
+ performanceReportUrl = new URL(performanceReportPath, rootDirectoryUrl).href
33
+ } else if (performanceReportPath instanceof URL) {
34
+ performanceReportUrl = performanceReportPath.href
35
+ } else {
31
36
  throw new TypeError(
32
- `performanceReportPath must be a string but received ${performanceReportPath}`,
37
+ `performanceReportPath must be a string or an url but received ${performanceReportPath}`,
33
38
  )
34
39
  }
35
- rootDirectoryUrl = assertAndNormalizeDirectoryUrl(rootDirectoryUrl)
36
- const performanceReportUrl = resolveUrl(
37
- performanceReportPath,
38
- rootDirectoryUrl,
39
- )
40
40
 
41
41
  return commentGitHubPullRequestImpact({
42
42
  logLevel,
@@ -49,8 +49,8 @@ export const reportPerformanceImpact = async ({
49
49
  repositoryName,
50
50
  pullRequestNumber,
51
51
 
52
- collectInfo: async ({ execCommandInProjectDirectory }) => {
53
- await execCommandInProjectDirectory(installCommand)
52
+ collectInfo: async ({ execCommandInRootDirectory }) => {
53
+ await execCommandInRootDirectory(installCommand)
54
54
  const performanceReport = await importOneExportFromFile(
55
55
  performanceReportUrl,
56
56
  )