Fix crash when data.json doesn't exist
This commit is contained in:
parent
ed9a4cb146
commit
159ef008de
|
@ -5,7 +5,7 @@
|
|||
"main": "./dist/main.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"clean": "rm -rf ./dist ./persist",
|
||||
"clean": "rm -rf ./dist",
|
||||
"build": "pnpm clean && tsc -p .",
|
||||
"start": "node ./dist/main.js",
|
||||
"clean-start": "pnpm build && pnpm start"
|
||||
|
|
|
@ -9,7 +9,7 @@ export function checkFile(
|
|||
const fullPath = dir + file;
|
||||
let final: ServerSideReview[];
|
||||
|
||||
if (fs.existsSync(dir)) {
|
||||
if (fs.existsSync(fullPath)) {
|
||||
const data = fs.readFileSync(fullPath, encoding);
|
||||
|
||||
final = !data.toString().trim() ? [] : JSON.parse(data.toString());
|
||||
|
|
Loading…
Reference in a new issue