documentation-config-prepare

1.0.0 • Public • Published

documentation-config-prepare

This is a small tool for prepare the documentation.js config from its part that present in file tree. Wrote for @saritasa/generator-react and react-app-core so there is no customisation for current moment, but tool is pretty small, so you may do PR or write your own.

How to use

For single-time usage, you may run

npx documentation-config-prepare

For regular usage it's recommended to use

  1. npm install --save-dev documentation-config-prepare
  2. Create predoc script inside package.json like "predoc": "documentation-config-prepare"
  3. If you run npm run doc for building the documentation, predoc runs before it

What does it do

This tool use yaml files that named like documentation.yml or MyModule.documentation.yml, where MyModule is custom part.

The algorithm is next:

  1. Take all files by glob from src folder and remember theirs paths.
  2. Parse paths to understand if documentation file were created for feature or not (looking for /features/ in path).
  3. Sort all files like:
file1
file2 <-- all files except features are sorted in alphabetical order 
file3
feature1 <-- after regular files, features goes (alphabetical order too)
feature2
feature2-file1 <-- every feature's regular file is placed rigth after main feature description 
feature2-file2 <-- (alphabetical order too)
feature2.1 (nested for feature2) <-- every nested feature goes after regular feature's files
feature2.2 (nested for feature2)
feature3
feature4
  1. Take file's content from toc key and concat it with another.
  2. Write documentation.yml into process.cwd().

Package Sidebar

Install

npm i documentation-config-prepare

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

5.05 kB

Total Files

4

Last publish

Collaborators

  • numminorihsf