Automatically generate unit tests and docs
npm install @spduk/jsdoc-autogenInspired by: Elixir Doctests & ExDoc
The idea is to have docs that will be automatically generated for your JavaScript code, with code examples that also double as tests within the source code.
I have no idea how to do this but my idea is basically this while using jest & being able to work on non-exported functions
- Parse @example for the input/output
- Use Rewire to call functions without exporting them
- Place @example input/output into test using rewire exported function
- Generate docs with JSDoc example if test passes
- Maybe it works? 🥴
- Webpack 4
- Babel 7
- UMD exports, so your library works everywhere.
- Jest unit testing
- Daily dependabot dependency updates
```
git clone https://github.com/hodgef/js-library-boilerplate-basic.git myLibrary
npm install
> Before shipping, make sure to:
1. Edit LICENSE filepackage.json
2. Edit information (These will be used to generate the headers for your built files)library: "MyLibrary"
3. Edit with your library's export name in ./webpack.config.js
1. npm publish
2. Your users can include your library as usual
``
import MyLibrary from 'my-library';
let libraryInstance = new MyLibrary();
...
`
let MyLibrary = window.MyLibrary.default;
let libraryInstance = new MyLibrary();
...
``