liferay / electric

⚡ Create beautiful documentation for your projects
https://electricjs.com
Other
118 stars 26 forks source link

Add API to customize documentation library API #130

Closed matuzalemsteles closed 6 years ago

matuzalemsteles commented 6 years ago

The idea is that we can create an API to customize the library documentation API, which will enable to disable certain features and a better power of how we want to generate our documentation, this will help to create the Clay documentation.

documentation('json', {
    access: ['public', 'private', 'protected', 'undefined'],
    private: true
})

tasks/api.js

At the moment not the option to customize, we can add an API next to apiConfig.project, something like docsOptions.

const optionsDocs = Object.assign({
    access: ['public', 'private', 'protected', 'undefined'],
    private: true
}, apiConfig.project.docsOptions);

documentation('json', optionsDocs)

cc/ @jbalsas

jbalsas commented 6 years ago

I really like this idea, @matuzalemsteles!

Can you explain from our specific use case what are we looking to configure and why?

matuzalemsteles commented 6 years ago

Hey @jbalsas,

According to Electric Lifecycle it downloads the package from Github and decompresses it and does not do any build process since it is not necessary, all the components of Clay import their soy.js templates that are generated in the process build, with documentation it will examine all imports to generate the documentation and it turns out that we do not have the soy.js files. But we can disable this by passing the shallow flag.

docsConfig: {
    shallow: true
}

This is very bad because it does not generate documentation and ends up accusing other types of errors that are difficult to track (maybe we can handle this in the future).