herbsjs / herbsshelf

Dynamically generated documentation for your domain
Other
8 stars 16 forks source link

Generate documents offline #12

Open alavortx opened 2 years ago

alavortx commented 2 years ago

We recently used herbs to develop an offline application as a service. No layer rest or graphql; In this case, we identified that it would be interesting to generate a folder at the root of the project with the html files.

code used generate.js

`const renderShelfHTML = require('@herbsjs/herbsshelf') const fs = require('fs') const yargs = require('yargs/yargs') const { hideBin } = require('yargs/helpers')

const argv = yargs(hideBin(process.argv)).argv const usecases = require('../../domain/usecases')

const output = argv.output ? argv.output : 'shelf'

if (!fs.existsSync(output)) { fs.mkdirSync(output) }

var stream = fs.createWriteStream(./${output}/index.html) stream.once('open', function () { const shelf = renderShelfHTML(usecases())

stream.write(shelf) stream.end() })`

package.json node generate.json --output=shelf

would it be interesting to put in the library the option to generate the html file?

jhomarolo commented 2 years ago

Hi @alavortx , i think that is a good idea, but I'm not sure if this implementation model is the best one.

Could you please run a benchmark inside other libs (ex: ncy with mocha like here https://github.com/herbsjs/herbsshelf/blob/aa38a86295057eb17c0b257e7e1826a7efde297a/package.json#L8)

But anyway, thank for your contrib

alavortx commented 2 years ago

Perfect. It was a palliative solution to the current situation. But I will delve into the subject.

italojs commented 2 years ago

Is this issue still alive? @adrianoluisalmeida