Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,16 @@ logs/
.npmrc/
.tmp/
coverage/
**/*.tsbuildinfo

# yarn ignores
# https://next.yarnpkg.com/getting-started/qa#which-files-should-be-gitignored

.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
# Prevent yarn releases to be ignored by earlier filter
!.yarn/releases/*.cjs
!.yarn/sdks
!.yarn/versions
942 changes: 942 additions & 0 deletions .yarn/releases/yarn-4.12.0.cjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.12.0.cjs
23 changes: 11 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,7 @@
"prepare": "husky install"
},
"dependencies": {
"@types/debug": "^4.1.7",
"@types/fs-extra": "^9.0.13",
"@types/jest": "^29.5.1",
"@types/js-yaml": "^4.0.2",
"@types/jsonld": "^1.5.8",
"@types/markdown-table": "2.0.0",
"@types/node": "^16.3.1",
"@types/request-promise": "^4.1.48",
"@types/unist": "^2.0.6",
"axios": "^1.13.4",
"commander": "^8.0.0",
"debug": "^4.3.2",
"fastmatter": "^2.1.1",
Expand All @@ -44,14 +36,20 @@
"remark-frontmatter": "^3.0.0",
"remark-parse": "^9.0.0",
"remark-rehype": "8.1.0",
"request": "^2.88.2",
"request-promise": "^4.2.6",
"rimraf": "^3.0.2",
"ts-node": "^10.1.0",
"typescript": "^4.3.5",
"unified": "^9.2.1"
},
"devDependencies": {
"@types/debug": "^4.1.7",
"@types/fs-extra": "^9.0.13",
"@types/jest": "^29.5.1",
"@types/js-yaml": "^4.0.2",
"@types/jsonld": "^1.5.8",
"@types/markdown-table": "2.0.0",
"@types/node": "^16.3.1",
"@types/unist": "^2.0.6",
"@typescript-eslint/eslint-plugin": "^4.28.3",
"@typescript-eslint/parser": "^4.28.3",
"eslint": "^7.30.0",
Expand Down Expand Up @@ -80,5 +78,6 @@
"prettier --write",
"git add"
]
}
},
"packageManager": "[email protected]"
}
1 change: 1 addition & 0 deletions src/map-implementation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export async function cliProgram({
const meta = { vendor, name, version };

const earlReportFile = await loadJson(jsonReport);

const testCaseFile = await loadJson<TestCaseJson>(testCaseJson);

console.log("Loading files");
Expand Down
17 changes: 10 additions & 7 deletions src/utils/load-json.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
import request from "request-promise";
import axios from "axios";
import debug from "debug";
import { promisify } from "util";
import fs from "fs";

const readFile = promisify(fs.readFile);
import fs from "node:fs";

// eslint-disable @typescript-eslint/ban-types
export async function loadJson<T = Object>(filePath: string): Promise<T> {
if (/^https?:\/\//.test(filePath)) {
debug("load:request")(`fetching ${filePath}`);
return await request({ uri: filePath, json: true });

const response = await axios.get(filePath, {
headers: { "Accept-Encoding": "application/json" },
responseType: "json",
});

return response.data;
} else {
debug("load:readFile")(`Loading ${filePath}`);
const str = await readFile(filePath, "utf8");
const str = fs.readFileSync(filePath, "utf8");
return JSON.parse(str);
}
}
Loading