Skip to content

Commit 87ccdc5

Browse files
committed
fixing condition
1 parent 8708766 commit 87ccdc5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { promises as fs ,existsSync} from "fs";
2-
import {createIfNot} from "./utils/fileUtils"
2+
import {createIfNot} from "./utils/fileUtils.js"
33
import * as path from "node:path"
44
async function writeSQL(statement: string, saveFileAs = "") {
55
try {
66
const destinationFile = process.argv[2] || saveFileAs;
77
if (!destinationFile) {
88
throw new Error("Missing saveFileAs parameter");
99
}
10-
createIfNot(path.resolve(`/sql/${destinationFile}.sql`))
10+
createIfNot(path.resolve(`./sql/${destinationFile}.sql`))
1111
await fs.writeFile(`sql/${process.argv[2]}.sql`, statement);
1212
} catch (err) {
1313
console.log(err);
@@ -19,7 +19,7 @@ async function readCSV(csvFileName = "") {
1919
if (!fileAndTableName) {
2020
throw new Error("Missing csvFileName parameter");
2121
}
22-
if(existsSync(path.resolve(`./csv/${fileAndTableName}.csv`))){
22+
if(!existsSync(path.resolve(`./csv/${fileAndTableName}.csv`))){
2323
console.log("file not found")
2424
return
2525
}

0 commit comments

Comments
 (0)