Skip to content

Commit

Permalink
[INTERNAL] JSDoc: Fix reference to jsdoc template
Browse files Browse the repository at this point in the history
jsdoc is not able to resolve the @ui5/builder dependency when there is
no @ui5/builder within node_modules available. This only became an issue
once @ui5/project switched to an optional peerDependency for
@ui5/builder so when testing the @ui5/builder itself, there was no
transitive @ui5/builder dependency available.

This also solves the issue of not testing the current version of the
template as before it came from the installed @ui5/builder version.

This also updates the package-lock.json by re-generating it.
  • Loading branch information
matz3 committed Jul 23, 2024
1 parent 8039956 commit ee2c138
Show file tree
Hide file tree
Showing 16 changed files with 318 additions and 636 deletions.
7 changes: 6 additions & 1 deletion jsdoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
},
"source": {
"include": ["README.md"],
"exclude": ["lib/lbt/utils/JSTokenizer.js"],
"exclude": [
"lib/lbt/utils/JSTokenizer.js",
"lib/processors/jsdoc/lib/ui5/plugin.js",
"lib/processors/jsdoc/lib/ui5/template/publish.js",
"lib/processors/jsdoc/lib/ui5/template/utils/versionUtil.js"
],
"includePattern": ".+\\.js$",
"excludePattern": "(node_modules(\\\\|/))"
},
Expand Down
2 changes: 1 addition & 1 deletion lib/processors/jsdoc/apiIndexGenerator.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {createResource} from "@ui5/fs/resourceFactory";
import createIndex from "./lib/createIndexFiles.cjs";
import createIndex from "./lib/createIndexFiles.js";

/**
* @public
Expand Down
7 changes: 2 additions & 5 deletions lib/processors/jsdoc/jsdocGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,8 @@ async function generateJsdocConfig({targetPath, tmpPath, namespace, projectName,

// Resolve path to this script to get the path to the JSDoc extensions folder
const jsdocPath = path.normalize(import.meta.dirname);
const pluginPath = path.join(jsdocPath, "lib", "ui5", "plugin.cjs").replace(backslashRegex, "\\\\");
// Using export via package.json to allow loading the CJS template.
// jsdoc appends /publish to the provided path but doesn't allow to
// add the .cjs extension, so loading won't work otherwise.
const templatePath = "@ui5/builder/internal/jsdoc/template";
const pluginPath = path.join(jsdocPath, "lib", "ui5", "plugin.js").replace(backslashRegex, "\\\\");
const templatePath = path.join(jsdocPath, "lib", "ui5", "template").replace(backslashRegex, "\\\\");
const destinationPath = path.normalize(tmpPath).replace(backslashRegex, "\\\\");
const jsapiFilePath = path.join(targetPath, "libraries", projectName + ".js").replace(backslashRegex, "\\\\");
const apiJsonFolderPath = path.join(tmpPath, "dependency-apis").replace(backslashRegex, "\\\\");
Expand Down
3 changes: 3 additions & 0 deletions lib/processors/jsdoc/lib/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "commonjs"
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const info = logger.info.bind(logger);
const warning = logger.warn.bind(logger);
const error = logger.error.bind(logger);

const {extractVersion, extractSince} = require("./utils/versionUtil.cjs");
const {extractVersion, extractSince} = require("./utils/versionUtil");

/* errors that might fail the build in future */
function future(msg) {
Expand Down
2 changes: 1 addition & 1 deletion lib/processors/jsdoc/sdkTransformer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {createResource} from "@ui5/fs/resourceFactory";
import transformer from "./lib/transformApiJson.cjs";
import transformer from "./lib/transformApiJson.js";

/**
* @public
Expand Down
Loading

0 comments on commit ee2c138

Please sign in to comment.