Skip to content

Commit 78c1c32

Browse files
authored
Merge pull request #35 from act-rules/update-yarn
Remove `request`, update `yarn` and dedupe dependencies
2 parents 9ee7046 + f9bc186 commit 78c1c32

7 files changed

Lines changed: 6949 additions & 4350 deletions

File tree

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,16 @@ logs/
77
.npmrc/
88
.tmp/
99
coverage/
10+
**/*.tsbuildinfo
11+
12+
# yarn ignores
13+
# https://next.yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
14+
15+
.yarn/*
16+
!.yarn/patches
17+
!.yarn/plugins
18+
!.yarn/releases
19+
# Prevent yarn releases to be ignored by earlier filter
20+
!.yarn/releases/*.cjs
21+
!.yarn/sdks
22+
!.yarn/versions

.yarn/releases/yarn-4.12.0.cjs

Lines changed: 942 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
nodeLinker: node-modules
2+
3+
yarnPath: .yarn/releases/yarn-4.12.0.cjs

package.json

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,7 @@
2121
"prepare": "husky install"
2222
},
2323
"dependencies": {
24-
"@types/debug": "^4.1.7",
25-
"@types/fs-extra": "^9.0.13",
26-
"@types/jest": "^29.5.1",
27-
"@types/js-yaml": "^4.0.2",
28-
"@types/jsonld": "^1.5.8",
29-
"@types/markdown-table": "2.0.0",
30-
"@types/node": "^16.3.1",
31-
"@types/request-promise": "^4.1.48",
32-
"@types/unist": "^2.0.6",
24+
"axios": "^1.13.4",
3325
"commander": "^8.0.0",
3426
"debug": "^4.3.2",
3527
"fastmatter": "^2.1.1",
@@ -44,14 +36,20 @@
4436
"remark-frontmatter": "^3.0.0",
4537
"remark-parse": "^9.0.0",
4638
"remark-rehype": "8.1.0",
47-
"request": "^2.88.2",
48-
"request-promise": "^4.2.6",
4939
"rimraf": "^3.0.2",
5040
"ts-node": "^10.1.0",
5141
"typescript": "^4.3.5",
5242
"unified": "^9.2.1"
5343
},
5444
"devDependencies": {
45+
"@types/debug": "^4.1.7",
46+
"@types/fs-extra": "^9.0.13",
47+
"@types/jest": "^29.5.1",
48+
"@types/js-yaml": "^4.0.2",
49+
"@types/jsonld": "^1.5.8",
50+
"@types/markdown-table": "2.0.0",
51+
"@types/node": "^16.3.1",
52+
"@types/unist": "^2.0.6",
5553
"@typescript-eslint/eslint-plugin": "^4.28.3",
5654
"@typescript-eslint/parser": "^4.28.3",
5755
"eslint": "^7.30.0",
@@ -80,5 +78,6 @@
8078
"prettier --write",
8179
"git add"
8280
]
83-
}
81+
},
82+
"packageManager": "yarn@4.12.0"
8483
}

src/map-implementation.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export async function cliProgram({
2828
const meta = { vendor, name, version };
2929

3030
const earlReportFile = await loadJson(jsonReport);
31+
3132
const testCaseFile = await loadJson<TestCaseJson>(testCaseJson);
3233

3334
console.log("Loading files");

src/utils/load-json.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
import request from "request-promise";
1+
import axios from "axios";
22
import debug from "debug";
3-
import { promisify } from "util";
4-
import fs from "fs";
5-
6-
const readFile = promisify(fs.readFile);
3+
import fs from "node:fs";
74

85
// eslint-disable @typescript-eslint/ban-types
96
export async function loadJson<T = Object>(filePath: string): Promise<T> {
107
if (/^https?:\/\//.test(filePath)) {
118
debug("load:request")(`fetching ${filePath}`);
12-
return await request({ uri: filePath, json: true });
9+
10+
const response = await axios.get(filePath, {
11+
headers: { "Accept-Encoding": "application/json" },
12+
responseType: "json",
13+
});
14+
15+
return response.data;
1316
} else {
1417
debug("load:readFile")(`Loading ${filePath}`);
15-
const str = await readFile(filePath, "utf8");
18+
const str = fs.readFileSync(filePath, "utf8");
1619
return JSON.parse(str);
1720
}
1821
}

0 commit comments

Comments
 (0)