Packages
PopCraft's npm packages: the popcraft command line, the design kit, the plugin SDK and the runtime exported code shares — what each is for and which to install.
Packages
PopCraft publishes four packages on npm. Each does one job; pick by what you are making.
| Package | Install | What it is for |
|---|---|---|
@popcraft/cli | npm i -g @popcraft/cli | The popcraft command line: edit .popcraft files headlessly, build designs from scripts, render and export, call the REST API, publish to the marketplace, drive the desktop app |
@popcraft/kit | npm i @popcraft/kit | Everything PopCraft's templates are made with: the Kit and every helper, style system and theme kit, every official template's source, the official build and every check, design scripts, .popcraft files, and the types for an editor |
@popcraft/plugins | npm i -D @popcraft/plugins | The plugin SDK: the types plugins and widgets are written against |
@popcraft/runtime | added by an export | What projects exported as code share: expressions, prototype and state machine players, a site's forms, sign-in and records, and (@popcraft/runtime/commerce) the Next.js Commerce types storefronts bind to |
Which one
- Making designs from a terminal, a script or an AI agent: the CLI. It depends on the kit, so
write_designbuilds with the same code the templates use. Add@popcraft/kitto your project as well for completion and checking while you write design scripts (/// <reference types="@popcraft/kit/design-script" />). - Making templates for the gallery:
@popcraft/kitbeside your sources, and the CLI'spopcraft templateto build, check, picture and publish them (Making templates). - Making designs inside your own program (a build step, a server that makes images, a test):
@popcraft/kit.runDesign(script, { size })runs a design script in a sandbox and returns the document and its checks;toPopcraft(document)gives the file. Rendering a picture or a video needs the app's canvas: hand the file topopcraft run … export.nodes. - Extending the editor:
@popcraft/plugins, with the plugin guide. - Shipping an exported Next.js project: nothing to do; its
package.jsonalready asks for@popcraft/runtime. - Designing a Shopify store's pages: export them as a storefront: a whole Next.js
Commerce store, or components for one (add
@popcraft/runtimeto it). A Shopify theme is the Ecommerce plugin's.
Examples
Working projects for each package, in getpopcraft/examples: npm install,
then run one. They install the published packages, and run against the latest releases every week.
How they fit together
@popcraft/cli ──depends on──▶ @popcraft/kit (the kit's code and types)
exported project ──depends on──▶ @popcraft/runtime
plugin ──types from──▶ @popcraft/pluginsEverything a package does is also a command in PopCraft itself: the CLI, the editor's agent, plugins and the REST API run the same commands, so a design made one way opens and edits the same everywhere.
For AI agents: Designing with an AI agent is the method, the design reference is the kit by topic with worked examples.