@@ -74,6 +74,20 @@ class Workspace {
7474 return this . #configuration. metadata . name ;
7575 }
7676
77+ /**
78+ * Returns an array of [Module]{@ui 5/project/graph/Module} instances found in the configured
79+ * dependency-management resolution paths of this workspace, sorted by module ID.
80+ *
81+ * @public
82+ * @returns {Promise<@ui5/project/graph/Module[]> }
83+ * Array of Module instances sorted by module ID
84+ */
85+ async getModules ( ) {
86+ const { moduleIdMap} = await this . _getResolvedModules ( ) ;
87+ const sortedMap = new Map ( [ ...moduleIdMap ] . sort ( ( a , b ) => String ( a [ 0 ] ) . localeCompare ( b [ 0 ] ) ) ) ;
88+ return Array . from ( sortedMap . values ( ) ) ;
89+ }
90+
7791 /**
7892 * For a given project name (e.g. the value of the <code>metadata.name</code> property in a ui5.yaml),
7993 * returns a [Module]{@ui 5/project/graph/Module} instance or <code>undefined</code> depending on whether the project
@@ -82,7 +96,7 @@ class Workspace {
8296 * @public
8397 * @param {string } projectName Name of the project
8498 * @returns {Promise<@ui5/project/graph/Module|undefined> }
85- * Module instance of <code>undefined</code> if none is found
99+ * Module instance or <code>undefined</code> if none is found
86100 */
87101 async getModuleByProjectName ( projectName ) {
88102 const { projectNameMap} = await this . _getResolvedModules ( ) ;
@@ -98,7 +112,7 @@ class Workspace {
98112 * @public
99113 * @param {string } nodeId Node ID of the module
100114 * @returns {Promise<@ui5/project/graph/Module|undefined> }
101- * Module instance of <code>undefined</code> if none is found
115+ * Module instance or <code>undefined</code> if none is found
102116 */
103117 async getModuleByNodeId ( nodeId ) {
104118 const { moduleIdMap} = await this . _getResolvedModules ( ) ;
0 commit comments