A note-taking app inspired by nb
1import { walk } from "@std/fs";
2import { commit } from "./git.ts";
3import { join } from "@std/path/join";
4import { Notebook } from "./notebook.ts";
5
6const migrations = [
7 removeIndexFiles,
8];
9
10export async function migrate(notebook: Notebook) {
11 for (const migration of migrations) {
12 await migration(notebook);
13 }
14 Deno.writeTextFileSync(join(notebook.root, ".hsh"), "version: 2\n");
15}
16
17async function removeIndexFiles(notebook: Notebook) {
18 const root = notebook.root;
19 for await (const entry of walk(root, { match: [/\.index$/] })) {
20 Deno.removeSync(entry.path);
21 }
22 commit(notebook, "migrated off .index files");
23}