Skip to content

Commit

Permalink
fix: import json5 failed json5/json5#263
Browse files Browse the repository at this point in the history
  • Loading branch information
sz-p committed Apr 3, 2022
1 parent 1c06bf1 commit 60529f6
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,15 @@
"tsconfig-paths": "^3.9.0",
"tslint": "^5.20.0",
"typescript": "^3.6.4",
"webpack": "^5.46.0"
"webpack": "^5.46.0",
"cross-env": "^7.0.3"
},
"publisher": "sz-p",
"dependencies": {
"@fluentui/react": "^7.137.1",
"@packages/dependency-tree": "workspace:^0.0.0",
"@types/chai": "^4.2.15",
"@types/json5": "^2.2.0",
"@types/lodash": "^4.14.165",
"@types/md5": "^2.2.1",
"@types/react": "^16.9.46",
Expand Down
11 changes: 11 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
* @introduction util functions
*/
import * as fs from "fs";
import * as JSON5 from "json5";
let JSON5: any = require("json5");
if (JSON5.default) {
JSON5 = JSON5.default
}
export const beforeSetDataToLocal = function (dirPath: string): void {
if (!isPathExists(dirPath + "/.dependencygraph")) {
createLocalFileDir(dirPath);
Expand Down Expand Up @@ -40,7 +43,7 @@ export const getObjectFromJsonFile = function (
if (!isPathExists(filePath)) return false;
try {
const fileString = fs.readFileSync(filePath, "utf8")
const jsonObj = JSON5.default.parse(fileString);
const jsonObj = JSON5.parse(fileString);
return jsonObj
} catch (e) {
return false
Expand Down
7 changes: 5 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"compilerOptions": {
"esModuleInterop": true,
"esModuleInterop": false,
"module": "commonjs",
"target": "es6",
"outDir": "outExtension",
"lib": [
"es6"
],
"allowJs": true,
"sourceMap": true,
"rootDirs": ["src", "packages/*"],
},
Expand All @@ -19,6 +20,8 @@
".vscode-test",
"./src/webView/**/*",
"./tests/**/*",
"./packages/**/*"
"./packages/**/*",
"./outExtension/**/*",
"./outWebView/**/*",
]
}

0 comments on commit 60529f6

Please sign in to comment.