File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 1
1
import { promises as fs , existsSync } from "fs" ;
2
- import { createIfNot } from "./utils/fileUtils"
2
+ import { createIfNot } from "./utils/fileUtils.js "
3
3
import * as path from "node:path"
4
4
async function writeSQL ( statement : string , saveFileAs = "" ) {
5
5
try {
6
6
const destinationFile = process . argv [ 2 ] || saveFileAs ;
7
7
if ( ! destinationFile ) {
8
8
throw new Error ( "Missing saveFileAs parameter" ) ;
9
9
}
10
- createIfNot ( path . resolve ( `/sql/${ destinationFile } .sql` ) )
10
+ createIfNot ( path . resolve ( `. /sql/${ destinationFile } .sql` ) )
11
11
await fs . writeFile ( `sql/${ process . argv [ 2 ] } .sql` , statement ) ;
12
12
} catch ( err ) {
13
13
console . log ( err ) ;
@@ -19,7 +19,7 @@ async function readCSV(csvFileName = "") {
19
19
if ( ! fileAndTableName ) {
20
20
throw new Error ( "Missing csvFileName parameter" ) ;
21
21
}
22
- if ( existsSync ( path . resolve ( `./csv/${ fileAndTableName } .csv` ) ) ) {
22
+ if ( ! existsSync ( path . resolve ( `./csv/${ fileAndTableName } .csv` ) ) ) {
23
23
console . log ( "file not found" )
24
24
return
25
25
}
You can’t perform that action at this time.
0 commit comments