feat(recipe): publish as @dfinity/static-site, add presync config field - #112
Merged
Conversation
Rename the published recipe from `@dfinity/certified-assets` to `@dfinity/static-site` across the publish script, the recipe README, the user docs, and doc comments. The name only ever appears in a project's canister.yaml, so it should describe the recipe's input (a built static site) rather than the canister's role (already `name: frontend`) — matching the name-by-input pattern of the sibling `@dfinity/rust`/`@dfinity/motoko` recipes. Repo/canister references (the dfinity/certified-assets repo, the .did, "the certified-assets canister wasm") are deliberately unchanged. The release workflow now runs `make recipe-release` (one invocation, no extra rebuild) and uploads `dist/recipe.hbs` as a release asset — no sibling .sha256, since the recipe pins the wasm shas internally. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
`presync` is an array of shell commands, analogous to `build`, but expanded
into the sync section as a script step *before* the sync-plugin step (rather
than into the build section). Sync steps run after the canister exists, so
icp-cli exposes the deployed canister IDs to them — `ICP_CLI_CID`,
`ICP_CLI_CID_<NAME>` (per project canister), `ICP_CLI_NETWORK`, and
`ICP_CLI_ENVIRONMENT`. This lets a frontend build bake in the IDs it will
call, which `build` cannot do (it runs before creation, with only
`ICP_WASM_OUTPUT_PATH`).
The field name is `presync` (no hyphen) so it works as a Handlebars path in
the template's `{{#if presync}}` / `{{#each presync}}`.
Tests:
- recipe-gen `local_with_presync`: presync renders as a sync script step
before the plugin step, leaving the build section untouched.
- e2e `recipe_presync_env`: a deployed project's presync steps write
$ICP_CLI_CID and $ICP_CLI_CID_FRONTEND into the asset dir; the served files
(fetched through the gateway, so certified) each equal the frontend
canister's principal — proving the env vars are genuinely readable.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The release CI attaches the generated recipe.hbs (URL + sha256 pinned) to the GitHub release, and publish-recipe.sh now downloads that asset and commits it to the registry PR verbatim, instead of regenerating it locally from the release's .sha256 files. This makes the release the single source of truth for the published recipe — no template drift between build time and publish time — and drops the cargo/recipe-gen dependency from the publish path. The registry PR body links back to the release's recipe.hbs asset so a reviewer can confirm the committed file is identical to what shipped. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
lwshang
marked this pull request as ready for review
July 22, 2026 18:40
lwshang
added a commit
that referenced
this pull request
Jul 22, 2026
Two doc-only changes prompted by the v0.3.0 launch (first public static-site recipe release). - **`project-stage.md` reframed for launch.** The old "pre-launch, no production instances, break anything" stance no longer holds now that the recipe is public. The rule now states the compatibility contract the release machinery already encodes (`wire-types/version.rs`, README "Releasing"): patch bumps preserve stable state across an in-place upgrade; breaking stable-state changes require a series (minor, pre-1.0) bump that reinstalls and wipes state; and the recipe config (`dir`/`build`/`presync`/`metadata`) is now a public interface. - **README recipe snippet gains `presync`.** The field was added in #112 but the contributor-facing example still listed only `dir`/`build`/`metadata`; now it matches the recipe README and `docs/overview.md`. No code changes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Prepares this repo's recipe for public release in
icp-cli-recipesand adds a new configuration field.Rename to
@dfinity/static-siteThe published recipe is renamed from
@dfinity/certified-assetsto@dfinity/static-siteacross the publish script, recipe README, user docs, and doc comments. The recipe name only appears in a project'scanister.yaml, so it should name the recipe's input (a built static site) — matching the name-by-input pattern of the sibling@dfinity/rust/@dfinity/motokorecipes — not the canister's role (alreadyname: frontend). Repo/canister references (thedfinity/certified-assetsrepo, the.did, "the certified-assets canister wasm") are deliberately unchanged.New
presyncconfig fieldpresyncis an array of shell commands, analogous tobuild, but expanded into the sync section as a script step before the sync-plugin step. Sync steps run after the canister exists, soicp-cliexposes the deployed canister IDs to them:ICP_CLI_CID,ICP_CLI_CID_<NAME>(per project canister),ICP_CLI_NETWORK, andICP_CLI_ENVIRONMENT. This lets a frontend build bake in the IDs it will call — somethingbuildcannot do (it runs before creation, with onlyICP_WASM_OUTPUT_PATH).Ship + verify the recipe via the GitHub release
make recipe-releaseand attaches the generatedrecipe.hbs(URL + sha256 pinned — the public form, not the local file-path variant) to the GitHub release.publish-recipe.shdownloads that asset and commits it to the registry PR verbatim (instead of regenerating locally), and the PR links back to the release asset so reviewers can verify the two are identical. This drops thecargo/recipe-gendependency from the publish path and removes any template-drift risk.Tests
recipe-genunit tests: 6/6, incl.local_with_presync(assertspresyncrenders as a sync script step before the plugin step).recipe_presync_env— a live deploy whose pre-sync step reads$ICP_CLI_CID/$ICP_CLI_CID_FRONTENDinto served assets, which are then fetched through the gateway (certified) and asserted to equal the frontend canister's own principal, proving the env vars are genuinely readable.Follow-ups (not in this PR)
v<version>release cuts, runscripts/publish-recipe.sh v<version> --pushto open the@dfinity/static-sitePR againsticp-cli-recipes, and close the stale@dfinity/certified-assetsPR #30.icp newtemplates (icp-cli repo) to the new recipe and deprecate@dfinity/asset-canister.🤖 Generated with Claude Code