@ui5/cli 3.0.0-alpha.5 → 3.0.0-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,7 +2,33 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
4
4
 
5
- A list of unreleased changes can be found [here](https://github.com/SAP/ui5-cli/compare/v3.0.0-alpha.5...HEAD).
5
+ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-cli/compare/v3.0.0-alpha.8...HEAD).
6
+
7
+ <a name="v3.0.0-alpha.8"></a>
8
+ ## [v3.0.0-alpha.8] - 2022-06-14
9
+ ### Breaking Changes
10
+ - Adapt to Project Graph APIs ([#413](https://github.com/SAP/ui5-cli/issues/413)) [`945b82b`](https://github.com/SAP/ui5-cli/commit/945b82bc775dc0a711529057908e9f36d8fadb62)
11
+
12
+ ### Dependency Updates
13
+ - Bump [@ui5](https://github.com/ui5)/server from 3.0.0-alpha.1 to 3.0.0-alpha.2 [`5b959b3`](https://github.com/SAP/ui5-cli/commit/5b959b3903b93b0c7c693f2785d26532c8e78d53)
14
+ - Bump [@ui5](https://github.com/ui5)/project from 3.0.0-alpha.2 to 3.0.0-alpha.3 [`780b1c1`](https://github.com/SAP/ui5-cli/commit/780b1c17b9a6b23397b74ef52fbe707aabf21edb)
15
+ - Bump [@ui5](https://github.com/ui5)/builder from 3.0.0-alpha.6 to 3.0.0-alpha.7 [`37a7062`](https://github.com/SAP/ui5-cli/commit/37a7062521e08085560ea96a27d15e5f4c5d5574)
16
+ - Bump [@ui5](https://github.com/ui5)/fs from 3.0.0-alpha.3 to 3.0.0-alpha.4 [`ae07607`](https://github.com/SAP/ui5-cli/commit/ae076071ccf4dd9d6a58933d7d6aa0a1fdb9d283)
17
+
18
+
19
+ <a name="v3.0.0-alpha.7"></a>
20
+ ## [v3.0.0-alpha.7] - 2022-04-26
21
+ ### Dependency Updates
22
+ - Bump [@ui5](https://github.com/ui5)/project from 3.0.0-alpha.1 to 3.0.0-alpha.2 [`aac8f7f`](https://github.com/SAP/ui5-cli/commit/aac8f7f5f204660010c42ed428542e01a988d5c6)
23
+ - Bump [@ui5](https://github.com/ui5)/builder from 3.0.0-alpha.5 to 3.0.0-alpha.6 [`027e4df`](https://github.com/SAP/ui5-cli/commit/027e4dfba2bbbb9bcf209d82d85ecff7a2acb6a9)
24
+ - Bump [@ui5](https://github.com/ui5)/fs from 3.0.0-alpha.2 to 3.0.0-alpha.3 [`1f43c4e`](https://github.com/SAP/ui5-cli/commit/1f43c4ed2699e66b0d6c50ca3738a6f61c060734)
25
+
26
+
27
+ <a name="v3.0.0-alpha.6"></a>
28
+ ## [v3.0.0-alpha.6] - 2022-04-14
29
+ ### Dependency Updates
30
+ - Bump [@ui5](https://github.com/ui5)/builder from 3.0.0-alpha.4 to 3.0.0-alpha.5 [`87c4136`](https://github.com/SAP/ui5-cli/commit/87c413627696365eb94de9fccdd7798a05543933)
31
+
6
32
 
7
33
  <a name="v3.0.0-alpha.5"></a>
8
34
  ## [v3.0.0-alpha.5] - 2022-04-05
@@ -757,6 +783,9 @@ Only Node.js v10 or higher is supported.
757
783
  <a name="v0.0.1"></a>
758
784
  ## v0.0.1 - 2018-06-06
759
785
 
786
+ [v3.0.0-alpha.8]: https://github.com/SAP/ui5-cli/compare/v3.0.0-alpha.7...v3.0.0-alpha.8
787
+ [v3.0.0-alpha.7]: https://github.com/SAP/ui5-cli/compare/v3.0.0-alpha.6...v3.0.0-alpha.7
788
+ [v3.0.0-alpha.6]: https://github.com/SAP/ui5-cli/compare/v3.0.0-alpha.5...v3.0.0-alpha.6
760
789
  [v3.0.0-alpha.5]: https://github.com/SAP/ui5-cli/compare/v3.0.0-alpha.4...v3.0.0-alpha.5
761
790
  [v3.0.0-alpha.4]: https://github.com/SAP/ui5-cli/compare/v3.0.0-alpha.3...v3.0.0-alpha.4
762
791
  [v3.0.0-alpha.3]: https://github.com/SAP/ui5-cli/compare/v3.0.0-alpha.2...v3.0.0-alpha.3
@@ -41,9 +41,9 @@ addCommand.handler = async function(argv) {
41
41
  throw new Error("Options 'development' and 'optional' cannot be combined");
42
42
  }
43
43
 
44
- const normalizerOptions = {
45
- translatorName: argv.translator,
46
- configPath: argv.config
44
+ const projectGraphOptions = {
45
+ dependencyDefinition: argv.dependencyDefinition,
46
+ config: argv.config
47
47
  };
48
48
 
49
49
  const libraries = libraryNames.map((name) => {
@@ -57,7 +57,7 @@ addCommand.handler = async function(argv) {
57
57
  });
58
58
 
59
59
  const {yamlUpdated} = await require("../../framework/add")({
60
- normalizerOptions,
60
+ projectGraphOptions,
61
61
  libraries
62
62
  });
63
63
 
@@ -3,13 +3,12 @@ const cli = require("yargs");
3
3
  cli.usage("Usage: ui5 <command> [options]")
4
4
  .demandCommand(1, "Command required! Please have a look at the help documentation above.")
5
5
  .option("config", {
6
- describe: "Path to configuration file",
6
+ describe: "Path to project configuration file in YAML format",
7
7
  type: "string"
8
8
  })
9
- .option("translator", {
10
- describe: "Translator to use. Including optional colon separated translator parameters.",
11
- alias: "t8r",
12
- default: "npm",
9
+ .option("dependency-definition", {
10
+ describe: "Path to a YAML file containing the project's dependency tree. " +
11
+ "This option will disable resolution of node package dependencies.",
13
12
  type: "string"
14
13
  })
15
14
  .option("verbose", {
@@ -22,6 +21,11 @@ cli.usage("Usage: ui5 <command> [options]")
22
21
  default: "info",
23
22
  type: "string"
24
23
  })
24
+ .option("x-perf", {
25
+ describe: "Outputs performance measurements",
26
+ default: false,
27
+ type: "boolean"
28
+ })
25
29
  .showHelpOnFail(true)
26
30
  .strict(true)
27
31
  .alias("help", "h")
@@ -1,7 +1,6 @@
1
1
  // Build
2
2
 
3
3
  const baseMiddleware = require("../middlewares/base.js");
4
- const buildHelper = require("../../utils/buildHelper");
5
4
 
6
5
  const build = {
7
6
  command: "build",
@@ -12,11 +11,6 @@ const build = {
12
11
 
13
12
  build.builder = function(cli) {
14
13
  return cli
15
- .command("dev", "Dev build: Skips non-essential and time-intensive tasks during build", {
16
- handler: handleBuild,
17
- builder: noop,
18
- middlewares: [baseMiddleware]
19
- })
20
14
  .command("jsdoc", "Build JSDoc resources", {
21
15
  handler: handleBuild,
22
16
  builder: noop,
@@ -29,46 +23,46 @@ build.builder = function(cli) {
29
23
  })
30
24
  .command("self-contained",
31
25
  "Build project and create self-contained bundle. " +
32
- "Recommended to be used in conjunction with --all", {
26
+ "Recommended to be used in conjunction with --include-dependencies", {
33
27
  handler: handleBuild,
34
28
  builder: noop,
35
29
  middlewares: [baseMiddleware]
36
30
  })
37
- .option("all", {
38
- describe: "Include all project dependencies into build process",
39
- alias: "a",
31
+ .option("include-all-dependencies", {
32
+ describe: "Include all dependencies in the build result",
33
+ alias: ["all", "a"],
40
34
  default: false,
41
35
  type: "boolean"
42
36
  })
43
37
  .option("include-dependency", {
44
- describe: "A list of dependencies to be included into the build process. You can use the asterisk '*' as" +
45
- " an alias for including all dependencies into the build process. The listed dependencies cannot be" +
38
+ describe: "A list of dependencies to be included in the build result. You can use the asterisk '*' as" +
39
+ " an alias for including all dependencies in the build result. The listed dependencies cannot be" +
46
40
  " overruled by dependencies defined in 'exclude-dependency'.",
47
41
  type: "array"
48
42
  })
49
43
  .option("include-dependency-regexp", {
50
- describe: "A list of regular expressions defining dependencies to be included into the build process." +
44
+ describe: "A list of regular expressions defining dependencies to be included in the build result." +
51
45
  " This list is prioritized like 'include-dependency'.",
52
46
  type: "array"
53
47
  })
54
48
  .option("include-dependency-tree", {
55
- describe: "A list of dependencies to be included into the build process. Transitive dependencies are" +
49
+ describe: "A list of dependencies to be included in the build result. Transitive dependencies are" +
56
50
  " implicitly included and do not need to be part of this list. These dependencies overrule" +
57
51
  " the selection of 'exclude-dependency-tree' but can be overruled by 'exclude-dependency'.",
58
52
  type: "array"
59
53
  })
60
54
  .option("exclude-dependency", {
61
- describe: "A list of dependencies to be excluded from the build process. The listed dependencies can" +
55
+ describe: "A list of dependencies to be excluded from the build result. The listed dependencies can" +
62
56
  " be overruled by dependencies defined in 'include-dependency'.",
63
57
  type: "array"
64
58
  })
65
59
  .option("exclude-dependency-regexp", {
66
- describe: "A list of regular expressions defining dependencies to be excluded from the build process." +
60
+ describe: "A list of regular expressions defining dependencies to be excluded from the build result." +
67
61
  " This list is prioritized like 'exclude-dependency'.",
68
62
  type: "array"
69
63
  })
70
64
  .option("exclude-dependency-tree", {
71
- describe: "A list of dependencies to be excluded from the build process. Transitive dependencies are" +
65
+ describe: "A list of dependencies to be excluded from the build result. Transitive dependencies are" +
72
66
  " implicitly included and do not need to be part of this list.",
73
67
  type: "array"
74
68
  })
@@ -82,18 +76,19 @@ build.builder = function(cli) {
82
76
  default: false,
83
77
  type: "boolean"
84
78
  })
85
- .option("dev-exclude-project", {
86
- describe:
87
- "A list of specific projects to be excluded from dev mode " +
88
- "(dev mode must be active for this to be effective)",
89
- type: "array"
79
+ .option("create-build-manifest", {
80
+ describe: "Store build metadata in a '.ui5' directory in the build destination, " +
81
+ "allowing reuse of the build result in other builds",
82
+ default: false,
83
+ type: "boolean"
90
84
  })
91
85
  .option("include-task", {
92
- describe: "A list of specific tasks to be included to the default/dev set",
86
+ describe: "A list of tasks to be added to the default execution set. " +
87
+ "This option takes precedence over any excludes.",
93
88
  type: "array"
94
89
  })
95
90
  .option("exclude-task", {
96
- describe: "A list of specific tasks to be excluded from default/dev set",
91
+ describe: "A list of tasks to be excluded from the default task execution set",
97
92
  type: "array"
98
93
  })
99
94
  .option("framework-version", {
@@ -102,12 +97,14 @@ build.builder = function(cli) {
102
97
  })
103
98
  .option("experimental-css-variables", {
104
99
  describe:
105
- "If present, the CSS variables (css-variables.css, css-variables.source.less) " +
106
- "and the skeleton for a theme (library-skeleton.css, [library-skeleton-RTL.css]) are generated",
100
+ "Generate CSS variables (css-variables.css, css-variables.source.less)" +
101
+ " and skeleton (library-skeleton(-RTL).css) for all themes",
107
102
  default: false,
108
103
  type: "boolean"
109
104
  })
110
105
  .example("ui5 build", "Preload build for project without dependencies")
106
+
107
+ // TODO 3.0: Update examples
111
108
  .example("ui5 build self-contained --all", "Self-contained build for project including dependencies")
112
109
  .example("ui5 build --all --exclude-task=* --include-task=createDebugFiles generateAppPreload",
113
110
  "Build project and dependencies but only apply the createDebugFiles- and generateAppPreload tasks")
@@ -120,56 +117,49 @@ build.builder = function(cli) {
120
117
  .example("ui5 build dev",
121
118
  "Build project and dependencies in dev mode. Only a set of essential tasks is executed.")
122
119
  .example("ui5 build --experimental-css-variables",
123
- "Preload build for project without dependencies but with CSS variable artefacts");
120
+ "Preload build for project without dependencies but with CSS variable artifacts");
124
121
  };
125
122
 
126
123
  async function handleBuild(argv) {
127
- const normalizer = require("@ui5/project").normalizer;
128
- const builder = require("@ui5/builder").builder;
129
124
  const logger = require("@ui5/logger");
125
+ const {generateProjectGraph, builder} = require("@ui5/project");
130
126
 
131
127
  const command = argv._[argv._.length - 1];
132
128
  logger.setShowProgress(true);
133
129
 
134
- const normalizerOptions = {
135
- translatorName: argv.translator,
136
- configPath: argv.config
137
- };
138
-
139
- if (argv.frameworkVersion) {
140
- normalizerOptions.frameworkOptions = {
130
+ let graph;
131
+ if (argv.dependencyDefinition) {
132
+ graph = await generateProjectGraph.usingStaticFile({
133
+ filePath: argv.dependencyDefinition,
134
+ rootConfigPath: argv.config,
141
135
  versionOverride: argv.frameworkVersion
142
- };
136
+ });
137
+ } else {
138
+ graph = await generateProjectGraph.usingNodePackageDependencies({
139
+ rootConfigPath: argv.config,
140
+ versionOverride: argv.frameworkVersion
141
+ });
143
142
  }
144
-
145
- const tree = await normalizer.generateProjectTree(normalizerOptions);
146
- const buildSettings = (tree.builder && tree.builder.settings) || {};
147
-
148
- const {includedDependencies, excludedDependencies} = buildHelper.createDependencyLists({
149
- tree: tree,
150
- includeDependency: argv["include-dependency"],
151
- includeDependencyRegExp: argv["include-dependency-regexp"],
152
- includeDependencyTree: argv["include-dependency-tree"],
153
- excludeDependency: argv["exclude-dependency"],
154
- excludeDependencyRegExp: argv["exclude-dependency-regexp"],
155
- excludeDependencyTree: argv["exclude-dependency-tree"],
156
- defaultIncludeDependency: buildSettings.includeDependency,
157
- defaultIncludeDependencyRegExp: buildSettings.includeDependencyRegExp,
158
- defaultIncludeDependencyTree: buildSettings.includeDependencyTree
159
- });
160
- const buildAll = buildHelper.alignWithBuilderApi(argv.all, includedDependencies, excludedDependencies);
161
-
162
- await builder.build({
163
- tree: tree,
143
+ const buildSettings = graph.getRoot().getBuilderSettings() || {};
144
+ await builder({
145
+ graph,
164
146
  destPath: argv.dest,
165
147
  cleanDest: argv["clean-dest"],
166
- buildDependencies: buildAll,
167
- includedDependencies: includedDependencies,
168
- excludedDependencies: excludedDependencies,
169
- dev: command === "dev",
148
+ createBuildManifest: argv["create-build-manifest"],
149
+ complexDependencyIncludes: {
150
+ includeAllDependencies: argv["include-all-dependencies"],
151
+ includeDependency: argv["include-dependency"],
152
+ includeDependencyRegExp: argv["include-dependency-regexp"],
153
+ includeDependencyTree: argv["include-dependency-tree"],
154
+ excludeDependency: argv["exclude-dependency"],
155
+ excludeDependencyRegExp: argv["exclude-dependency-regexp"],
156
+ excludeDependencyTree: argv["exclude-dependency-tree"],
157
+ defaultIncludeDependency: buildSettings.includeDependency,
158
+ defaultIncludeDependencyRegExp: buildSettings.includeDependencyRegExp,
159
+ defaultIncludeDependencyTree: buildSettings.includeDependencyTree
160
+ },
170
161
  selfContained: command === "self-contained",
171
162
  jsdoc: command === "jsdoc",
172
- devExcludeProject: argv["dev-exclude-project"],
173
163
  includedTasks: argv["include-task"],
174
164
  excludedTasks: argv["exclude-task"],
175
165
  cssVariables: argv["experimental-css-variables"]
@@ -27,9 +27,9 @@ removeCommand.handler = async function(argv) {
27
27
  return libraryNames.indexOf(libraryName) === index;
28
28
  });
29
29
 
30
- const normalizerOptions = {
31
- translatorName: argv.translator,
32
- configPath: argv.config
30
+ const projectGraphOptions = {
31
+ dependencyDefinition: argv.dependencyDefinition,
32
+ config: argv.config
33
33
  };
34
34
 
35
35
  const libraries = libraryNames.map((name) => {
@@ -38,7 +38,7 @@ removeCommand.handler = async function(argv) {
38
38
  });
39
39
 
40
40
  const {yamlUpdated} = await require("../../framework/remove")({
41
- normalizerOptions,
41
+ projectGraphOptions,
42
42
  libraries
43
43
  });
44
44
 
@@ -73,30 +73,32 @@ serve.builder = function(cli) {
73
73
  };
74
74
 
75
75
  serve.handler = async function(argv) {
76
- const normalizer = require("@ui5/project").normalizer;
76
+ const {generateProjectGraph} = require("@ui5/project");
77
77
  const ui5Server = require("@ui5/server");
78
78
  const server = ui5Server.server;
79
79
 
80
- const normalizerOptions = {
81
- translatorName: argv.translator,
82
- configPath: argv.config
83
- };
84
-
85
- if (argv.frameworkVersion) {
86
- normalizerOptions.frameworkOptions = {
80
+ let graph;
81
+ if (argv.dependencyDefinition) {
82
+ graph = await generateProjectGraph.usingStaticFile({
83
+ filePath: argv.dependencyDefinition,
84
+ versionOverride: argv.frameworkVersion
85
+ });
86
+ } else {
87
+ graph = await generateProjectGraph.usingNodePackageDependencies({
88
+ rootConfigPath: argv.config,
87
89
  versionOverride: argv.frameworkVersion
88
- };
90
+ });
89
91
  }
90
92
 
91
- const tree = await normalizer.generateProjectTree(normalizerOptions);
92
93
  let port = argv.port;
93
94
  let changePortIfInUse = false;
94
95
 
95
- if (!port && tree.server && tree.server.settings) {
96
+ if (!port && graph.getRoot().getServerSettings()) {
97
+ const serverSettings = graph.getRoot().getServerSettings();
96
98
  if (argv.h2) {
97
- port = tree.server.settings.httpsPort;
99
+ port = serverSettings.httpsPort;
98
100
  } else {
99
- port = tree.server.settings.httpPort;
101
+ port = serverSettings.httpPort;
100
102
  }
101
103
  }
102
104
 
@@ -127,7 +129,7 @@ serve.handler = async function(argv) {
127
129
  serverConfig.cert = cert;
128
130
  }
129
131
 
130
- const {h2, port: actualPort} = await server.serve(tree, serverConfig);
132
+ const {h2, port: actualPort} = await server.serve(graph, serverConfig);
131
133
 
132
134
  const protocol = h2 ? "https" : "http";
133
135
  let browserUrl = protocol + "://localhost:" + actualPort;
@@ -9,63 +9,98 @@ const tree = {
9
9
 
10
10
  tree.builder = function(cli) {
11
11
  return cli
12
- .option("full", {
13
- describe: "Include more information (currently the project configuration)",
14
- default: false,
15
- type: "boolean"
16
- })
17
- .option("json", {
18
- describe: "Output tree as formatted JSON string",
19
- default: false,
20
- type: "boolean"
21
- })
22
- .option("dedupe", {
23
- describe: "Remove duplicate projects from project tree",
24
- default: false,
25
- type: "boolean"
26
- })
27
12
  .option("framework-version", {
28
13
  describe:
29
- "Overrides the framework version defined by the project. Only supported in combination with --full",
14
+ "Overrides the framework version defined by the project",
30
15
  type: "string"
31
- }).check((argv) => {
32
- if (argv.frameworkVersion && !argv.full) {
33
- throw new Error(`"framework-version" can only be used in combination with option "--full"`);
34
- } else {
35
- return true;
36
- }
37
- })
38
- .example("ui5 tree > tree.txt", "Pipes the dependency tree into a new file \"tree.txt\"")
39
- .example("ui5 tree --json > tree.json", "Pipes the dependency tree into a new file \"tree.json\"");
16
+ });
40
17
  };
41
18
 
42
19
  tree.handler = async function(argv) {
43
- const normalizer = require("@ui5/project").normalizer;
44
- const treeify = require("treeify");
45
-
46
- const options = {
47
- translatorName: argv.translator,
48
- translatorOptions: {
49
- includeDeduped: !argv.dedupe
50
- },
51
- configPath: argv.config
52
- };
20
+ const chalk = require("chalk");
53
21
 
54
- if (argv.frameworkVersion ) {
55
- options.frameworkOptions = {
22
+ let startTime;
23
+ let elapsedTime;
24
+ if (argv.xPerf) {
25
+ startTime = process.hrtime();
26
+ }
27
+ const {generateProjectGraph} = require("@ui5/project");
28
+ let graph;
29
+ if (argv.dependencyDefinition) {
30
+ graph = await generateProjectGraph.usingStaticFile({
31
+ filePath: argv.dependencyDefinition,
56
32
  versionOverride: argv.frameworkVersion
57
- };
33
+ });
34
+ } else {
35
+ graph = await generateProjectGraph.usingNodePackageDependencies({
36
+ rootConfigPath: argv.config,
37
+ versionOverride: argv.frameworkVersion
38
+ });
58
39
  }
59
40
 
60
- let projectTree;
61
- if (argv.full) {
62
- projectTree = await normalizer.generateProjectTree(options);
63
- } else {
64
- projectTree = await normalizer.generateDependencyTree(options);
41
+ if (argv.xPerf) {
42
+ elapsedTime = getElapsedTime(startTime);
65
43
  }
66
44
 
67
- const output = argv.json ? JSON.stringify(projectTree, null, 4) : treeify.asTree(projectTree, true);
68
- console.log(output);
45
+ const projects = {};
46
+ const indentWidth = 4;
47
+ await graph.traverseBreadthFirst(async ({project, getDependencies}) => {
48
+ const deps = getDependencies().map((dep) => {
49
+ return dep.getName();
50
+ });
51
+ projects[project.getName()] = {
52
+ render: function(indentation, connectorIndices, lastChild) {
53
+ let baseString = " ".repeat(indentation * indentWidth);
54
+ connectorIndices.forEach((idx) => {
55
+ baseString = `${baseString.slice(0, idx)}│${baseString.slice(idx + 1)}`;
56
+ });
57
+ const connectorString = lastChild ? "╰─" : "├─";
58
+ console.log(
59
+ `${baseString}${connectorString} ${chalk.bold(project.getName())} ` +
60
+ `${project.getNamespace ? chalk.inverse(project.getNamespace()) + " " : ""}` +
61
+ chalk.dim(`(${project.getVersion()}, ${project.getType()}) `) +
62
+ chalk.dim.italic(`${project.getPath()}`)
63
+ );
64
+
65
+ const lastIdx = deps.length -1;
66
+ const newConnectorIndices = [...connectorIndices];
67
+ if (!lastChild) {
68
+ newConnectorIndices.push(indentation * indentWidth);
69
+ }
70
+ deps.forEach((dep, i) => {
71
+ projects[dep].render(indentation + 1, newConnectorIndices, i === lastIdx);
72
+ });
73
+ }
74
+ };
75
+ });
76
+
77
+ const projectKeys = Object.keys(projects);
78
+ console.log(chalk.bold.underline(`Dependencies (${projectKeys.length}):`));
79
+ projects[projectKeys[0]].render(0, [], true);
80
+ console.log("");
81
+
82
+ const extensions = graph.getAllExtensions();
83
+ console.log(chalk.bold.underline(`Extensions (${extensions.length}):`));
84
+ if (extensions.length) {
85
+ extensions.forEach((extension) => {
86
+ console.log(
87
+ `├─ ${extension.getName()} ` +
88
+ chalk.dim(`(${extension.getVersion()}, ${extension.getType()}) `) +
89
+ chalk.dim.italic(`${extension.getPath()}`));
90
+ });
91
+ } else {
92
+ console.log(chalk.italic(`None`));
93
+ }
94
+ if (argv.xPerf) {
95
+ console.log("");
96
+ console.log(chalk.blue(
97
+ `Dependency graph generation took ${chalk.bold(elapsedTime)}`));
98
+ }
69
99
  };
70
100
 
101
+ function getElapsedTime(startTime) {
102
+ const timeDiff = process.hrtime(startTime);
103
+ const prettyHrtime = require("pretty-hrtime");
104
+ return prettyHrtime(timeDiff);
105
+ }
71
106
  module.exports = tree;
@@ -55,13 +55,13 @@ function parseFrameworkInfo(frameworkInfo) {
55
55
  useCommand.handler = async function(argv) {
56
56
  const frameworkOptions = parseFrameworkInfo(argv["framework-info"]);
57
57
 
58
- const normalizerOptions = {
59
- translatorName: argv.translator,
60
- configPath: argv.config
58
+ const projectGraphOptions = {
59
+ dependencyDefinition: argv.dependencyDefinition,
60
+ config: argv.config
61
61
  };
62
62
 
63
63
  const {usedFramework, usedVersion, yamlUpdated} = await require("../../framework/use")({
64
- normalizerOptions,
64
+ projectGraphOptions,
65
65
  frameworkOptions
66
66
  });
67
67
 
@@ -1,33 +1,40 @@
1
1
  const {getRootProjectConfiguration, getFrameworkResolver, isValidSpecVersion} = require("./utils");
2
2
 
3
- module.exports = async function({normalizerOptions, libraries}) {
4
- const project = await getRootProjectConfiguration({normalizerOptions});
3
+ /**
4
+ * Adds the given set of libraries to the framework libraries section in the ui5.yaml
5
+ *
6
+ * @param {object} parameters Parameters
7
+ * @param {object} parameters.projectGraphOptions
8
+ * @param {object} parameters.libraries
9
+ */
10
+ module.exports = async function({projectGraphOptions, libraries}) {
11
+ const project = await getRootProjectConfiguration(projectGraphOptions);
5
12
 
6
- if (!isValidSpecVersion(project.specVersion)) {
13
+ if (!isValidSpecVersion(project.getSpecVersion())) {
7
14
  throw new Error(
8
15
  `ui5 add command requires specVersion "2.0" or higher. ` +
9
- `Project ${project.metadata.name} uses specVersion "${project.specVersion}"`
16
+ `Project ${project.getName()} uses specVersion "${project.getSpecVersion()}"`
10
17
  );
11
18
  }
12
19
 
13
- if (!project.framework) {
20
+ if (!project.getFrameworkName()) {
14
21
  throw new Error(
15
- `Project ${project.metadata.name} is missing a framework configuration. ` +
22
+ `Project ${project.getName()} is missing a framework configuration. ` +
16
23
  `Please use "ui5 use" to configure a framework and version.`
17
24
  );
18
25
  }
19
- if (!project.framework.version) {
26
+ if (!project.getFrameworkVersion()) {
20
27
  throw new Error(
21
- `Project ${project.metadata.name} does not define a framework version configuration. ` +
28
+ `Project ${project.getName()} does not define a framework version configuration. ` +
22
29
  `Please use "ui5 use" to configure a version.`
23
30
  );
24
31
  }
25
32
 
26
- const Resolver = getFrameworkResolver(project.framework.name);
33
+ const Resolver = getFrameworkResolver(project.getFrameworkName());
27
34
 
28
35
  const resolver = new Resolver({
29
- cwd: project.path,
30
- version: project.framework.version
36
+ cwd: project.getPath(),
37
+ version: project.getFrameworkVersion()
31
38
  });
32
39
 
33
40
  // Get metadata of all libraries to verify that they can be installed
@@ -35,21 +42,20 @@ module.exports = async function({normalizerOptions, libraries}) {
35
42
  try {
36
43
  await resolver.getLibraryMetadata(name);
37
44
  } catch (err) {
38
- throw new Error(`Failed to find ${project.framework.name} framework library ${name}: ` + err.message);
45
+ throw new Error(`Failed to find ${project.getFrameworkName()} framework library ${name}: ` + err.message);
39
46
  }
40
47
  }));
41
48
 
42
49
  // Shallow copy of given libraries to not modify the input parameter when pushing other libraries
43
50
  const allLibraries = [...libraries];
44
51
 
45
- if (project.framework.libraries) {
46
- project.framework.libraries.forEach((library) => {
47
- // Don't add libraries twice!
48
- if (allLibraries.findIndex(($) => $.name === library.name) === -1) {
49
- allLibraries.push(library);
50
- }
51
- });
52
- }
52
+ project.getFrameworkDependencies().forEach((library) => {
53
+ // Don't add libraries twice!
54
+ if (allLibraries.findIndex(($) => $.name === library.name) === -1) {
55
+ allLibraries.push(library);
56
+ }
57
+ });
58
+
53
59
  allLibraries.sort((a, b) => {
54
60
  return a.name.localeCompare(b.name);
55
61
  });
@@ -59,6 +65,7 @@ module.exports = async function({normalizerOptions, libraries}) {
59
65
  try {
60
66
  await require("./updateYaml")({
61
67
  project,
68
+ configPathOverride: projectGraphOptions.config,
62
69
  data: {
63
70
  framework: {
64
71
  libraries: allLibraries