lib/tasks/jsdoc/generateJsdoc.js
async function({workspace, dependencies, options} = {}) {
	if (!options || !options.projectName || !options.namespace || !options.version || !options.pattern) {
		throw new Error("[generateJsdoc]: One or more mandatory options not provided");
	}

	const {sourcePath: resourcePath, targetPath, tmpPath} = await generateJsdoc._createTmpDirs(options.projectName);

	const [writtenResourcesCount] = await Promise.all([
		generateJsdoc._writeResourcesToDir({
			workspace,
			pattern: options.pattern,
			targetPath: resourcePath
		}),
		generateJsdoc._writeDependencyApisToDir({
			dependencies,
			targetPath: path.posix.join(tmpPath, "dependency-apis")
		})
	]);

	if (writtenResourcesCount === 0) {
		log.info(`Failed to find any input resources for project ${options.projectName} using pattern ` +
			`${options.pattern}. Skipping JSDoc generation...`);
		return;
	}

	const createdResources = await jsdocGenerator({
		sourcePath: resourcePath,
		targetPath,
		tmpPath,
		options: {
			projectName: options.projectName,
			namespace: options.namespace,
			version: options.version,
			variants: ["apijson"]
		}
	});

	await Promise.all(createdResources.map((resource) => {
		return workspace.write(resource);
	}));
}
async function({workspace, dependencies, options} = {}) {
	if (!options || !options.projectName || !options.namespace || !options.version || !options.pattern) {
		throw new Error("[generateJsdoc]: One or more mandatory options not provided");
	}

	const {sourcePath: resourcePath, targetPath, tmpPath} = await generateJsdoc._createTmpDirs(options.projectName);

	const [writtenResourcesCount] = await Promise.all([
		generateJsdoc._writeResourcesToDir({
			workspace,
			pattern: options.pattern,
			targetPath: resourcePath
		}),
		generateJsdoc._writeDependencyApisToDir({
			dependencies,
			targetPath: path.posix.join(tmpPath, "dependency-apis")
		})
	]);

	if (writtenResourcesCount === 0) {
		log.info(`Failed to find any input resources for project ${options.projectName} using pattern ` +
			`${options.pattern}. Skipping JSDoc generation...`);
		return;
	}

	const createdResources = await jsdocGenerator({
		sourcePath: resourcePath,
		targetPath,
		tmpPath,
		options: {
			projectName: options.projectName,
			namespace: options.namespace,
			version: options.version,
			variants: ["apijson"]
		}
	});

	await Promise.all(createdResources.map((resource) => {
		return workspace.write(resource);
	}));
}
async function ( { workspace , dependencies , options } = { } ) { if ( ! options || ! options . projectName || ! options . namespace || ! options . version || ! options . pattern ) { throw new Error ( "[generateJsdoc]: One or more mandatory options not provided" ) ; } const { sourcePath : resourcePath , targetPath , tmpPath } = await generateJsdoc . _createTmpDirs ( options . projectName ) ; const [ writtenResourcesCount ] = await Promise . all ( [ generateJsdoc . _writeResourcesToDir ( { workspace , pattern : options . pattern , targetPath : resourcePath } ) , generateJsdoc . _writeDependencyApisToDir ( { dependencies , targetPath : path . posix . join ( tmpPath , "dependency-apis" ) } ) ] ) ; if ( writtenResourcesCount === 0 ) { log . info ( ` ${ options . projectName } ` + ` ${ options . pattern } ` ) ; return ; } const createdResources = await jsdocGenerator ( { sourcePath : resourcePath , targetPath , tmpPath , options : { projectName : options . projectName , namespace : options . namespace , version : options . version , variants : [ "apijson" ] } } ) ; await Promise . all ( createdResources . map ( ( resource ) => { return workspace . write ( resource ) ; } ) ) ; }
Task to execute a JSDoc build for UI5 projects

@public
@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.AbstractReader} parameters.dependencies Reader or Collection to read dependency files
@param {Object} parameters.options Options
@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.namespace Namespace to build (e.g. <code>some/project/name</code>)
@param {string} parameters.options.version Project version
@returns {Promise<undefined>} Promise resolving with <code>undefined</code> once data has been written
Task to execute a JSDoc build for UI5 projects