autogenerate doc on build tutorial

This commit is contained in:
Felix Roos 2022-05-20 22:15:05 +02:00
parent f2a70396d1
commit 6b26f999e4
4 changed files with 13 additions and 12 deletions

View File

@ -1,11 +1,11 @@
{
"docs": [
{
"comment": "/**\n * Intended for a debugging, drawLine renders the pattern as a string, where each character represents the same time span.\n * Should only be used with single characters as values, otherwise the character slots will be messed up.\n * Character legend: \n * \n * - \"|\" cycle separator\n * - \"-\" hold previous value\n * - \".\" silence\n *\n * @param {Pattern} pat pattern to use\n * @param {number} chars max number of characters (approximately)\n * @returns string\n * @example\n * const line = drawLine(\"0 [1 2 3]\", 10); // |0--123|0--123\n * console.log(line);\n */",
"comment": "/**\n * Intended for a debugging, drawLine renders the pattern as a string, where each character represents the same time span.\n * Should only be used with single characters as values, otherwise the character slots will be messed up.\n * Character legend:\n *\n * - \"|\" cycle separator\n * - \"-\" hold previous value\n * - \".\" silence\n *\n * @param {Pattern} pattern the pattern to use\n * @param {number} chars max number of characters (approximately)\n * @returns string\n * @example\n * const line = drawLine(\"0 [1 2 3]\", 10); // |0--123|0--123\n * console.log(line);\n */",
"meta": {
"range": [
1408,
2778
1414,
2784
],
"filename": "drawLine.mjs",
"lineno": 25,
@ -44,8 +44,8 @@
"Pattern"
]
},
"description": "<p>pattern to use</p>",
"name": "pat"
"description": "<p>the pattern to use</p>",
"name": "pattern"
},
{
"type": {
@ -54,8 +54,7 @@
]
},
"description": "<p>max number of characters (approximately)</p>",
"name": "chars",
"defaultvalue": 60
"name": "chars"
}
],
"returns": [

View File

@ -15,7 +15,7 @@ import Fraction, { gcd } from './fraction.mjs';
* - "-" hold previous value
* - "." silence
*
* @param {Pattern} pat pattern to use
* @param {Pattern} pattern the pattern to use
* @param {number} chars max number of characters (approximately)
* @returns string
* @example

View File

@ -3,7 +3,7 @@ import { docs } from '../doc.json';
import { MiniRepl } from './MiniRepl';
function ApiDoc() {
console.log('docJson', docs);
// console.log('docJson', docs);
return (
<div>
{docs
@ -23,6 +23,7 @@ function ApiDoc() {
}),
}}
/>
<h3>Parameters</h3>
<ul>
{item.params?.map((param, i) => (
<li key={i}>

View File

@ -3,10 +3,11 @@
"private": true,
"version": "0.0.0",
"scripts": {
"dev": "vite",
"dev": "npm run jsdoc-json && vite",
"start": "vite",
"build": "vite build",
"preview": "vite preview"
"build": "npm run jsdoc-json && vite build",
"preview": "vite preview",
"jsdoc-json": "jsdoc ../packages/ --template ../node_modules/jsdoc-json --destination ../doc.json -c ../jsdoc.config.json"
},
"type": "module",
"dependencies": {