mirror of
https://bitbucket.org/siakitem/my-pi.git
synced 2026-08-28 08:35:57 +00:00
feat: add hashline editing and TypeScript LSP
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
||||
import { dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const BUNDLE_CONFIG_PATH = fileURLToPath(new URL("../config/pi-hashline-edit.json", import.meta.url));
|
||||
|
||||
export function deployBundleHashlineConfig(agentDir: string): void {
|
||||
const targetPath = join(agentDir, "hashline.json");
|
||||
const bundledConfig = readFileSync(BUNDLE_CONFIG_PATH, "utf8");
|
||||
|
||||
try {
|
||||
if (readFileSync(targetPath, "utf8") === bundledConfig) {
|
||||
return;
|
||||
}
|
||||
} catch {
|
||||
// Missing or unreadable target: replace it with the bundle-owned defaults.
|
||||
}
|
||||
|
||||
mkdirSync(dirname(targetPath), { recursive: true });
|
||||
const temporaryPath = `${targetPath}.my-pi.tmp`;
|
||||
writeFileSync(temporaryPath, bundledConfig, "utf8");
|
||||
renameSync(temporaryPath, targetPath);
|
||||
}
|
||||
Reference in New Issue
Block a user