Adding framework adapters

From awesome-reveal/awesome-reveal · View interactive version

Adding framework adapters is an AI agent skill from the GitHub repository awesome-reveal/awesome-reveal. Adds a framework adapter package (@awesome-reveal/<framework>) to the workspace, with its build, tests, consumer skills, example and release config. Use when you start a new framework adapter, such as Svelte, Solid or Angular.

How to use this skill

Skill file

Add a framework adapter

Use packages/react and packages/vue as models. Both pass the contract suite and have a hydration test. Core does all the work, and an adapter only binds it to the framework, so that every framework behaves the same.

Copy the steps into your task list, and mark each step when it is done.

Keep the item of the adapter on the plan board, https://github.com/orgs/awesome-reveal/projects/1, in sync with the work. Set its Status to "In Progress" before step 1. Add the PR number to each checklist item that a PR covers, tick the item when the PR merges, and set "Done" when all items are ticked.

  1. Create packages/<framework> with package.json, tsconfig.json, vite.config.ts, test/tsconfig.json and the test/setup files. Copy them from packages/react, and change these items:

Keep "@awesome-reveal/core": "workspace:*", and keep "version" equal to the other packages. Add the package to the paths in tsconfig.base.json, so that the example type-checks against the sources.

  1. Prefer plain TypeScript sources, such as render functions, when the framework allows it. Then the build needs no compiler plugin, and vite-plugin-dts emits the declarations. If the framework needs a compiler plugin, pass it to defineLibConfig in vite.config.ts as the second argument. Check the declarations and the output format:
  1. Ship the SSR stylesheet in the package, so that in most setups the user imports no CSS. Copy src/reveal.css from packages/react, pass revealCss and noStyle to defineLibConfig, and set "sideEffects": ["*.css"]. Add the ./reveal.css export, as packages/react/package.json does, for the setups that need an explicit import, such as an Astro island. Import the CSS from each module that renders hidden markup, through the #reveal-style.css subpath import of packages/react/package.json. Its node condition resolves to an empty module, so that Node and the server builds of bundlers load no CSS. A component file that the framework compiles, as Host.astro is, can import the CSS directly. Copy src/reveal-style.d.ts too, because the build type-checks before dist has the CSS declarations. Add a test/browser/stylesheet.test.ts. It checks that your reveal.css equals the React copy. It also checks that the page has a style element with the data-vite-dev-id of your own copy. Re-export the Side and StartState types of core from src/index.ts.
  2. Write the API as a binding on core. Choose the layer for each API, not for the whole adapter, because one adapter can have both kinds:
  1. Render the hidden state in the server markup, so that the element does not show before hydration. Add a hydration test that renders on the server, hydrates in a browser, and fails on a mismatch warning, as packages/react/test/browser/hydration.test.tsx and packages/vue/test/browser/hydration.test.ts do. An attribute that only the server renders can cause a mismatch.
  2. Add the Vitest projects to vitest.config.ts: <framework>:unit, <framework>:browser, <framework>:package, and <framework>:ssr when the framework renders on a server.
  1. Write the tests in test/browser/ with the helpers of @awesome-reveal/test-utils, and add test/browser/contract.test.ts with a harness for describeContract of each reveal API and for describeCascadeContract of each cascade API. Run describeSSRContract from the SSR test, with "cascade" as the hidden value for a cascade API, as the React and Vue packages do. A scenario that fails is a bug of the adapter. Do not skip it.
  2. Port the tests of packages/react/test/package: the dist files and exports, the server markup, describeDocs, and the tree-shaking fixtures with size limits, through bundleFixture() of @awesome-reveal/test-utils/bundle. Drop the "use client" test if the framework has no Server Components. describeDocs type-checks only the ts and tsx fences of the consumer skills and of the README. Put the setup and native keyframes examples in these fences, as whole modules with their imports.
  3. Add the consumer skills in packages/<framework>/skills/<name>/SKILL.md, and add skills to files. Port adding-reveal-animations from the React package.
  4. Add examples/<framework>, with the sections of examples/react.
  5. Add the package to release-please-config.json, with "component" set to the package name, and to linked-versions. Without "component", release-please drops the npm scope from the tags. Add its path to .release-please-manifest.json, with the current version of core. Before the release PR merges, do "Publish a new package" in the releasing-packages skill. Its steps need the npm one-time codes of the user, so list them in your final report.
  6. Update the repo config for the framework:
  1. Add the package to the package table in the root README.md. In .github/ISSUE_TEMPLATE/bug_report.yml, add it to the package dropdown, and add a StackBlitz template of the framework, such as vite.new/vue-ts or astro.new/minimal, to the reproduction field.
  2. Add .claude/rules/<framework>/adapter.md for the gotchas of the framework, with paths: ["packages/<framework>/**", "examples/<framework>/**"].
  3. The docs site is the separate repo awesome-reveal/website. List the adapter page in your final report as work for that repo.
  4. Run the checks:

Fix each failure, then run all the checks again. Open the PR only when all of them pass.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.