Skip to content

Add @fishjam-cloud/composition-cli: build and scaffold composition templates#287

Open
Gawor270 wants to merge 7 commits into
mainfrom
fce-3197
Open

Add @fishjam-cloud/composition-cli: build and scaffold composition templates#287
Gawor270 wants to merge 7 commits into
mainfrom
fce-3197

Conversation

@Gawor270

@Gawor270 Gawor270 commented Jul 3, 2026

Copy link
Copy Markdown
Member

Summary

New package @fishjam-cloud/composition-cli — a CLI that scaffolds and builds composition template bundles

  • composition-cli init <dir> — scaffolds a template project (package.json with supported dependency versions, tsconfig, hello-world src/App.tsx)
  • composition-cli build [entry] — bundles the template and validates it locally against the platform contract, so contract violations fail at build time with named reasons instead of at upload with an opaque Invalid user bundle

For now validation uses manifest v1 that is compatible with foundry template worker environment, but we're planning to add
version management in templates API so the validation step may possibly change later

Gawor270 added 4 commits July 3, 2026 12:09
- pin es-module-lexer to the template-worker's major (1.x) to keep parser parity
- reserve multipart/config overhead headroom under the upload limit
- smoke-load the bundle with stubbed externals and verify the default export is a React component
- reject builds emitting more than one output file
- normalize scaffold package names and surface non-ENOENT init errors
- print esbuild diagnostics once and always exit explicitly
@linear

linear Bot commented Jul 3, 2026

Copy link
Copy Markdown

FCE-3197

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new workspace package @fishjam-cloud/composition-cli, providing a CLI to scaffold composition template projects and build/validate template bundles locally (to fail fast with actionable contract violations). This fits into the repo as tooling around the existing @fishjam-cloud/composition template contract and build pipeline.

Changes:

  • Introduces composition-cli init (scaffold template project) and composition-cli build (bundle + validate + smoke-load).
  • Adds contract/manifest definitions plus validation/smoke-check logic, with Vitest coverage for init/build/validation.
  • Updates CI to run unit tests for composition and composition-cli, and updates release workflow to publish the new package.

Reviewed changes

Copilot reviewed 18 out of 19 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
yarn.lock Adds new workspace + dependencies (esbuild/tsup/commander/vitest, etc.) needed for the CLI.
packages/composition-cli/tsconfig.json TypeScript config for the new CLI package.
packages/composition-cli/tests/validate.test.ts Unit tests for import/ESM contract validation.
packages/composition-cli/tests/init.test.ts Unit tests for project scaffolding behavior.
packages/composition-cli/tests/build.test.ts Unit tests for bundling + validation + size limits + smoke checks.
packages/composition-cli/src/validate.ts Implements static validation of bundle imports/exports.
packages/composition-cli/src/smoke.ts Implements smoke-load validation (load bundle and verify default export is a component).
packages/composition-cli/src/manifests/v1.ts Defines the v1 platform contract (allowed imports, build target, size limit, scaffold deps).
packages/composition-cli/src/manifests/types.ts Defines the manifest TypeScript type.
packages/composition-cli/src/manifests/index.ts Manifest registry + getManifest() lookup with error on unknown target.
packages/composition-cli/src/init.ts Implements init scaffolding (package.json/tsconfig/App.tsx/.gitignore).
packages/composition-cli/src/index.ts CLI entrypoint wiring (build and init) via commander.
packages/composition-cli/src/build.ts Implements esbuild bundling + validation + size checking + outfile write.
packages/composition-cli/README.md Package documentation for install/usage.
packages/composition-cli/package.json New package metadata, scripts, dependencies, bin entry.
packages/composition-cli/LICENSE Apache-2.0 license text for the new package.
packages/composition-cli/eslint.config.mjs ESLint config for the new package.
.github/workflows/static.yaml Runs workspace unit tests in CI.
.github/workflows/release.yaml Adds composition-cli to the publish matrix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/composition-cli/src/validate.ts Outdated
Comment thread packages/composition-cli/src/smoke.ts Outdated
Comment thread packages/composition-cli/src/build.ts Outdated
Comment thread packages/composition-cli/package.json Outdated
Comment thread packages/composition-cli/package.json
- type lexer results explicitly in validateBundle
- surface smoke-build failures as validation violations
- clamp bundle budget at zero for tiny upload limits
- fix package description typo and add license field
@Gawor270 Gawor270 requested a review from czerwiukk July 3, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants