feat: ship rive-gen-types as a bin - #361
Merged
Merged
Conversation
Users can now run the schema generator directly from the installed library — npx rive-gen-types assets/rive — per the packaging discussion in #352. @rive-app/canvas (the ~5MB wasm introspection dependency) is an optional peer: it is only needed at codegen time, so users who generate types add it as a devDependency (the CLI prints exactly that instruction when it is missing) and everyone else never downloads it. Mechanics: the generator is compiled to plain CommonJS (esbuild, target node20) into lib/cli/ during prepare, launched by a committed shebang wrapper in cli/ — so the published tool has no Bun or TypeScript runtime requirement. @rive-app/canvas moves to a lazy dynamic import with a friendly error, and runCli() is exported for the launcher. Verified end to end: npm pack, install into a fresh project, npx rive-gen-types without canvas (clear install hint, exit 1) and with it (correct .riv.d.ts generated). The longer-term home (separate package / future Rive CLI integration) stays open; migrating later is a deprecation notice away.
mfazekas
force-pushed
the
feat/rive-gen-types-bin
branch
from
July 30, 2026 04:54
fdc6f8e to
f43b036
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #352. Implements the packaging decision from the review discussion: the schema generator ships inside @rive-app/react-native as a
bin, with@rive-app/canvasas an optional (dev-time) peer dependency.Usage in an app:
yarn add -D @rive-app/canvas(one-time; the CLI prints this exact instruction if missing)npx rive-gen-types assets/rive/my.riv(or--all assets/rive) — writesmy.riv.d.tsnext to the assetThe published tool is plain compiled CommonJS (esbuild, target node20, built during
prepareintolib/cli/, launched via a committedcli/rive-gen-types.jswrapper) — no Bun, no TypeScript runtime, no wasm download for users who don't generate types.Verified end to end with
npm pack+ install into a fresh project: missing-canvas error path (clear hint, exit 1) and successful generation producing the expected.riv.d.ts.Longer-term home (separate
@rive-app/ts-schema-generatorpackage or the future Rive CLI) intentionally stays open — migrating is a deprecation notice in a future release.