diff --git a/lib/tasks/generateJsdoc.js b/lib/tasks/generateJsdoc.js index 7b7d0cf50..693de9ed6 100644 --- a/lib/tasks/generateJsdoc.js +++ b/lib/tasks/generateJsdoc.js @@ -13,9 +13,9 @@ const {resourceFactory} = require("@ui5/fs"); * @alias module:@ui5/builder.tasks.generateJsdoc * @param {Object} parameters Parameters * @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files - * @param {module:@ui5/fs.ReaderCollection} parameters.dependencies DuplexCollection to read and write files + * @param {module:@ui5/fs.AbstractReader} parameters.dependencies Reader or Collection to read dependency files * @param {Object} parameters.options Options - * @param {string} parameters.options.pattern Pattern to locate the files to be processed + * @param {string|Array} parameters.options.pattern Pattern to locate the files to be processed * @param {string} parameters.options.projectName Project name * @param {string} parameters.options.version Project version * @param {boolean} [parameters.options.sdkBuild=true] Whether additional SDK specific api.json @@ -138,6 +138,15 @@ async function writeResourcesToDir({workspace, pattern, targetPath}) { await Promise.all(allResources.map((resource) => fsTarget.write(resource))); } +/** + * Write api.json files of dependencies to given target path in a flat structure + * + * @private + * @param {Object} parameters Parameters + * @param {module:@ui5/fs.AbstractReader} parameters.dependencies Reader or Collection to read dependency files + * @param {string} parameters.targetPath Path to write the resources to + * @returns {Promise} Promise resolving with undefined once data has been written + */ async function writeDependencyApisToDir({dependencies, targetPath}) { const depApis = await dependencies.byGlob("/test-resources/**/designtime/api.json"); diff --git a/lib/types/library/LibraryBuilder.js b/lib/types/library/LibraryBuilder.js index ea7d5d0bb..396a60655 100644 --- a/lib/types/library/LibraryBuilder.js +++ b/lib/types/library/LibraryBuilder.js @@ -42,13 +42,24 @@ class LibraryBuilder extends AbstractBuilder { this.addTask("generateJsdoc", () => { const generateJsdoc = tasks.generateJsdoc; + + const patterns = ["/resources/**/*.js"]; + // Add excludes + if (project.builder && project.builder.jsdoc && project.builder.jsdoc.excludes) { + const excludes = project.builder.jsdoc.excludes.map((pattern) => { + return `!/resources/${pattern}`; + }); + + patterns.push(...excludes); + } + return generateJsdoc({ workspace: resourceCollections.workspace, dependencies: resourceCollections.dependencies, options: { projectName: project.metadata.name, version: project.version, - pattern: "/resources/**/*.js" + pattern: patterns } }); });