Skip to content

Commit

Permalink
Merge pull request #221 from synvert-hq/awesomecode-format-typescript…
Browse files Browse the repository at this point in the history
…-code-61174

Auto corrected by following Format Typescript Code
  • Loading branch information
flyerhzm authored May 24, 2024
2 parents 3159617 + 065d859 commit 51574a3
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/node-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,16 @@ class NodeVersion {
path.join(Configuration.rootPath, ".nvmrc"),
"utf-8",
);
} else if (isValidFileSync(path.join(Configuration.rootPath, "package.json"))) {
} else if (
isValidFileSync(path.join(Configuration.rootPath, "package.json"))
) {
const packageFileContent = fs.readFileSync(
path.join(Configuration.rootPath, "package.json"),
"utf-8",
);
const packageJson = JSON.parse(packageFileContent)
const packageJson = JSON.parse(packageFileContent);
if (packageJson.engines && packageJson.engines.node) {
version = packageJson.engines.node.replace(/[^0-9.]/g, '');
version = packageJson.engines.node.replace(/[^0-9.]/g, "");
}
}
if (!version) {
Expand Down Expand Up @@ -70,14 +72,16 @@ class NodeVersion {
path.join(Configuration.rootPath, ".nvmrc"),
"utf-8",
);
} else if (await isValidFile(path.join(Configuration.rootPath, "package.json"))) {
} else if (
await isValidFile(path.join(Configuration.rootPath, "package.json"))
) {
const packageFileContent = await promisesFs.readFile(
path.join(Configuration.rootPath, "package.json"),
"utf-8",
);
const packageJson = JSON.parse(packageFileContent)
const packageJson = JSON.parse(packageFileContent);
if (packageJson.engines && packageJson.engines.node) {
version = packageJson.engines.node.replace(/[^0-9.]/g, '');
version = packageJson.engines.node.replace(/[^0-9.]/g, "");
}
}
if (!version) {
Expand Down

0 comments on commit 51574a3

Please sign in to comment.