@ui5/cli 3.0.0-alpha.1 → 3.0.0-alpha.12
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 +926 -0
- package/lib/cli/commands/add.js +4 -4
- package/lib/cli/commands/base.js +9 -5
- package/lib/cli/commands/build.js +61 -61
- package/lib/cli/commands/remove.js +4 -4
- package/lib/cli/commands/serve.js +16 -14
- package/lib/cli/commands/tree.js +80 -45
- package/lib/cli/commands/use.js +4 -4
- package/lib/framework/add.js +27 -20
- package/lib/framework/remove.js +14 -13
- package/lib/framework/updateYaml.js +14 -4
- package/lib/framework/use.js +10 -12
- package/lib/framework/utils.js +14 -10
- package/npm-shrinkwrap.json +1133 -8627
- package/package.json +11 -10
- package/lib/utils/buildHelper.js +0 -216
|
@@ -9,11 +9,11 @@ function getProjectYamlDocument({project, configFile, configPath}) {
|
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
const projectDocumentIndex = configs.findIndex((config) => {
|
|
12
|
-
return config.metadata && config.metadata.name === project.
|
|
12
|
+
return config.metadata && config.metadata.name === project.getName();
|
|
13
13
|
});
|
|
14
14
|
if (projectDocumentIndex === -1) {
|
|
15
15
|
throw new Error(
|
|
16
|
-
`Could not find project with name ${project.
|
|
16
|
+
`Could not find project with name ${project.getName()} in YAML: ${configPath}`
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -137,13 +137,23 @@ function formatValue(value, indent) {
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
module.exports = async function({project, data}) {
|
|
140
|
+
module.exports = async function({project, configPathOverride, data}) {
|
|
141
141
|
const {promisify} = require("util");
|
|
142
142
|
const fs = require("fs");
|
|
143
143
|
const readFile = promisify(fs.readFile);
|
|
144
144
|
const writeFile = promisify(fs.writeFile);
|
|
145
145
|
|
|
146
|
-
|
|
146
|
+
let configPath;
|
|
147
|
+
if (configPathOverride) {
|
|
148
|
+
if (path.isAbsolute(configPathOverride)) {
|
|
149
|
+
configPath = configPathOverride;
|
|
150
|
+
} else {
|
|
151
|
+
configPath = path.join(project.getPath(), configPathOverride);
|
|
152
|
+
}
|
|
153
|
+
} else {
|
|
154
|
+
configPath = path.join(project.getPath(), "ui5.yaml");
|
|
155
|
+
}
|
|
156
|
+
|
|
147
157
|
const configFile = await readFile(configPath, {encoding: "utf8"});
|
|
148
158
|
|
|
149
159
|
let {
|
package/lib/framework/use.js
CHANGED
|
@@ -5,13 +5,10 @@ async function resolveVersion({frameworkName, frameworkVersion}, resolverOptions
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
function getEffectiveFrameworkName({project, frameworkOptions}) {
|
|
8
|
-
if (!project.
|
|
8
|
+
if (!project.getFrameworkName() && !frameworkOptions.name) {
|
|
9
9
|
throw new Error("No framework configuration defined. Make sure to also provide the framework name.");
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
// This should not happen as the configuration should have been validated against the schema
|
|
13
|
-
throw new Error(`Project ${project.metadata.name} does not define a framework name configuration`);
|
|
14
|
-
}
|
|
11
|
+
|
|
15
12
|
if (frameworkOptions.name) {
|
|
16
13
|
if (frameworkOptions.name.toLowerCase() === "openui5") {
|
|
17
14
|
return "OpenUI5";
|
|
@@ -21,17 +18,17 @@ function getEffectiveFrameworkName({project, frameworkOptions}) {
|
|
|
21
18
|
throw new Error("Invalid framework name: " + frameworkOptions.name);
|
|
22
19
|
}
|
|
23
20
|
} else {
|
|
24
|
-
return project.
|
|
21
|
+
return project.getFrameworkName();
|
|
25
22
|
}
|
|
26
23
|
}
|
|
27
24
|
|
|
28
|
-
module.exports = async function({
|
|
29
|
-
const project = await getRootProjectConfiguration(
|
|
25
|
+
module.exports = async function({projectGraphOptions, frameworkOptions}) {
|
|
26
|
+
const project = await getRootProjectConfiguration(projectGraphOptions);
|
|
30
27
|
|
|
31
|
-
if (!isValidSpecVersion(project.
|
|
28
|
+
if (!isValidSpecVersion(project.getSpecVersion())) {
|
|
32
29
|
throw new Error(
|
|
33
30
|
`ui5 use command requires specVersion "2.0" or higher. ` +
|
|
34
|
-
`Project ${project.
|
|
31
|
+
`Project ${project.getName()} uses specVersion "${project.getSpecVersion()}"`
|
|
35
32
|
);
|
|
36
33
|
}
|
|
37
34
|
|
|
@@ -39,13 +36,13 @@ module.exports = async function({normalizerOptions, frameworkOptions}) {
|
|
|
39
36
|
name: getEffectiveFrameworkName({project, frameworkOptions})
|
|
40
37
|
};
|
|
41
38
|
|
|
42
|
-
const frameworkVersion = frameworkOptions.version ||
|
|
39
|
+
const frameworkVersion = frameworkOptions.version || project.getFrameworkVersion();
|
|
43
40
|
if (frameworkVersion) {
|
|
44
41
|
framework.version = await resolveVersion({
|
|
45
42
|
frameworkName: framework.name,
|
|
46
43
|
frameworkVersion
|
|
47
44
|
}, {
|
|
48
|
-
cwd: project.
|
|
45
|
+
cwd: project.getPath()
|
|
49
46
|
});
|
|
50
47
|
}
|
|
51
48
|
|
|
@@ -54,6 +51,7 @@ module.exports = async function({normalizerOptions, frameworkOptions}) {
|
|
|
54
51
|
try {
|
|
55
52
|
await require("./updateYaml")({
|
|
56
53
|
project,
|
|
54
|
+
configPathOverride: projectGraphOptions.config,
|
|
57
55
|
data: {
|
|
58
56
|
framework: framework
|
|
59
57
|
}
|
package/lib/framework/utils.js
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
getRootProjectConfiguration: async function(
|
|
3
|
-
const {
|
|
2
|
+
getRootProjectConfiguration: async function(projectGraphOptions) {
|
|
3
|
+
const {generateProjectGraph} = require("@ui5/project");
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
let graph;
|
|
6
|
+
if (projectGraphOptions.dependencyDefinition) {
|
|
7
|
+
graph = await generateProjectGraph.usingStaticFile({
|
|
8
|
+
filePath: projectGraphOptions.dependencyDefinition,
|
|
9
|
+
resolveFrameworkDependencies: false
|
|
10
|
+
});
|
|
11
|
+
} else {
|
|
12
|
+
graph = await generateProjectGraph.usingNodePackageDependencies({
|
|
13
|
+
rootConfigPath: projectGraphOptions.config,
|
|
14
|
+
resolveFrameworkDependencies: false
|
|
15
|
+
});
|
|
9
16
|
}
|
|
10
17
|
|
|
11
|
-
|
|
12
|
-
tree.dependencies = [];
|
|
13
|
-
|
|
14
|
-
return projectPreprocessor.processTree(tree);
|
|
18
|
+
return graph.getRoot();
|
|
15
19
|
},
|
|
16
20
|
getFrameworkResolver: function(frameworkName) {
|
|
17
21
|
if (frameworkName === "SAPUI5") {
|