@ui5/cli 2.14.10 → 3.0.0-alpha.10

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,42 +2,100 @@
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/v2.14.10...HEAD).
5
+ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-cli/compare/v3.0.0-alpha.10...HEAD).
6
+
7
+ <a name="v3.0.0-alpha.10"></a>
8
+ ## [v3.0.0-alpha.10] - 2022-07-26
9
+ ### Dependency Updates
10
+ - Bump [@ui5](https://github.com/ui5)/project from 3.0.0-alpha.4 to 3.0.0-alpha.5 [`8d43873`](https://github.com/SAP/ui5-cli/commit/8d438736375debb54853b61b01696e6fbf3cbbc2)
6
11
 
7
- <a name="v2.14.10"></a>
8
- ## [v2.14.10] - 2022-07-24
9
12
 
10
- <a name="v2.14.9"></a>
11
- ## [v2.14.9] - 2022-05-04
13
+ <a name="v3.0.0-alpha.9"></a>
14
+ ## [v3.0.0-alpha.9] - 2022-07-15
12
15
  ### Dependency Updates
13
- - Bump [@ui5](https://github.com/ui5)/builder from 2.11.4 to 2.11.5 [`aa90039`](https://github.com/SAP/ui5-cli/commit/aa9003933bb6f5e71e9ce968ab5cc6202f805256)
16
+ - Bump [@ui5](https://github.com/ui5)/builder from 3.0.0-alpha.8 to 3.0.0-alpha.8 [`fa048a3`](https://github.com/SAP/ui5-cli/commit/fa048a3ea063374d886724e582a5162a9f450a83)
17
+ - Bump [@ui5](https://github.com/ui5)/project from 3.0.0-alpha.3 to 3.0.0-alpha.4 [`a1aa75a`](https://github.com/SAP/ui5-cli/commit/a1aa75a4d79770d265822ef136390cc38898d4bd)
14
18
 
15
19
 
16
- <a name="v2.14.8"></a>
17
- ## [v2.14.8] - 2022-04-14
20
+ <a name="v3.0.0-alpha.8"></a>
21
+ ## [v3.0.0-alpha.8] - 2022-06-14
22
+ ### Breaking Changes
23
+ - Adapt to Project Graph APIs ([#413](https://github.com/SAP/ui5-cli/issues/413)) [`945b82b`](https://github.com/SAP/ui5-cli/commit/945b82bc775dc0a711529057908e9f36d8fadb62)
18
24
 
19
- <a name="v2.14.7"></a>
20
- ## [v2.14.7] - 2022-03-25
25
+ ### Dependency Updates
26
+ - 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)
27
+ - 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)
28
+ - 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)
29
+ - 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)
21
30
 
22
- <a name="v2.14.6"></a>
23
- ## [v2.14.6] - 2022-02-21
31
+
32
+ <a name="v3.0.0-alpha.7"></a>
33
+ ## [v3.0.0-alpha.7] - 2022-04-26
24
34
  ### Dependency Updates
25
- - Bump [@ui5](https://github.com/ui5)/builder from 2.11.3 to 2.11.4 [`f8ce36c`](https://github.com/SAP/ui5-cli/commit/f8ce36ca504c1021c3e3825a6762dda29f7ea74d)
35
+ - 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)
36
+ - 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)
37
+ - 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)
38
+
39
+
40
+ <a name="v3.0.0-alpha.6"></a>
41
+ ## [v3.0.0-alpha.6] - 2022-04-14
42
+ ### Dependency Updates
43
+ - 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)
44
+
45
+
46
+ <a name="v3.0.0-alpha.5"></a>
47
+ ## [v3.0.0-alpha.5] - 2022-04-05
48
+ ### Dependency Updates
49
+ - Bump [@ui5](https://github.com/ui5)/builder from 3.0.0-alpha.3 to 3.0.0-alpha.4 [`91d3bbd`](https://github.com/SAP/ui5-cli/commit/91d3bbdd01ec1cc80f21094434fa0f7da37ca242)
50
+
51
+ ### Features
52
+ - Add build flag "--experimental-css-variables" ([#501](https://github.com/SAP/ui5-cli/issues/501)) [`0b099db`](https://github.com/SAP/ui5-cli/commit/0b099db193ee94aa0bde8373e883fbc54098cd89)
26
53
 
27
54
 
28
- <a name="v2.14.5"></a>
29
- ## [v2.14.5] - 2022-02-17
55
+ <a name="v3.0.0-alpha.4"></a>
56
+ ## [v3.0.0-alpha.4] - 2022-03-10
57
+ ### Dependency Updates
58
+ - Bump [@ui5](https://github.com/ui5)/builder from 3.0.0-alpha.2 to 3.0.0-alpha.3 [`7f836aa`](https://github.com/SAP/ui5-cli/commit/7f836aad558b16eaf05dde2c2a5aa409b1ba7111)
59
+
60
+
61
+ <a name="v3.0.0-alpha.3"></a>
62
+ ## [v3.0.0-alpha.3] - 2022-02-25
63
+ ### Dependency Updates
64
+ - Bump [@ui5](https://github.com/ui5)/builder from 3.0.0-alpha.1 to 3.0.0-alpha.2 [`617f0f0`](https://github.com/SAP/ui5-cli/commit/617f0f06b29e81f384186c88c07da85be55d2970)
65
+
66
+
67
+ <a name="v3.0.0-alpha.2"></a>
68
+ ## [v3.0.0-alpha.2] - 2022-01-31
69
+
70
+ <a name="v3.0.0-alpha.1"></a>
71
+ ## [v3.0.0-alpha.1] - 2022-01-25
72
+ ### Breaking Changes
73
+ - Require Node.js >= 16.13.2 / npm >= 8 [`71a2696`](https://github.com/SAP/ui5-cli/commit/71a2696ecc056ccfa695bd560d59bb31c7dbeb65)
74
+
75
+ ### Dependency Updates
76
+ - Bump [@ui5](https://github.com/ui5)/project from 3.0.0-alpha.0 to 3.0.0-alpha.1 [`23601ce`](https://github.com/SAP/ui5-cli/commit/23601ce6330f5427960ae40316a8569e641cdf55)
77
+ - Bump [@ui5](https://github.com/ui5)/server from 3.0.0-alpha.0 to 3.0.0-alpha.1 [`61a8714`](https://github.com/SAP/ui5-cli/commit/61a8714a55cb18ba384feee50ddd52f91810f4d0)
78
+ - Bump [@ui5](https://github.com/ui5)/builder from 3.0.0-alpha.0 to 3.0.0-alpha.1 [`e7fcc14`](https://github.com/SAP/ui5-cli/commit/e7fcc14a97d9b89e5b8e958e41e74d0300e45771)
79
+ - Bump [@ui5](https://github.com/ui5)/fs from 3.0.0-alpha.1 to 3.0.0-alpha.2 [`511f3c8`](https://github.com/SAP/ui5-cli/commit/511f3c8044b1f41840c15fcbdca95da5d159d207)
80
+ - Bump [@ui5](https://github.com/ui5)/logger from 3.0.1-alpha.0 to 3.0.1-alpha.1 [`85f5657`](https://github.com/SAP/ui5-cli/commit/85f565781ebe0286ba61601c744c6239e26df6a7)
81
+ - Bump [@ui5](https://github.com/ui5)/fs from 3.0.0-alpha.0 to 3.0.0-alpha.1 [`f629e31`](https://github.com/SAP/ui5-cli/commit/f629e31c22ca375ddf4282bafcd38ff45ea5a4bc)
82
+
83
+ ### BREAKING CHANGE
30
84
 
31
- <a name="v2.14.4"></a>
32
- ## [v2.14.4] - 2022-01-24
85
+ Support for older Node.js and npm releases has been dropped.
86
+ Only Node.js v16.13.2 and npm v8 or higher are supported.
33
87
 
34
- <a name="v2.14.3"></a>
35
- ## [v2.14.3] - 2022-01-19
36
88
 
37
- <a name="v2.14.2"></a>
38
- ## [v2.14.2] - 2021-12-14
89
+ <a name="v3.0.0-alpha.0"></a>
90
+ ## [v3.0.0-alpha.0] - 2021-12-14
39
91
  ### Dependency Updates
40
- - Bump [@ui5](https://github.com/ui5)/builder from 2.11.2 to 2.11.3 [`ebe6377`](https://github.com/SAP/ui5-cli/commit/ebe6377e347475cf2219ea97deee44fd617f6d7e)
92
+ - Bump [@ui5](https://github.com/ui5)/logger from 3.0.0-next.0 to 3.0.1-alpha.0 [`2fa522c`](https://github.com/SAP/ui5-cli/commit/2fa522c5b33766703a14261dc1aa4256fe6be999)
93
+ - Bump [@ui5](https://github.com/ui5)/project from 2.6.0 to 3.0.0-alpha.0 [`2879975`](https://github.com/SAP/ui5-cli/commit/2879975d917423eb4cca7ceccbc209f861c179e0)
94
+ - Bump [@ui5](https://github.com/ui5)/server from 2.4.0 to 3.0.0-alpha.0 [`f850407`](https://github.com/SAP/ui5-cli/commit/f850407871396f151ffddd98ec6a879ded88541d)
95
+ - Bump [@ui5](https://github.com/ui5)/builder from 2.11.3 to 3.0.0-alpha.0 [`7ac03ba`](https://github.com/SAP/ui5-cli/commit/7ac03baf0fd46028aa01cedb0a16763bc3d86cfd)
96
+ - Bump [@ui5](https://github.com/ui5)/fs from 2.0.6 to 3.0.0-alpha.0 [`46bbb4d`](https://github.com/SAP/ui5-cli/commit/46bbb4da942527fe8d9c0a4ece102d951d3b254c)
97
+ - Bump [@ui5](https://github.com/ui5)/logger from 3.0.0-next.0 to 3.0.0-alpha.0 [`e011b86`](https://github.com/SAP/ui5-cli/commit/e011b862c85ba7388c00d3ae0cc86396671b1e2d)
98
+ - Bump [@ui5](https://github.com/ui5)/logger from 2.0.1 to 3.0.0-next.0 [`32a2bcc`](https://github.com/SAP/ui5-cli/commit/32a2bcc47d16bd255d6bd9f6a76a29496782b357)
41
99
 
42
100
 
43
101
  <a name="v2.14.1"></a>
@@ -738,15 +796,17 @@ Only Node.js v10 or higher is supported.
738
796
  <a name="v0.0.1"></a>
739
797
  ## v0.0.1 - 2018-06-06
740
798
 
741
- [v2.14.10]: https://github.com/SAP/ui5-cli/compare/v2.14.9...v2.14.10
742
- [v2.14.9]: https://github.com/SAP/ui5-cli/compare/v2.14.8...v2.14.9
743
- [v2.14.8]: https://github.com/SAP/ui5-cli/compare/v2.14.7...v2.14.8
744
- [v2.14.7]: https://github.com/SAP/ui5-cli/compare/v2.14.6...v2.14.7
745
- [v2.14.6]: https://github.com/SAP/ui5-cli/compare/v2.14.5...v2.14.6
746
- [v2.14.5]: https://github.com/SAP/ui5-cli/compare/v2.14.4...v2.14.5
747
- [v2.14.4]: https://github.com/SAP/ui5-cli/compare/v2.14.3...v2.14.4
748
- [v2.14.3]: https://github.com/SAP/ui5-cli/compare/v2.14.2...v2.14.3
749
- [v2.14.2]: https://github.com/SAP/ui5-cli/compare/v2.14.1...v2.14.2
799
+ [v3.0.0-alpha.10]: https://github.com/SAP/ui5-cli/compare/v3.0.0-alpha.9...v3.0.0-alpha.10
800
+ [v3.0.0-alpha.9]: https://github.com/SAP/ui5-cli/compare/v3.0.0-alpha.8...v3.0.0-alpha.9
801
+ [v3.0.0-alpha.8]: https://github.com/SAP/ui5-cli/compare/v3.0.0-alpha.7...v3.0.0-alpha.8
802
+ [v3.0.0-alpha.7]: https://github.com/SAP/ui5-cli/compare/v3.0.0-alpha.6...v3.0.0-alpha.7
803
+ [v3.0.0-alpha.6]: https://github.com/SAP/ui5-cli/compare/v3.0.0-alpha.5...v3.0.0-alpha.6
804
+ [v3.0.0-alpha.5]: https://github.com/SAP/ui5-cli/compare/v3.0.0-alpha.4...v3.0.0-alpha.5
805
+ [v3.0.0-alpha.4]: https://github.com/SAP/ui5-cli/compare/v3.0.0-alpha.3...v3.0.0-alpha.4
806
+ [v3.0.0-alpha.3]: https://github.com/SAP/ui5-cli/compare/v3.0.0-alpha.2...v3.0.0-alpha.3
807
+ [v3.0.0-alpha.2]: https://github.com/SAP/ui5-cli/compare/v3.0.0-alpha.1...v3.0.0-alpha.2
808
+ [v3.0.0-alpha.1]: https://github.com/SAP/ui5-cli/compare/v3.0.0-alpha.0...v3.0.0-alpha.1
809
+ [v3.0.0-alpha.0]: https://github.com/SAP/ui5-cli/compare/v2.14.1...v3.0.0-alpha.0
750
810
  [v2.14.1]: https://github.com/SAP/ui5-cli/compare/v2.14.0...v2.14.1
751
811
  [v2.14.0]: https://github.com/SAP/ui5-cli/compare/v2.13.0...v2.14.0
752
812
  [v2.13.0]: https://github.com/SAP/ui5-cli/compare/v2.12.1...v2.13.0
@@ -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,25 +76,35 @@ 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", {
100
95
  describe: "Overrides the framework version defined by the project",
101
96
  type: "string"
102
97
  })
98
+ .option("experimental-css-variables", {
99
+ describe:
100
+ "Generate CSS variables (css-variables.css, css-variables.source.less)" +
101
+ " and skeleton (library-skeleton(-RTL).css) for all themes",
102
+ default: false,
103
+ type: "boolean"
104
+ })
103
105
  .example("ui5 build", "Preload build for project without dependencies")
106
+
107
+ // TODO 3.0: Update examples
104
108
  .example("ui5 build self-contained --all", "Self-contained build for project including dependencies")
105
109
  .example("ui5 build --all --exclude-task=* --include-task=createDebugFiles generateAppPreload",
106
110
  "Build project and dependencies but only apply the createDebugFiles- and generateAppPreload tasks")
@@ -111,58 +115,54 @@ build.builder = function(cli) {
111
115
  "Build project and dependencies in dev mode, except \"sap.ui.core\" and \"sap.m\" " +
112
116
  "(useful in combination with --include-task)")
113
117
  .example("ui5 build dev",
114
- "Build project and dependencies in dev mode. Only a set of essential tasks is executed.");
118
+ "Build project and dependencies in dev mode. Only a set of essential tasks is executed.")
119
+ .example("ui5 build --experimental-css-variables",
120
+ "Preload build for project without dependencies but with CSS variable artifacts");
115
121
  };
116
122
 
117
123
  async function handleBuild(argv) {
118
- const normalizer = require("@ui5/project").normalizer;
119
- const builder = require("@ui5/builder").builder;
120
124
  const logger = require("@ui5/logger");
125
+ const {generateProjectGraph} = require("@ui5/project");
121
126
 
122
127
  const command = argv._[argv._.length - 1];
123
128
  logger.setShowProgress(true);
124
129
 
125
- const normalizerOptions = {
126
- translatorName: argv.translator,
127
- configPath: argv.config
128
- };
129
-
130
- if (argv.frameworkVersion) {
131
- normalizerOptions.frameworkOptions = {
130
+ let graph;
131
+ if (argv.dependencyDefinition) {
132
+ graph = await generateProjectGraph.usingStaticFile({
133
+ filePath: argv.dependencyDefinition,
134
+ rootConfigPath: argv.config,
135
+ versionOverride: argv.frameworkVersion
136
+ });
137
+ } else {
138
+ graph = await generateProjectGraph.usingNodePackageDependencies({
139
+ rootConfigPath: argv.config,
132
140
  versionOverride: argv.frameworkVersion
133
- };
141
+ });
134
142
  }
135
-
136
- const tree = await normalizer.generateProjectTree(normalizerOptions);
137
- const buildSettings = (tree.builder && tree.builder.settings) || {};
138
-
139
- const {includedDependencies, excludedDependencies} = buildHelper.createDependencyLists({
140
- tree: tree,
141
- includeDependency: argv["include-dependency"],
142
- includeDependencyRegExp: argv["include-dependency-regexp"],
143
- includeDependencyTree: argv["include-dependency-tree"],
144
- excludeDependency: argv["exclude-dependency"],
145
- excludeDependencyRegExp: argv["exclude-dependency-regexp"],
146
- excludeDependencyTree: argv["exclude-dependency-tree"],
147
- defaultIncludeDependency: buildSettings.includeDependency,
148
- defaultIncludeDependencyRegExp: buildSettings.includeDependencyRegExp,
149
- defaultIncludeDependencyTree: buildSettings.includeDependencyTree
150
- });
151
- const buildAll = buildHelper.alignWithBuilderApi(argv.all, includedDependencies, excludedDependencies);
152
-
153
- await builder.build({
154
- tree: tree,
143
+ const buildSettings = graph.getRoot().getBuilderSettings() || {};
144
+ await graph.build({
145
+ graph,
155
146
  destPath: argv.dest,
156
147
  cleanDest: argv["clean-dest"],
157
- buildDependencies: buildAll,
158
- includedDependencies: includedDependencies,
159
- excludedDependencies: excludedDependencies,
160
- 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
+ },
161
161
  selfContained: command === "self-contained",
162
162
  jsdoc: command === "jsdoc",
163
- devExcludeProject: argv["dev-exclude-project"],
164
163
  includedTasks: argv["include-task"],
165
- excludedTasks: argv["exclude-task"]
164
+ excludedTasks: argv["exclude-task"],
165
+ cssVariables: argv["experimental-css-variables"]
166
166
  });
167
167
  }
168
168
 
@@ -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;