Add an incremental build example - #3
Open
OzzyCzech wants to merge 2 commits into
Open
Conversation
A fifth example built on @sphido/cache: changed() skips pages whose output is up to date, removed() reports sources that disappeared, and writeCache() records the state after the build. The build hashes itself into the version key, so editing the layout rebuilds everything, and page.output is set before changed() so a deleted public/ regenerates the site instead of trusting a cache that is right about sources and wrong about results. Verified by hand: 3 built on the first run, 0 built and 3 skipped on the second, 1 built after editing one page, removed() reporting a deleted source, and a full rebuild after rm -rf public.
Member
Author
The 1.x range is unpublishable — npm blocks the 24 versions unpublished from that name in 2024, so the package ships as 2.0.0.
Member
Author
|
Carried #2's one-line bump into this branch ( Both merge orders are safe: if #2 goes in first, this branch's copy of that change becomes a no-op. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Documents
@sphido/cache@1.0.0the way this repo documents things — as something you can run.cache/A fifth example using all three functions:
changed()skips pages whose output is up to date,removed()reports sources that disappeared,writeCache()records the state after the build. It prints what it did, so the point is visible:Two details the example demonstrates rather than explains:
versionkey, so changing the layout rebuilds every page — the cache watches content, not templatespage.outputis set beforechanged(), which is what makesrm -rf publicregenerate the sitecontent/about.mddoubles as themtimevshashdemo (touch it and the default strategy notices;hashdoes not), andcontent/blog/hello-world.mdinvites you to delete it and watchremoved()report it.Verified by hand
gone: content/blog/hello-world.md …, 0 builtrm -rf publicAlso
cacheadded to the CI matrix, so it is built on Node 22 and 24 like the otherscache/.gitignorecovers.sphido/next topublic/Depends on #2 only in spirit — that one unbreaks
main, this one is additive.