Skip to content

Latest commit

 

History

History
51 lines (39 loc) · 1.55 KB

README.md

File metadata and controls

51 lines (39 loc) · 1.55 KB

woocommerce-grow-tracking-jsdoc

JSDoc template to report Tracking events to markdown file.

Usage

  1. npm i jsdoc and configure jsdoc according to your source code, so the npx jsdoc ./your/source/ runs successfully.

  2. Install or link this package via npm

  3. Add your /TRACKING.md template

    # Usage Tracking
    
    Some nice general description.
    
    <woocommerce-grow-tracking-jsdoc></woocommerce-grow-tracking-jsdoc>
  4. Generate the docs

    jsdoc -r your/source/files/ -t ./node_modules/woocommerce-grow-tracking-jsdoc

Config

You may add any of the following properties to your JSDoc config (.jsdocrc.json) to change those default values:

{
  "templates": {
    "woocommerce-grow-tracking-jsdoc": {
      // Path to the markdown file to which the tracking events' docs should be added
      "path": "TRACKING.md",
      // Pattern to be used to match the content to be replaced. The groups are respectively: start marker, replaceable content, end marker.
      "replacement": "(<woocommerce-grow-tracking-jsdoc(?:\\s[^>]*)?>)([\\s\\S]*)(<\\/woocommerce-grow-tracking-jsdoc.*>)"
    }
  }

Then make sure jsdoc uses it, by jsdoc -r your/source/files/ -c .jsdocrc.json.

Emitters

If you would like to add some descriptions to @fires or @emits tags, for example to specify what data is attached to the event, add fires-description to your plugins list:

{
  "plugins": [
    // To be able to add descriptions to `@fires` & `@emits`
    "woocommerce-grow-tracking-jsdoc/fires-description"
  ],
  // …