Skip to content

Commit 02c0a7b

Browse files
committed
JSdoc and test cleanup
1 parent f653a79 commit 02c0a7b

File tree

5 files changed

+34
-21
lines changed

5 files changed

+34
-21
lines changed

index.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,22 @@ module.exports = {
5555
* @type {import('./lib/translators/static')}
5656
*/
5757
static: "./lib/translators/static"
58-
}
58+
},
59+
/**
60+
* @public
61+
* @alias module:@ui5/project.graph
62+
* @namespace
63+
*/
64+
graph: {
65+
/**
66+
* @type {typeof import('./lib/graph/ProjectGraph')}
67+
*/
68+
ProjectGraph: "./lib/graph/ProjectGraph",
69+
/**
70+
* @type {typeof import('./lib/graph/projectGraphFromTree')}
71+
*/
72+
projectGraphFromTree: "./lib/graph/projectGraphFromTree"
73+
},
5974
};
6075

6176
function exportModules(exportRoot, modulePaths) {

lib/graph/Module.js

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,23 @@ const defaultConfigPath = "ui5.yaml";
1616
function clone(obj) {
1717
return JSON.parse(JSON.stringify(obj));
1818
}
19-
19+
/**
20+
* Raw representation of a UI5 Project. A module can contain zero to one projects and n extensions.
21+
* This class is intended for private use by the
22+
* [@ui5/project.graph.projectGraphFromTree]{@link module:@ui5/project.graph.projectGraphFromTree} module
23+
*
24+
* @private
25+
* @memberof module:@ui5/project.graph
26+
*/
2027
class Module {
2128
/**
2229
* @param {object} parameters Module parameters
23-
* @param {string} parameters.id Unique ID for the project
24-
* @param {string} parameters.version Version of the project
30+
* @param {string} parameters.id Unique ID for the module
31+
* @param {string} parameters.version Version of the module
2532
* @param {string} parameters.modulePath File System path to access the projects resources
2633
* @param {string} [parameters.configPath=ui5.yaml]
2734
* Either a path relative to `modulePath` which will be resolved by @ui5/fs (default),
28-
* or an absolute File System path to the project configuration file.
35+
* or an absolute File System path to the configuration file.
2936
* @param {object|object[]} [parameters.configuration]
3037
* Configuration object or array of objects to use. If supplied, no ui5.yaml will be read
3138
* @param {@ui5/project.graph.ShimCollection} [parameters.shimCollection]
@@ -63,23 +70,14 @@ class Module {
6370
}
6471
}
6572

66-
/**
67-
* @private
68-
*/
6973
getId() {
7074
return this._id;
7175
}
7276

73-
/**
74-
* @private
75-
*/
7677
getVersion() {
7778
return this._version;
7879
}
7980

80-
/**
81-
* @private
82-
*/
8381
getPath() {
8482
return this._modulePath;
8583
}

lib/graph/ProjectGraph.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const log = require("@ui5/logger").getLogger("graph:ProjectGraph");
22
/**
3-
* A rooted, directed graph representing a UI5 project and all its dependencies
3+
* A rooted, directed graph representing a UI5 project, its dependencies and available extensions
44
*
55
* @public
66
* @memberof module:@ui5/project.graph

lib/graph/projectGraphFromTree.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ const ProjectGraph = require("./ProjectGraph");
44
const ShimCollection = require("./ShimCollection");
55
const log = require("@ui5/logger").getLogger("graph:projectGraphFromTree");
66

7-
87
function _handleExtensions(graph, shimCollection, extensions) {
98
extensions.forEach((extension) => {
109
const type = extension.getType();
@@ -38,7 +37,13 @@ function _handleExtensions(graph, shimCollection, extensions) {
3837
*/
3938

4039
/**
40+
* Helper module to create a [@ui5/project.graph.ProjectGraph]{@link module:@ui5/project.graph.ProjectGraph}
41+
* from a dependency tree as returned by translators.
42+
*
43+
* @public
44+
* @alias module:@ui5/project.graph.projectGraphFromTree
4145
* @param {TreeNode} tree Dependency tree as returned by a translator
46+
* @returns {module:@ui5/project.graph.ProjectGraph} A new project graph instance
4247
*/
4348
module.exports = async function(tree) {
4449
const shimCollection = new ShimCollection();

test/lib/graph/projectGraphFromTree.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,13 @@ const applicationBPath = path.join(__dirname, "..", "..", "fixtures", "applicati
1010
const applicationCPath = path.join(__dirname, "..", "..", "fixtures", "application.c");
1111
const libraryAPath = path.join(__dirname, "..", "..", "fixtures", "collection", "library.a");
1212
const libraryBPath = path.join(__dirname, "..", "..", "fixtures", "collection", "library.b");
13-
// const libraryCPath = path.join(__dirname, "..", "..", "fixtures", "collection", "library.c");
1413
const libraryDPath = path.join(__dirname, "..", "..", "fixtures", "library.d");
1514
const cycleDepsBasePath = path.join(__dirname, "..", "..", "fixtures", "cyclic-deps", "node_modules");
1615
const pathToInvalidModule = path.join(__dirname, "..", "..", "fixtures", "invalidModule");
1716

1817
const legacyLibraryAPath = path.join(__dirname, "..", "fixtures", "legacy.library.a");
1918
const legacyLibraryBPath = path.join(__dirname, "..", "fixtures", "legacy.library.b");
2019
const legacyCollectionAPath = path.join(__dirname, "..", "fixtures", "legacy.collection.a");
21-
const legacyCollectionLibraryX = path.join(__dirname, "..", "fixtures", "legacy.collection.a",
22-
"src", "legacy.library.x");
23-
const legacyCollectionLibraryY = path.join(__dirname, "..", "fixtures", "legacy.collection.a",
24-
"src", "legacy.library.y");
2520

2621
test.beforeEach((t) => {
2722
const sinon = t.context.sinon = sinonGlobal.createSandbox();

0 commit comments

Comments
 (0)