pi-fluency 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { mkdir as mkdirCallback, realpath, rmdir, rmdirSync, stat, utimes } from "node:fs";
|
|
2
3
|
import { appendFile, chmod, mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
3
4
|
import { join } from "node:path";
|
|
4
5
|
import { lock, type LockOptions } from "proper-lockfile";
|
|
@@ -52,6 +53,7 @@ import {
|
|
|
52
53
|
defaultPracticeSettings,
|
|
53
54
|
} from "./practice-settings.js";
|
|
54
55
|
|
|
56
|
+
const lockFs = { mkdir: mkdirCallback, realpath, rmdir, rmdirSync, stat, utimes };
|
|
55
57
|
const HISTORY_SCHEMA_WARNING = "History migration required; run /fluency clear";
|
|
56
58
|
const HISTORY_GENERATION_FILE = "history-generation";
|
|
57
59
|
const PRIVATE_DIRECTORY_MODE = 0o700;
|
|
@@ -139,7 +141,8 @@ function decodeSettings(value: unknown): FluencySettings {
|
|
|
139
141
|
}
|
|
140
142
|
|
|
141
143
|
export class FluencyStore {
|
|
142
|
-
private static lockProvider: LockProvider =
|
|
144
|
+
private static lockProvider: LockProvider = (file, options) =>
|
|
145
|
+
lock(file, { ...options, fs: lockFs });
|
|
143
146
|
private static settingsFileReplacer: FileReplacer = rename;
|
|
144
147
|
private static practiceFileReplacer: FileReplacer = rename;
|
|
145
148
|
private static historyFileReplacer: FileReplacer = rename;
|