diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 59e675d..18695b3 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -64,7 +64,7 @@ module.exports = { description: meta.description, head, plugins: [ - require('./generateApiDocs'), + require('./generateApiDocs/index'), ['@vuepress/google-analytics',{ga: isDeployPreview ? '' : 'UA-12818324-8',}], ['@vuepress/pwa', { serviceWorker: false, @@ -130,15 +130,6 @@ module.exports = { ['guide/keydown', 'Keydown Events'], ], }, - { - title: 'API', - collapsable: false, - children: [ - ['api/props', 'Props'], - ['api/slots', 'Slots'], - ['api/events', 'Events'], - ], - }, ], }, }, diff --git a/docs/.vuepress/generateApiDocs/generator.js b/docs/.vuepress/generateApiDocs/generator.js new file mode 100644 index 0000000..9b7c497 --- /dev/null +++ b/docs/.vuepress/generateApiDocs/generator.js @@ -0,0 +1,12 @@ +const docs = require('vue-docgen-api'); +const path = require('path'); + +/** + * Generate an object of API documentation. + * @param documentationRootDir + * @return {Promise} + */ +module.exports = async (documentationRootDir) => { + const file = path.resolve(documentationRootDir, '../src/components/Select.vue'); + return await docs.parse(file); +}; diff --git a/docs/.vuepress/generateApiDocs.js b/docs/.vuepress/generateApiDocs/index.js similarity index 81% rename from docs/.vuepress/generateApiDocs.js rename to docs/.vuepress/generateApiDocs/index.js index 988b41f..b4cd9a6 100644 --- a/docs/.vuepress/generateApiDocs.js +++ b/docs/.vuepress/generateApiDocs/index.js @@ -1,6 +1,6 @@ -const docs = require('vue-docgen-api'); const path = require('path'); const fs = require('fs'); +const generator = require('./generator'); /** * Get all of the component mixin paths. @@ -30,11 +30,12 @@ module.exports = (options, {sourceDir}) => ({ * @return {Promise<{name: string, content: string}>} */ async clientDynamicModules () { - const file = path.resolve(sourceDir, '../src/components/Select.vue'); + const docs = await generator(sourceDir); + console.log('Generated API documentation for Select.vue'); return { name: 'api.js', - content: `export default ${JSON.stringify(await docs.parse(file))}`, + content: `export default ${JSON.stringify(docs)}`, }; }, }); diff --git a/docs/.vuepress/theme/components/SideBarApi.vue b/docs/.vuepress/theme/components/SideBarApi.vue new file mode 100644 index 0000000..a1479c8 --- /dev/null +++ b/docs/.vuepress/theme/components/SideBarApi.vue @@ -0,0 +1,67 @@ + + + + + diff --git a/docs/.vuepress/theme/layouts/Layout.vue b/docs/.vuepress/theme/layouts/Layout.vue index cf3d264..32f524a 100644 --- a/docs/.vuepress/theme/layouts/Layout.vue +++ b/docs/.vuepress/theme/layouts/Layout.vue @@ -1,17 +1,20 @@ @@ -23,5 +26,7 @@ export default { } #codefund + .sidebar-links { padding-top: 1rem; + border-bottom: none; + padding-bottom: 0.75rem; }