fastn build
. This
will enable as to only rebuild only the minimum number of files needed in the
output directory, and will significantly cut down build time.This document exists to describe a proposal for enhancing the fastn
language.
This is a Request For Comment. Please share your comments by posting them in the
pull request for this RFC if this RFC is not merged yet. If the RFC is merged,
you can post comment on our official Discord, or
open a discussion on Github.
rfc
..build
folder. If we have cache metadata about the previous, we can do
incremental build, and achieve much faster builds.build-cache.json
, which will contain the
following information:-- record build-cache:
string fastn-version:
document list documents:
file list assets:
file list fonts:
-- record file:
string path:
string checksum:
-- record document:
file file:
string html-checksum:
string list dependencies:
fastn build
runs, it will load the existing build-cache.json
,
and scan the current folder, .packages
and .build
folders. From these we
can compute what all files must exist in the final .build
folder, and which
ever is missing from .build
folder, or have wrong checksum
we will overwrite
those files.FASTN_BUILD_DIR
and FASTN_CACHE_DIR
to
overwrite where we store the build and cache files. By default if
FASTN_BUILD_DIR
is missing we will continue to use .build
folder and if
FASTN_CACHE_DIR
is missing we will use OS specific cache directory.fastn build --ignore-cache
We can also allow this command which will ignore cache and rebuild everything.
We rejected this because this is clearly a bug in fastn, and never a feature that end users would want. We can instead givefastn clean
which will delete
.build
folder, the entire cache folder and so on.Since this feature requires us to preserve cache across fastn build
, and on
CI systems it will require CI provider specific steps, we can offer a free
remote build cache service, simplifying this step.
build-cache.json
and
the content of the .build
folder, later being much bigger.The feature itself requires no training as this is an internal optimisation.
Confiruing CI systems to preserve build cache across builds is required. We will be updating our fastn-template Github Action to include build caching. We will also have to write blog post on how to enable build caching on Vercel, and other hosting providers who give caching.