npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rive-viewmodel/cli

v0.1.0

Published

CLI to generate ViewModel code from Rive (.riv) files

Downloads

27

Readme

rive-gen CLI

A Node.js CLI that generates Dart ViewModel wrapper code from Rive (.riv) files.

It uses @rive-app/canvas-advanced (the Rive JS/WASM runtime) to introspect .riv files and produces the same Dart output as the web app.

Prerequisites

  • Node.js 18+
  • npm 9+

Install

From npm (recommended)

npm install -g @rive-viewmodel/cli

Then use it from anywhere:

rive-gen --input path/to/MyAnimation.riv

Update to the latest published version:

npm install -g @rive-viewmodel/cli@latest

Usage

From the repo root (development)

Build the CLI first:

cd packages/rive-viewmodel-cli
npm install
npm run build

Then run it:

node packages/rive-viewmodel-cli/dist/bin/rive-gen.js --input path/to/file.riv

Install globally via npm link

cd packages/rive-viewmodel-cli
npm install
npm run build
npm link

Then use it from anywhere:

rive-gen --input path/to/MyAnimation.riv

Options

| Flag | Short | Description | Default | |------|-------|-------------|---------| | --input <file> | -i | Path to the .riv file | required | | --output <dir> | -o | Output directory | Same as input file | | --name <name> | -n | Output file base name (no extension) | Input file name | | --modern | | Use package:rive/rive.dart import | package:rive_native/rive_native.dart | | --interface | | Implement RiveViewModel interface | false | | --templates <dir> | | Custom Mustache templates directory | assets/templates/dart/ | | --help | -h | Display help | | | --version | -V | Display version | |

Examples

Generate with the legacy Rive import (default):

rive-gen -i assets/hero.riv -o lib/generated

Generate using the modern package:rive import:

rive-gen -i assets/hero.riv -o lib/generated --modern

Generate with the RiveViewModel interface implemented:

rive-gen -i assets/hero.riv -o lib/generated --modern --interface

Custom output file name:

rive-gen -i assets/hero_animation.riv -o lib/generated -n hero_view_model

Implementation notes

The WASM runtime is browser-first. For Node.js introspection (no rendering needed), minimal DOM stubs (document, navigator, window) are installed before loading the WASM. The Canvas/WebGL renderer is not used — only the File / ViewModel / DataEnum APIs are called to read the .riv file structure.

Shared templates

The Mustache templates in assets/templates/dart/ are shared between this CLI and the Flutter web app. Pass --templates to use a custom template directory.

At build time (npm run build) these templates are copied into the package (templates/dart/, gitignored) so the published npm tarball is self-contained and works when installed globally.

Publishing (maintainers)

The package is published to npm under the public @rive-viewmodel scope.

cd packages/rive-viewmodel-cli
npm login                 # one-time, needs access to the @rive-viewmodel org
npm version patch         # or minor / major — bumps version + git tag
npm publish               # runs prepublishOnly (build) automatically

prepublishOnly rebuilds dist/ and re-bundles templates/ before every publish, and publishConfig.access = public makes the scoped package public.