mirror of
https://github.com/sbrow/thor.git
synced 2026-10-25 02:01:56 -04:00
fix: ./defaults is now published alongside the binary.
Stopgap until they can be properly included in the build.
This commit is contained in:
@@ -9,6 +9,14 @@
|
|||||||
|
|
||||||
Remember to polish existing features before moving on to new ones.
|
Remember to polish existing features before moving on to new ones.
|
||||||
|
|
||||||
|
- [ ] Bake the default `layouts` into the binary at compile time via
|
||||||
|
`#load_directory` so the binary is self-contained and doesn't read
|
||||||
|
`DEFAULTS_PATH` from disk at runtime.
|
||||||
|
- `#load_directory` is NOT recursive and its `name` is the base filename
|
||||||
|
only, so `defaults/layouts` and `defaults/layouts/partials` must be loaded
|
||||||
|
separately and mounted into the VFS with `data` set (not `fs_path`).
|
||||||
|
- Removes the runtime dependency on `THOR_DEFAULTS_PATH` / `#directory` and
|
||||||
|
the need to ship `defaults/` alongside the binary (see `flake.nix`).
|
||||||
- [ ] `build` command alias of default
|
- [ ] `build` command alias of default
|
||||||
- [ ] `new site` command to set up new project
|
- [ ] `new site` command to set up new project
|
||||||
- [ ] Some render errors blank the entire page instead of scoping to the failing tag.
|
- [ ] Some render errors blank the entire page instead of scoping to the failing tag.
|
||||||
|
|||||||
+14
-1
@@ -2,4 +2,17 @@ package main
|
|||||||
|
|
||||||
import "core:os"
|
import "core:os"
|
||||||
|
|
||||||
DEFAULTS_PATH :: #directory + os.Path_Separator_String + "defaults"
|
// Path to the built-in default layouts, resolved at runtime.
|
||||||
|
//
|
||||||
|
// The default points at the `defaults` directory next to the source tree (via
|
||||||
|
// `#directory`), which works for local `odin run`/`odin build` from the repo.
|
||||||
|
// Packaged builds install `defaults/` to a fixed location and override this
|
||||||
|
// with `-define:THOR_DEFAULTS_PATH=<path>` (see flake.nix).
|
||||||
|
//
|
||||||
|
// TODO: bake these into the binary at compile time via `#load_directory` so the
|
||||||
|
// binary is self-contained and this runtime path goes away entirely. See
|
||||||
|
// TODOS.md.
|
||||||
|
DEFAULTS_PATH :: #config(
|
||||||
|
THOR_DEFAULTS_PATH,
|
||||||
|
#directory + os.Path_Separator_String + "defaults",
|
||||||
|
)
|
||||||
|
|||||||
@@ -141,13 +141,20 @@
|
|||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
runHook preBuild
|
runHook preBuild
|
||||||
odin build . -o:speed -no-bounds-check -out:${pname}-keep
|
odin build . -o:speed -no-bounds-check \
|
||||||
|
-define:THOR_DEFAULTS_PATH=$out/share/thor/defaults \
|
||||||
|
-out:${pname}-keep
|
||||||
runHook postBuild
|
runHook postBuild
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
install -Dm755 ${pname}-keep $out/bin/${pname}
|
install -Dm755 ${pname}-keep $out/bin/${pname}
|
||||||
|
# Ship the built-in default layouts alongside the binary. The
|
||||||
|
# binary reads these at runtime from THOR_DEFAULTS_PATH (baked in
|
||||||
|
# above). Keep in sync with defaults.odin.
|
||||||
|
mkdir -p $out/share/thor
|
||||||
|
cp -r defaults $out/share/thor/defaults
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user