Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adrienpoly/stimulus-library-boilerplate
A simple boilerplate to publish standard Stimulus Controller as an NPM package
https://github.com/adrienpoly/stimulus-library-boilerplate
boilerplate stimulus stimulus-js stimulusjs
Last synced: about 1 month ago
JSON representation
A simple boilerplate to publish standard Stimulus Controller as an NPM package
- Host: GitHub
- URL: https://github.com/adrienpoly/stimulus-library-boilerplate
- Owner: adrienpoly
- License: mit
- Archived: true
- Created: 2019-03-11T09:44:42.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-05-27T08:02:59.000Z (over 3 years ago)
- Last Synced: 2024-07-30T20:43:20.896Z (4 months ago)
- Topics: boilerplate, stimulus, stimulus-js, stimulusjs
- Language: JavaScript
- Homepage:
- Size: 1.82 MB
- Stars: 17
- Watchers: 2
- Forks: 0
- Open Issues: 17
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
Stimulus-Library-Boilerplate
A simple boilerplate to publish standard Stimulus Controller as an NPM package
- **Rollup**: Roll up configuration to build umd, es, cjs bundles.
- **Predefined scripts**: yarn build, yarn dev, yarn test... commonly used predefined scripts.
- **Testing environment**: Mocha, Chai, Karma & the gang to easily test your controller.## Getting started
To create a new package clone and rename this repo
```bash
git clone https://github.com/adrienpoly/stimulus-library-boilerplate.git my-controller-name
cd my-controller-name
rm -rf .git
yarn install
```- rename the package name in `package.json`
- code your controller in `src/index.js`
- add tests & fixtures in `spec`
- `yarn build` & publish it with `npm publish` (you need to create an account on npm first)## Scripts
- `yarn build` : bundle in production mode & builds the package in the `dist` directory
- `yarn dev` : watch for changes & bundle in development mode
- `yarn test` : launch the test suite in a headless browser
- `yarn test:watch` : watch for changes & launch the test suite in a headless browser
- `yarn test:browser` : watch for changes & launch the test suite in a chrome browser## Playground
When developing a controller you might want to set up a little playground environment to play & test your controller.
In `./playground` you can modify `index.html` & `index.js` to suit your need.
The playground can be started with :```bash
yarn start
```## Contributing
Bug reports and pull requests are welcome.
## License
This package is available as open source under the terms of the MIT License.