Skip to content

Commit 7495d3e

Browse files
authored
Upgrade to print-diff@2 (microsoft#1469)
1 parent 185d009 commit 7495d3e

10 files changed

+61
-57
lines changed

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ jobs:
66
runs-on: ubuntu-latest
77

88
steps:
9-
- uses: actions/checkout@v2
10-
- uses: actions/setup-node@v2
9+
- uses: actions/checkout@v3
10+
- uses: actions/setup-node@v3
1111
with:
1212
node-version: "lts/*"
1313
cache: npm

.github/workflows/codeowners-merge.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010

1111
steps:
12-
- uses: actions/checkout@v1
12+
- uses: actions/checkout@v3
1313
- name: Run Codeowners merge check
1414
uses: OSS-Docs-Tools/[email protected]
1515
if: github.repository == 'microsoft/TypeScript-DOM-lib-generator'

.github/workflows/deploy.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ jobs:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14-
- uses: actions/checkout@v2
15-
- uses: actions/setup-node@v2
14+
- uses: actions/checkout@v3
15+
- uses: actions/setup-node@v3
1616
with:
1717
node-version: "lts/*"
1818
cache: npm
@@ -25,7 +25,7 @@ jobs:
2525
- name: Create packages for .d.ts files
2626
run: node deploy/createTypesPackages.js
2727

28-
- name: "Deploy built packages to NPM"
28+
- name: "Deploy built packages to NPM"
2929
run: |
3030
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
3131
npm i -g npm@latest

.github/workflows/pr-to-typescript.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ jobs:
77
runs-on: ubuntu-latest
88

99
steps:
10-
- uses: actions/checkout@v2
11-
- uses: actions/setup-node@v2
10+
- uses: actions/checkout@v3
11+
- uses: actions/setup-node@v3
1212
with:
1313
node-version: "lts/*"
1414
cache: npm

.github/workflows/test_typescript.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- uses: actions/checkout@v2
17-
- uses: actions/setup-node@v2
16+
- uses: actions/checkout@v3
17+
- uses: actions/setup-node@v3
1818
with:
1919
node-version: "lts/*"
2020
cache: npm

.github/workflows/update-core-deps.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ jobs:
1111
update-webref:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v2
15-
- uses: actions/setup-node@v2
14+
- uses: actions/checkout@v3
15+
- uses: actions/setup-node@v3
1616
with:
1717
node-version: "lts/*"
1818
cache: npm
@@ -22,6 +22,10 @@ jobs:
2222
- run: ncu -u
2323
- run: npm i
2424
- run: git restore package.json
25+
# package-lock wants to remember the original version numbers of package.json
26+
# This prevents annoying change when contributors run `npm i` on their local machine.
27+
# Example: https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/1463
28+
- run: npm i
2529
- id: build
2630
run: npm run build && npm run baseline-accept
2731
continue-on-error: true

deploy/deployChangedPackages.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import * as fs from "fs";
99
import { spawnSync } from "child_process";
1010
import { Octokit } from "@octokit/rest";
11-
import printDiff from "print-diff";
11+
import { printInlineDiff } from "print-diff";
1212
import { generateChangelogFrom } from "../lib/changelog.js";
1313
import { packages } from "./createTypesPackages.js";
1414
import { fileURLToPath } from "node:url";
@@ -65,7 +65,7 @@ for (const dirName of fs.readdirSync(generatedDir)) {
6565
);
6666
console.log(` - ${file}`);
6767
if (oldFile !== generatedDTSContent)
68-
printDiff(oldFile, generatedDTSContent);
68+
printInlineDiff(oldFile, generatedDTSContent);
6969

7070
const title = `## \`${file}\``;
7171
const notes = generateChangelogFrom(oldFile, generatedDTSContent);

package-lock.json

+28-28
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+13-13
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,26 @@
3636
"license": "Apache-2.0",
3737
"type": "module",
3838
"devDependencies": {
39-
"@mdn/browser-compat-data": "^5.2.22",
39+
"@mdn/browser-compat-data": "^5.2.26",
4040
"@octokit/rest": "^19.0.5",
41-
"@types/node": "^18.11.17",
42-
"@types/prettier": "^2.7.1",
41+
"@types/node": "^18.11.18",
42+
"@types/prettier": "^2.7.2",
4343
"@types/webidl2": "^23.13.6",
44-
"@typescript-eslint/eslint-plugin": "^5.46.1",
45-
"@typescript-eslint/parser": "^5.46.1",
46-
"@webref/css": "^6.1.1",
44+
"@typescript-eslint/eslint-plugin": "^5.48.1",
45+
"@typescript-eslint/parser": "^5.48.1",
46+
"@webref/css": "^6.2.0",
4747
"@webref/elements": "^2.1.0",
48-
"@webref/idl": "^3.22.4",
49-
"bcd-idl-mapper": "^2.2.1",
48+
"@webref/idl": "^3.23.0",
49+
"bcd-idl-mapper": "^2.2.2",
5050
"cpx2": "^4.2.0",
51-
"danger": "^11.2.0",
52-
"eslint": "^8.30.0",
53-
"eslint-config-prettier": "^8.5.0",
51+
"danger": "^11.2.1",
52+
"eslint": "^8.31.0",
53+
"eslint-config-prettier": "^8.6.0",
5454
"eslint-plugin-prettier": "^4.2.1",
5555
"jsonc-parser": "^3.2.0",
5656
"node-fetch": "^3.3.0",
57-
"prettier": "^2.8.1",
58-
"print-diff": "^1.0.0",
57+
"prettier": "^2.8.2",
58+
"print-diff": "^2.0.0",
5959
"styleless-innertext": "^1.1.3",
6060
"typescript": "^4.9.4",
6161
"webidl2": "^24.2.2"

src/test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as fs from "fs";
22
import child_process from "child_process";
3-
import printDiff from "print-diff";
3+
import { printInlineDiff } from "print-diff";
44
import { fileURLToPath } from "url";
55

66
const baselineFolder = new URL("../baselines/", import.meta.url);
@@ -28,7 +28,7 @@ function compareToBaselines() {
2828
);
2929
if (baseline !== generated) {
3030
console.error(`Test failed: '${file}' is different from baseline file.`);
31-
printDiff(baseline, generated);
31+
printInlineDiff(baseline, generated);
3232
return false;
3333
}
3434
}

0 commit comments

Comments
 (0)