This is a CLI tool to build a static site for given Paneron RegistryKit-based dataset.
STATUS: Not production ready; currently under development.
Tested using Node 20.11.1.
Is is intended to be run as:
npx @paneron/site-builder [options...] --outdir OUTDIR
It would:
-
read Paneron dataset from current directory (can be specified with
--datadir DATADIR
), -
place site assets under
OUTDIR
, -
generate data indices as required by site runtime and place them under
OUTDIR
where expected.
npx @paneron/site-builder --outdir OUTDIR \
[--debug | --verbose] \
[--datadir DATADIR] \
[--dataversion GITREF] \
[--devextpath DEVEXTPATH] \
[--forusername USERNAME] \
[watch [--serve [--port PORT]] [--watch-template]]
--outdir OUTDIR
-
(Required) Specify path to directory for outputs. Will be created by this tool if not exists.
--debug
-
Enable debug logging.
--verbose
-
Enable verbose logging.
--datadir DATADIR
-
Specify path to Paneron dataset directory. Must contain
panerondataset.yaml
. Default: current directory. --dataversion GITREF
-
Specify Git ref of Paneron dataset under
DATADIR
. Default: whichever ref is currently checked out, i.e.git rev-parse --short HEAD
. --devextpath DEVEXTPATH
-
Specify path to local development extension.
--forusername USERNAME
-
Specify username, for access to the register.
--serve
-
Serve the built site.
--watch-template
-
Used under
watch
. Specify whether to also watch for changes in the site template directory apart from the dataset directory. --port PORT
-
Used with
--serve
. Specify port to serve the site on. Default:8080
.
Note that build is handled by esbuild, while TSC is still used for typechecking. Type errors shouldn’t be ignored, but a type error may still result in a valid build (depends on specifics).
-
Root package’s
build-self
script compiles site builder -
site/spa
’sclean-build
script compiles front-end code-
This is also run by the root package’s
build-template
script.ImportantThis repository uses Yarn PnP, but in
loose
mode for the sake ofspa
package build script. Since ExtensionKit and RegistryKit import packages that they list only indevDependencies
, in strict mode esbuild would fail with an error for every such import when bundling SPA for client-side.
-
-
Working from the repository root, build the site builder, making sure
build-site.mjs
is being output and is executable:> yarn run build-self ; yarn run build-template > ls -l build-site.mjs -rwxr-xr-x@ 1 username groupname 1943914 1 Jan 13:37 build-site.mjs
-
Run
./build-site.mjs
with the required parameters:> ./build-site.mjs --datadir DATADIR --outdir OUTDIR Fetch extension code from .../extension.js to OUTDIR/extension.js: 863.576ms Fetch package.json from .../package.json to OUTDIR/package.json: 407.994ms Fetch extension JS OUTDIR: 1.283s Scaffold site template from .../site/spa/dist into OUTDIR: 3.027s Fetch extension code from .../extension.js to OUTDIR/extension.js: 178.606ms Fetch package.json from .../package.json to OUTDIR/package.json: 87.67ms Importing site builder from .../site/spa/build-site.mjs: 84.967ms Running site builder: 754.246ms >
-
Run
./build-site.mjs
with the required parameters, with thewatch --serve
option. When done, pressCtrl-C
twice to stop serving:> ./build-site.mjs --datadir DATADIR --outdir OUTDIR watch --serve --port 8080 Fetch extension code from .../extension.js to OUTDIR/extension.js: 863.576ms Fetch package.json from .../package.json to OUTDIR/package.json: 407.994ms Fetch extension JS OUTDIR: 1.283s Scaffold site template from .../site/spa/dist into OUTDIR: 3.027s Fetch extension code from .../extension.js to OUTDIR/extension.js: 178.606ms Fetch package.json from .../package.json to OUTDIR/package.json: 87.67ms Importing site builder from .../site/spa/build-site.mjs: 84.967ms Running site builder: 754.246ms Serving on port 8080. Access at http://localhost:8080 ^C^C >
Alternatively, after building the site, run:
> npx serve OUTDIR [--listen PORT]
-
Make changes to the site builder or the site template (
site/spa
). -
Run the following to compile the site builder and the site template:
> yarn run build-self && yarn run build-template && \ ./build-site.mjs --datadir DATADIR --outdir OUTDIR \ watch --serve
-
Test the site in a browser (default at http://localhost:8080).
-
Remember to verify that everything runs without errors in the "Important scripts" section before testing & publishing.
-
Run
npm publish
from the root (no need to change into a separate “dist” dir).
See LICENSE
for license information.