-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add simple and temporary bin script for indexing folder
- Loading branch information
Showing
3 changed files
with
42 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env node | ||
|
||
import { MarkdownDB } from "@flowershow/markdowndb"; | ||
|
||
// TODO get these from markdowndb.config.js or something | ||
const dbPath = "markdown.db"; | ||
const ignorePatterns = [/Excalidraw/, /.obsidian/, /DS_Store/]; | ||
const [contentPath] = process.argv.slice(2); | ||
|
||
if (!contentPath) { | ||
throw new Error("Invalid/Missing path to markdown content folder"); | ||
} | ||
|
||
const client = new MarkdownDB({ | ||
client: "sqlite3", | ||
connection: { | ||
filename: dbPath, | ||
}, | ||
}); | ||
|
||
await client.init(); | ||
|
||
await client.indexFolder({ | ||
folderPath: contentPath, | ||
ignorePatterns: ignorePatterns, | ||
}); | ||
|
||
process.exit(); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.