diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 771b9a1ac4a..e7f32481c04 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -210,7 +210,7 @@ jobs:
run: 'npm run benchmark -- --revs HEAD HEAD~1'
diff-npm-package:
- name: Diff context of NPM package
+ name: Diff content of NPM package
runs-on: ubuntu-latest
steps:
- name: Checkout repo
@@ -224,13 +224,14 @@ jobs:
node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }}
- name: Generate report
- run: 'node resources/diff-npm-package.js HEAD~1 HEAD'
+ run: 'node resources/diff-npm-package.js ${{ github.event.pull_request.base.sha }} HEAD'
- name: Upload generated report
uses: actions/upload-artifact@v2
with:
name: npm-dist-diff.html
path: ./npm-dist-diff.html
+ if-no-files-found: ignore
deploy-to-npm-branch:
name: Deploy to `npm` branch
diff --git a/.gitignore b/.gitignore
index 9e07128cb88..28b46e673bb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@
# https://help.github.com/articles/ignoring-files/#create-a-global-gitignore
# https://www.gitignore.io/
+/diff-npm-package.html
/.eslintcache
/node_modules
/coverage
diff --git a/.prettierignore b/.prettierignore
index 475f5e22fd3..384c2585fbd 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -1,4 +1,5 @@
# Copied from '.gitignore', please keep it in sync.
+/diff-npm-package.html
/.eslintcache
/node_modules
/coverage
diff --git a/cspell.yml b/cspell.yml
index 36a6cf6e0cd..c244033cf7d 100644
--- a/cspell.yml
+++ b/cspell.yml
@@ -1,6 +1,7 @@
language: en
ignorePaths:
# Copied from '.gitignore', please keep it in sync.
+ - diff-npm-package.html
- .eslintcache
- node_modules
- coverage
diff --git a/resources/diff-npm-package.js b/resources/diff-npm-package.js
index 59d5acc9f75..98df6f3ed2e 100644
--- a/resources/diff-npm-package.js
+++ b/resources/diff-npm-package.js
@@ -12,19 +12,22 @@ fs.rmSync(tmpDir, { recursive: true, force: true });
fs.mkdirSync(tmpDir);
const args = process.argv.slice(2);
-const fromRevision = args.pop() ?? 'HEAD';
-const toRevision = args.pop() ?? LOCAL;
+let [fromRevision, toRevision] = args;
if (args.length < 2) {
- console.warn(`Assuming you meant: diff-npm-package ${fromRevision} ${toRevision}`);
+ fromRevision = fromRevision ?? 'HEAD';
+ toRevision = toRevision ?? LOCAL;
+ console.warn(
+ `Assuming you meant: diff-npm-package ${fromRevision} ${toRevision}`,
+ );
}
-console.log(`📦 Bulding NPM package for ${fromRevision}...`);
+console.log(`📦 Building NPM package for ${fromRevision}...`);
const fromPackage = prepareNPMPackage(fromRevision);
-console.log(`📦 Bulding NPM package for ${toRevision}...`);
+console.log(`📦 Building NPM package for ${toRevision}...`);
const toPackage = prepareNPMPackage(toRevision);
-console.log(`âž–âž• Generating diff...`);
+console.log('âž–âž• Generating diff...');
const diff = exec(`npm diff --diff=${fromPackage} --diff=${toPackage}`);
if (diff === '') {
@@ -35,7 +38,7 @@ if (diff === '') {
console.log('Report saved to: ', reportPath);
}
-function generateReport(diff) {
+function generateReport(diffString) {
return `
@@ -51,19 +54,15 @@ function generateReport(diff) {