carbon-io / carbond

MIT License
2 stars 5 forks source link

Support configurable flavor-specific defaults for gen-static-docs options #198

Closed rmiyashiro closed 7 years ago

rmiyashiro commented 7 years ago

This change adds the ability to configure flavor-specific defaults for the options that can be passed to gen-static-docs. For example, if you want Aglio-flavored documentation for your service to be full width by default, you'd add this to your service:

defaultFlavorOptions: {
  aglio: {
    themeFullWidth: true
  }
}

This is most useful if you've created custom themes and styles that are optimized for your service's documentation. For example:

defaultFlavorOptions: {
  aglio: {
    themeStyle: "./doc/custom-style.less",
    themeVariables: "./doc/custom-variables.less"
  }
}

With this in place, users can simply run gen-static-docs with no options and your custom styles will be used. For example:

$ node ./lib/MyService.js gen-static-docs --flavor aglio

Instead of:

$ node ./lib/MyService.js gen-static-docs --flavor aglio --option "themeStyle:./doc/custom-style.less,themeVariables:./doc/custom-variables.less"
gregbanks commented 7 years ago

🍥

willshulman commented 7 years ago

Is the suggestion that defaultFlavorOptions be a field on Service? I am down with that but would prefer a different name like defaultDocgenOptions

rmiyashiro commented 7 years ago

Yes, a field on Service. Definitely looking for a better name for the field. defaultDocgenOptions is fine with me.

willshulman commented 7 years ago

Ok let's go with that. Feel free to update field name and accept the PR

willshulman commented 7 years ago

But then add a ticket to carbond Issues for this to be documented.