- Clone this repo.
- Run
npm install <path to this repo>
in your motion canvas project
- Run
npm install <library name here>
This repo gives you a couple benefits over starting from scratch:
- The same linting options as main motion-canvas code, which helps to keep the community on the same page.
- A build pipeline in place with:
- automatic watch support, allowing you to develop quickly
- automatic compilation and splitting for your TypeScript, allowing it to be used in a variety of environments.
- Clone this repo.
- Run
git remote add upstream https://github.com/hhenrichsen/motion-canvas-component-library-template
to gain the ability to update when this repo gets enhancements (viagit pull upstream main
) - Update the package name in
package.json
and runnpm install
. I recommend something like@username/library-name
. - Update the UMD name of this package in
rollup.config.mjs
- Update the title of this README.
- Run
npm run watch
-- this will create some files in thelib
folder for you, and rebuild them here when you make changes. - Start developing a component in the
src
folder, and make sure that it's exported from theindex.ts
file. - Run
npm install <path to this repo>
in a motion canvas project -- this will add a link to this repo in your project. - Import components from this library and verify that they work:
import {SwitchComponent} from '@username/library-name';
- Run
npm run build
one last time. - Verify that the package works when installed with
npm install <path to this repo>
. - Run
npm publish --access public
. You may have to authenticate if this is your first time publishing a package.