@@ -12,7 +12,7 @@ export async function importNotes(notesDir) {
12
12
console . info ( `\nLoaded already imported ${ importedNoteList . length } notes` )
13
13
14
14
// noinspection JSValidateTypes
15
- const files = getNotesFiles ( notesDir )
15
+ const { files } = getNotesFiles ( notesDir )
16
16
17
17
let fileIndex = 0
18
18
for ( const relFilePath of files ) {
@@ -63,9 +63,10 @@ async function createParentNotes(relFilePath) {
63
63
}
64
64
65
65
function getNotesFiles ( notesDir ) {
66
+ const filesAndDirs = readdirSync ( notesDir , { recursive : true } )
66
67
// noinspection JSValidateTypes
67
- return readdirSync ( notesDir , { recursive : true } )
68
- . filter ( it => lstatSync ( ` ${ notesDir } / ${ it } ` ) . isFile ( ) )
68
+ const files = filesAndDirs . filter ( it => lstatSync ( ` ${ notesDir } / ${ it } ` ) . isFile ( ) )
69
+ return { filesAndDirs , files }
69
70
}
70
71
71
72
async function saveNoteToNotion ( noteInfo ) {
@@ -95,7 +96,7 @@ async function saveNoteToNotion(noteInfo) {
95
96
}
96
97
97
98
export async function getImportNotesStatus ( notesDir ) {
98
- const notesCount = getNotesFiles ( notesDir ) . length
99
+ const notesCount = getNotesFiles ( notesDir ) . filesAndDirs . length
99
100
const importedNotes = await loadImportStatuses ( )
100
101
const importedCount = importedNotes . length
101
102
const importedWithErrorsCount = importedNotes . filter ( it => ! it . imported ) . length
0 commit comments