From a31c26007b72a5552c7a086c89aa0181e956bd30 Mon Sep 17 00:00:00 2001 From: Stuart Clark Date: Mon, 11 Jul 2022 15:04:45 +1000 Subject: [PATCH 1/5] fix(#154): add docgen alias --- packages/docgen/src/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/docgen/src/index.js b/packages/docgen/src/index.js index c3accb762..9588c2ba2 100644 --- a/packages/docgen/src/index.js +++ b/packages/docgen/src/index.js @@ -206,7 +206,11 @@ _Note: The contents of this file where automatically generated by the [Druxt Doc */ async processVue(file, templateData) { // Get data from vue-docgen-api. - const data = await vueDocs.parse(file) + const data = await vueDocs.parse(file, { + alias: { + druxt: path.resolve('packages/druxt') + } + }) templateData.map(item => { const parts = item.id.split('.') From 0d79922fe40b0cbe96bcd829e899b9a1cfd26295 Mon Sep 17 00:00:00 2001 From: Stuart Clark Date: Mon, 11 Jul 2022 16:05:08 +1000 Subject: [PATCH 2/5] feat(#154): add extend props --- packages/docgen/src/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/docgen/src/index.js b/packages/docgen/src/index.js index 9588c2ba2..67b7de2a1 100644 --- a/packages/docgen/src/index.js +++ b/packages/docgen/src/index.js @@ -212,6 +212,21 @@ _Note: The contents of this file where automatically generated by the [Druxt Doc } }) + // Inject extends from vue-docgen-api into jsdoc data. + const prefixId = (templateData[0] || {}).id || '' + // Props. + for (const prop of (data.props || []).filter((prop) => !templateData.map((o) => o.id).includes(`${prefixId}.props.${prop.name}`))) { + templateData.push({ + id: `${prefixId}.props.${prop.name}`, + longname: `${prefixId}.props.${prop.name}`, + name: prop.name, + kind: 'member', + scope: 'static', + description: prop.description, + memberof: `${prefixId}.props` + }) + } + templateData.map(item => { const parts = item.id.split('.') if (item.memberof === null && parts.length > 1) { From f8eedb9c9f0b36169bb8e9b263459e8697e9a293 Mon Sep 17 00:00:00 2001 From: Stuart Clark Date: Tue, 12 Jul 2022 12:30:11 +1000 Subject: [PATCH 3/5] chore: add workaround for node 17+ --- docs/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/package.json b/docs/package.json index 2619dee3d..651fb8a0c 100644 --- a/docs/package.json +++ b/docs/package.json @@ -4,7 +4,7 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "nuxt", + "dev": "NODE_OPTIONS='--openssl-legacy-provider' nuxt", "build": "nuxt build", "start": "nuxt start", "generate": "nuxt generate", From ecf83b5bace00052f1b90331b98edeab75dca842 Mon Sep 17 00:00:00 2001 From: Stuart Clark Date: Tue, 12 Jul 2022 12:30:29 +1000 Subject: [PATCH 4/5] chore(#154): update documentation --- .../breadcrumb/src/components/DruxtBreadcrumb.vue | 4 ++-- packages/docgen/src/index.js | 12 ++++++++---- packages/druxt/src/components/DruxtModule.vue | 13 ++++++++++++- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/packages/breadcrumb/src/components/DruxtBreadcrumb.vue b/packages/breadcrumb/src/components/DruxtBreadcrumb.vue index ab80a44d3..6811e087d 100644 --- a/packages/breadcrumb/src/components/DruxtBreadcrumb.vue +++ b/packages/breadcrumb/src/components/DruxtBreadcrumb.vue @@ -44,7 +44,7 @@ export default { * @type {boolean} * @default true * @example @lang vue - * + * */ home: { type: Boolean, @@ -59,7 +59,7 @@ export default { * @type {string} * * @example @lang vue - * + * */ path: { type: String, diff --git a/packages/docgen/src/index.js b/packages/docgen/src/index.js index 67b7de2a1..de43babef 100644 --- a/packages/docgen/src/index.js +++ b/packages/docgen/src/index.js @@ -81,7 +81,7 @@ class DruxtDocgen { // Javascript. 'packages/*/src/**/*.js', // Vue.js. - 'packages/*/src/components/**/*.vue', + 'packages/*/src/**/*.vue', // Exclude fixtures, mocks and tests. '!**/__*__/**/*', ]) @@ -216,15 +216,19 @@ _Note: The contents of this file where automatically generated by the [Druxt Doc const prefixId = (templateData[0] || {}).id || '' // Props. for (const prop of (data.props || []).filter((prop) => !templateData.map((o) => o.id).includes(`${prefixId}.props.${prop.name}`))) { - templateData.push({ + const item = { id: `${prefixId}.props.${prop.name}`, longname: `${prefixId}.props.${prop.name}`, name: prop.name, kind: 'member', scope: 'static', description: prop.description, - memberof: `${prefixId}.props` - }) + memberof: `${prefixId}.props`, + } + if ((prop.tags || {}).example) { + item.examples = [prop.tags.example[0].description.replace('DruxtModule', prefixId.split(':')[1])] + } + templateData.push(item) } templateData.map(item => { diff --git a/packages/druxt/src/components/DruxtModule.vue b/packages/druxt/src/components/DruxtModule.vue index c80a4577b..9f389327b 100644 --- a/packages/druxt/src/components/DruxtModule.vue +++ b/packages/druxt/src/components/DruxtModule.vue @@ -39,6 +39,11 @@ export default { props: { /** * The resource langcode. + * + * @example + * + * + * @type {String} */ langcode: { type: String, @@ -46,7 +51,13 @@ export default { }, /** - * The module value. + * The module component model value. + * + * Used to bypass the Drupal JSON:API fetch, setting the module data + * directly. + * + * @example + * * * @type {(Array|Boolean|Date|Number|Object|String)} * @model From c0a19197977a3d8e4a99e992afb95b8d0363d46b Mon Sep 17 00:00:00 2001 From: Stuart Clark Date: Tue, 12 Jul 2022 13:57:35 +1000 Subject: [PATCH 5/5] chore(#154): fix docgen --- packages/docgen/src/index.js | 2 +- packages/druxt/src/components/DruxtModule.vue | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/docgen/src/index.js b/packages/docgen/src/index.js index de43babef..fdc8e15bf 100644 --- a/packages/docgen/src/index.js +++ b/packages/docgen/src/index.js @@ -81,7 +81,7 @@ class DruxtDocgen { // Javascript. 'packages/*/src/**/*.js', // Vue.js. - 'packages/*/src/**/*.vue', + 'packages/*/src/components/**/*.vue', // Exclude fixtures, mocks and tests. '!**/__*__/**/*', ]) diff --git a/packages/druxt/src/components/DruxtModule.vue b/packages/druxt/src/components/DruxtModule.vue index 9f389327b..1a20a1d8e 100644 --- a/packages/druxt/src/components/DruxtModule.vue +++ b/packages/druxt/src/components/DruxtModule.vue @@ -43,7 +43,7 @@ export default { * @example * * - * @type {String} + * @type {string} */ langcode: { type: String, @@ -59,7 +59,7 @@ export default { * @example * * - * @type {(Array|Boolean|Date|Number|Object|String)} + * @type {*} * @model */ value: { @@ -81,7 +81,7 @@ export default { * }" * /> * - * @type {(Boolean|Object)} + * @type {(boolean|object)} */ wrapper: { type: [Boolean, Object],