Skip to content

Commit 81ded62

Browse files
matz3flovogt
authored andcommitted
[INTERNAL] JSDoc: Fix reference to jsdoc template
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.
1 parent 8039956 commit 81ded62

16 files changed

+318
-636
lines changed

jsdoc.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
},
55
"source": {
66
"include": ["README.md"],
7-
"exclude": ["lib/lbt/utils/JSTokenizer.js"],
7+
"exclude": [
8+
"lib/lbt/utils/JSTokenizer.js",
9+
"lib/processors/jsdoc/lib/ui5/plugin.js",
10+
"lib/processors/jsdoc/lib/ui5/template/publish.js",
11+
"lib/processors/jsdoc/lib/ui5/template/utils/versionUtil.js"
12+
],
813
"includePattern": ".+\\.js$",
914
"excludePattern": "(node_modules(\\\\|/))"
1015
},

lib/processors/jsdoc/apiIndexGenerator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {createResource} from "@ui5/fs/resourceFactory";
2-
import createIndex from "./lib/createIndexFiles.cjs";
2+
import createIndex from "./lib/createIndexFiles.js";
33

44
/**
55
* @public

lib/processors/jsdoc/jsdocGenerator.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,8 @@ async function generateJsdocConfig({targetPath, tmpPath, namespace, projectName,
9090

9191
// Resolve path to this script to get the path to the JSDoc extensions folder
9292
const jsdocPath = path.normalize(import.meta.dirname);
93-
const pluginPath = path.join(jsdocPath, "lib", "ui5", "plugin.cjs").replace(backslashRegex, "\\\\");
94-
// Using export via package.json to allow loading the CJS template.
95-
// jsdoc appends /publish to the provided path but doesn't allow to
96-
// add the .cjs extension, so loading won't work otherwise.
97-
const templatePath = "@ui5/builder/internal/jsdoc/template";
93+
const pluginPath = path.join(jsdocPath, "lib", "ui5", "plugin.js").replace(backslashRegex, "\\\\");
94+
const templatePath = path.join(jsdocPath, "lib", "ui5", "template").replace(backslashRegex, "\\\\");
9895
const destinationPath = path.normalize(tmpPath).replace(backslashRegex, "\\\\");
9996
const jsapiFilePath = path.join(targetPath, "libraries", projectName + ".js").replace(backslashRegex, "\\\\");
10097
const apiJsonFolderPath = path.join(tmpPath, "dependency-apis").replace(backslashRegex, "\\\\");

lib/processors/jsdoc/lib/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"type": "commonjs"
3+
}

lib/processors/jsdoc/lib/ui5/template/publish.cjs renamed to lib/processors/jsdoc/lib/ui5/template/publish.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const info = logger.info.bind(logger);
2626
const warning = logger.warn.bind(logger);
2727
const error = logger.error.bind(logger);
2828

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

3131
/* errors that might fail the build in future */
3232
function future(msg) {

lib/processors/jsdoc/sdkTransformer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {createResource} from "@ui5/fs/resourceFactory";
2-
import transformer from "./lib/transformApiJson.cjs";
2+
import transformer from "./lib/transformApiJson.js";
33

44
/**
55
* @public

0 commit comments

Comments
 (0)