reorg: no symlinks, just real files. This works on mac
This commit is contained in:
+2
-8
@@ -20,8 +20,8 @@ from pydantic import BaseModel
|
||||
|
||||
# Resolved at startup relative to the project root (one level above this file)
|
||||
_ROOT = Path(__file__).parent.parent
|
||||
pages_dir: Path = _ROOT / os.environ.get("WIKI_PAGES_DIR", "pages")
|
||||
stories_dir: Path = _ROOT / os.environ.get("WIKI_STORIES_DIR", "stories")
|
||||
pages_dir: Path = _ROOT / os.environ.get("WIKI_PAGES_DIR", "site/src/content/entries")
|
||||
stories_dir: Path = _ROOT / os.environ.get("WIKI_STORIES_DIR", "site/src/content/blog")
|
||||
site_dir: Path = _ROOT / "site"
|
||||
_DB_PATH = _ROOT / "data" / "wiki.db"
|
||||
|
||||
@@ -200,17 +200,11 @@ def _save(slug: str, body: PageBody, base: Path) -> JSONResponse:
|
||||
path.write_text(body.content, encoding="utf-8")
|
||||
return JSONResponse({"slug": slug, "saved": True})
|
||||
|
||||
_SENTINEL = site_dir / "src" / "_content-sentinel.ts"
|
||||
|
||||
def _delete(slug: str, base: Path) -> JSONResponse:
|
||||
path = _slug_to_path(slug, base)
|
||||
if not path.exists():
|
||||
raise HTTPException(404, "Not found")
|
||||
path.unlink()
|
||||
# Bump the sentinel to force Astro to re-run all content loaders.
|
||||
# macOS fsevents never fires unlink events through symlinks, so deleted
|
||||
# entries stay in the store until a loader re-run prunes them.
|
||||
_SENTINEL.write_text(f"export const _t = {int(time.time())};\n")
|
||||
return JSONResponse({"slug": slug, "deleted": True})
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user