mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-17 19:15:59 +08:00
storing path in const
This commit is contained in:
parent
b54cf2b03f
commit
bc9209e15e
1 changed files with 5 additions and 3 deletions
|
@ -6,9 +6,11 @@ import fs from "fs";
|
|||
import db from "../init/db";
|
||||
import MonkeyError from "../utils/error";
|
||||
|
||||
const PATH_TO_REPO = "../../../../monkeytype-new-quotes";
|
||||
|
||||
let git;
|
||||
try {
|
||||
git = simpleGit(path.join(__dirname, "../../../../monkeytype-new-quotes"));
|
||||
git = simpleGit(path.join(__dirname, PATH_TO_REPO));
|
||||
} catch (e) {
|
||||
git = undefined;
|
||||
}
|
||||
|
@ -27,7 +29,7 @@ class NewQuotesDAO {
|
|||
//check for duplicate first
|
||||
const fileDir = path.join(
|
||||
__dirname,
|
||||
`../../../../monkeytype-new-quotes/static/quotes/${language}.json`
|
||||
`${PATH_TO_REPO}/static/quotes/${language}.json`
|
||||
);
|
||||
let duplicateId = -1;
|
||||
let similarityScore = -1;
|
||||
|
@ -82,7 +84,7 @@ class NewQuotesDAO {
|
|||
let message = "";
|
||||
const fileDir = path.join(
|
||||
__dirname,
|
||||
`../../../monkeytype-new-quotes/static/quotes/${language}.json`
|
||||
`${PATH_TO_REPO}/static/quotes/${language}.json`
|
||||
);
|
||||
await git.pull("upstream", "master");
|
||||
if (fs.existsSync(fileDir)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue