@knitkit/create
v0.1.0
Published
Scaffold a runnable knitkit starter (host + remote, shared singleton) in one command.
Downloads
90
Maintainers
Readme
@knitkit/create
Scaffold a runnable knitkit starter in one command.
npm create @knitkit my-app
cd my-app
npm run dev # http://localhost:8080(or pnpm create @knitkit my-app, yarn create @knitkit my-app, bun create @knitkit my-app)
You get a host that loadRemote()s a remote behind its own manifest, sharing one module
instance across the boundary — no bundler plugin, no build step. Open DevTools → Network to
watch the import map resolve and the remote load; click either +1 button to see the shared
singleton update both sides.
What it scaffolds
index.html host page: one import map + a bootstrap that
registerRemotes() then imports the app
src/main.js host app: loadRemote("widgets/Widget") + shared UI
remote/widget.js the exposed remote module (mount(el))
remote/knit.manifest.json the remote's manifest
shared/store.js the shared singleton both sides import
serve.mjs a dependency-free static serverThe runtime is loaded from a CDN, so the demo runs with zero install.
Usage
npm create @knitkit [dir] [--force]dir— target directory (defaultknitkit-app). The scaffoldedpackage.jsonname is derived from it.--force— scaffold into a directory that already exists and is non-empty.
