Skip to content
Draft
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"devDependencies": {
"@types/jest": "^27.0.3",
"@types/minimist": "^1.2.2",
"@types/node": "^6.0.54",
"@types/node": "^12.0.0",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Github action workflow matrix supports 12 as the oldest version

"@types/strip-bom": "^3.0.0",
"@types/strip-json-comments": "^0.0.30",
"@typescript-eslint/eslint-plugin": "^5.22.0",
Expand Down
12 changes: 2 additions & 10 deletions src/filesystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,8 @@ export interface ReadJsonAsync {

export function fileExistsSync(path: string): boolean {
// If the file doesn't exist, avoid throwing an exception over the native barrier for every miss
if (!fs.existsSync(path)) {
return false;
}
try {
const stats = fs.statSync(path);
return stats.isFile();
} catch (err) {
// If error, assume file did not exist
return false;
}
// @ts-expect-error throwIfNoEntry is a noop pre node 14.7, but is not part of the types
return !!fs.statSync(path, { throwIfNoEntry: false })?.isFile();
}

/**
Expand Down
7 changes: 4 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -710,9 +710,10 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.9.tgz#879be3ad7af29f4c1a5c433421bf99fab7047185"
integrity sha512-MKmdASMf3LtPzwLyRrFjtFFZ48cMf8jmX5VRYrDQiJa8Ybu5VAmkqBWqKU8fdCwD8ysw4mQ9nrEHvzg6gunR7A==

"@types/node@^6.0.54":
version "6.0.54"
resolved "https://registry.yarnpkg.com/@types/node/-/node-6.0.54.tgz#65859962ba988052cbdd5c48881395acfdd46931"
"@types/node@^12.0.0":
version "12.20.55"
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.55.tgz#c329cbd434c42164f846b909bd6f85b5537f6240"
integrity sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==

"@types/parse-json@^4.0.0":
version "4.0.0"
Expand Down