Awesome
matter-plugin-boilerplate
A plugin boilerplate for matter.js
This project helps you quickly start a production ready plugin. If you just want to build something quickly, check out the minimal plugin example first.
The wiki articles on Using plugins and Creating plugins contain information on the plugin format and provide some best practices. It can also be useful to study the implementation of existing plugins.
Features
- a simple plugin example (
matter-js
) - build, develop and release scripts (
npm run <x>
) - a bundler and dev server (
webpack
) - an ES6 transpiler (
babel
) - a linter (
eslint
) - a test suite (
mocha
andchai
) - a documentation generator (
markdox
) - a demo runner (
matter-tools
) - continuous integration (
travis
)
Usage
- Import or manually clone this repository
- Update
package.json
- Run
npm install && npm run build
- Implement your plugin code
- Create a examples
- Write tests
- Document the code
- Release your plugin (see commands)
- Enable Github Pages to serve the demo
- Setup Travis CI (optional)
- Update the readme
Notes
Running a build will automatically replace strings commented with PLUGIN_NAME
, PLUGIN_VERSION
and PLUGIN_REPO_URL
with constants pulled directly from package.json
.
Leave these intact unless you wish to manually keep them up to date.
The included plugin is a very basic example that just sets the friction of all bodies to 0
after creation.
If you add more source files, you will need to update the lint
, doc
and version
scripts in package.json
.
Commands
All commands are implemented as npm scripts:
npm run build
- builds the pluginnpm run dev
- runs development servernpm run test
- runs testsnpm run lint
- runs linternpm run doc
- outputs docs toAPI.md
npm run release
- lint, test, bump minor, build, doc, commit, tag, push, publish (any will stop all on failure)npm run release-patch
- same as above but patch bump