Publish
Produce optimized, fingerprinted assets in dist/ and rewrite HTML to reference them. Intended for production deploys and the Docker sandbox.
Purpose
- Create lean, cache-friendly assets with stable HTML references.
- Validate production routing and manifests.
When To Use
- Before deploying or validating with the Docker sandbox.
CLI
webstir publish [--runtime <frontend|backend|all>]
Steps
- Run frontend and backend pipelines in production mode.
- Use esbuild to bundle, tree-shake, minify JavaScript, and perform automatic code-splitting (10-100x faster).
- esbuild handles content hashing for JavaScript:
index-<hash>.jsfor entries,chunks/*-<hash>.jsfor shared code. - Webstir fingerprints CSS assets:
index.<hash>.css. - Minify HTML/CSS and remove comments and source maps.
- Generate per-page
manifest.jsonwith entry point mappings. - Rewrite page HTML to reference fingerprinted assets from the manifest.
- Optimize and copy Images, Fonts, and Media to
dist/frontend/{images|fonts|media}/**.
Outputs
dist/frontend/pages/<page>/index.htmldist/frontend/pages/<page>/index-<hash>.js(entry point)dist/frontend/pages/<page>/index.<hash>.cssdist/frontend/pages/<page>/manifest.jsondist/frontend/chunks/*-<hash>.js(shared code chunks)- Static assets:
dist/frontend/{images|fonts|media}/** - Shared app assets under
dist/frontend/app/*
Notes
- Code-splitting: esbuild automatically extracts shared dependencies into chunks. The browser loads these transparently via ESM imports—no manual chunk management needed.
- Dynamic imports are not inlined by the bundler in v1. If your page (or app) uses
import('...'), the call remains at runtime. For assets under the app shell, use absolute paths (e.g.,await import('/app/router.js')) so they resolve correctly after publish. - JavaScript minification via esbuild includes identifier mangling, dead code elimination, and console stripping.
--runtime/-r: publish only thefrontend, only thebackend, orall(default). Handy when you need to regenerate backend bundles for a job or API patch without touching the UI artifacts.
Examples:
webstir publish --runtime backend— push a new backend bundle without rebuilding pages.webstir publish --runtime frontend— ship UI fixes when server code is unchanged.
Errors & Exit Codes
- Non-zero on pipeline failures or missing inputs.
- Logs indicate which page or asset failed.