1.0.14 • Published 5 years ago

@spduk/jsdoc-autogen v1.0.14

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

jsdoc-autogen

Inspired by: Elixir Doctests & ExDoc

Idea

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.

Solution

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? 🥴

⭐️ Features

  • Webpack 4
  • Babel 7
  • UMD exports, so your library works everywhere.
  • Jest unit testing
  • Daily dependabot dependency updates

📦 Getting Started

git clone https://github.com/hodgef/js-library-boilerplate-basic.git myLibrary
npm install

💎 Customization

Before shipping, make sure to:

  1. Edit LICENSE file
  2. Edit package.json information (These will be used to generate the headers for your built files)
  3. Edit library: "MyLibrary" with your library's export name in ./webpack.config.js

🚀 Deployment

  1. npm publish
  2. Your users can include your library as usual

npm

import MyLibrary from 'my-library';
let libraryInstance = new MyLibrary();
...

self-host/cdn

<script src="build/index.js"></script>

let MyLibrary = window.MyLibrary.default;
let libraryInstance = new MyLibrary();
...