doc: fix docs package build

Vitepress cli does some funky stuff with the tty.

Signed-off-by: Brian McGee <brian@bmcgee.ie>
This commit is contained in:
Brian McGee 2024-04-30 12:47:33 +01:00
parent 95c6cdbd57
commit 311e46a409
Signed by: brianmcgee
GPG Key ID: D49016E76AD1E8C0
3 changed files with 17 additions and 9 deletions

View File

@ -1,9 +1,12 @@
{ {
"name": "docs", "name": "Treefmt Docs",
"version": "0.0.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "Treefmt Docs",
"version": "0.0.1",
"devDependencies": { "devDependencies": {
"vitepress": "^1.1.4" "vitepress": "^1.1.4"
} }

View File

@ -1,11 +1,13 @@
{ {
"name": "treefmt-docs",
"version": "0.0.1",
"devDependencies": { "devDependencies": {
"vitepress": "^1.1.4" "vitepress": "^1.1.4"
}, },
"scripts": { "scripts": {
"vitepress": "vitepress", "vitepress": "vitepress",
"docs:dev": "vitepress dev", "dev": "vitepress dev",
"docs:build": "vitepress build", "build": "vitepress build",
"docs:preview": "vitepress preview" "preview": "vitepress preview"
} }
} }

View File

@ -9,9 +9,12 @@ _: {
inherit (self'.packages.default) version; inherit (self'.packages.default) version;
src = ../docs; src = ../docs;
npmDepsHash = "sha256-acT9uaUhvxyM/S3hv1M9h5h2H5EpzrNbaxCYmzYn100="; npmDepsHash = "sha256-J9qTWueOcSBq7qRec6YdTuWI2VlVQ0q6AynDLovf6s0=";
npmBuildScript = "docs:build"; # we have to use a custom build phase because vitepress is doing something funky with the ttty
buildPhase = ''
cat | npm run build 2>&1 | cat
'';
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
@ -32,19 +35,19 @@ _: {
inherit category; inherit category;
name = "docs:dev"; name = "docs:dev";
help = "serve docs for local development"; help = "serve docs for local development";
command = "cd $PRJ_ROOT/docs && npm run docs:dev"; command = "cd $PRJ_ROOT/docs && npm dev";
} }
{ {
inherit category; inherit category;
name = "docs:build"; name = "docs:build";
help = "create a production build of docs"; help = "create a production build of docs";
command = "cd $PRJ_ROOT/docs && npm run docs:build"; command = "cd $PRJ_ROOT/docs && npm build";
} }
{ {
inherit category; inherit category;
name = "docs:preview"; name = "docs:preview";
help = "preview a production build of docs"; help = "preview a production build of docs";
command = "cd $PRJ_ROOT/docs && npm run docs:preview"; command = "cd $PRJ_ROOT/docs && npm preview";
} }
{ {
inherit category; inherit category;