Skip to content

Commit

Permalink
Add handling for exclude patterns defined in project configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomByte committed Mar 7, 2019
1 parent b93d4bd commit 7c98831
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
13 changes: 11 additions & 2 deletions lib/tasks/generateJsdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<undefined>} Promise resolving with <code>undefined</code> once data has been written
*/
async function writeDependencyApisToDir({dependencies, targetPath}) {
const depApis = await dependencies.byGlob("/test-resources/**/designtime/api.json");

Expand Down
13 changes: 12 additions & 1 deletion lib/types/library/LibraryBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
});
});
Expand Down

0 comments on commit 7c98831

Please sign in to comment.