Skip to content

Commit

Permalink
[FEATURE] specVersion 2.3 (#388)
Browse files Browse the repository at this point in the history
- Adds libraryPreload/componentPreload excludes configuration

JIRA: CPOUI5FOUNDATION-233
  • Loading branch information
matz3 authored Feb 9, 2021
1 parent 933d8e9 commit 3e28026
Show file tree
Hide file tree
Showing 29 changed files with 883 additions and 364 deletions.
6 changes: 4 additions & 2 deletions lib/projectPreprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,8 @@ class ProjectPreprocessor {

if (project.specVersion !== "0.1" && project.specVersion !== "1.0" &&
project.specVersion !== "1.1" && project.specVersion !== "2.0" &&
project.specVersion !== "2.1" && project.specVersion !== "2.2") {
project.specVersion !== "2.1" && project.specVersion !== "2.2" &&
project.specVersion !== "2.3") {
throw new Error(
`Unsupported specification version ${project.specVersion} defined for project ` +
`${project.id}. Your UI5 CLI installation might be outdated. ` +
Expand Down Expand Up @@ -359,7 +360,8 @@ class ProjectPreprocessor {
extension.specVersion !== "1.1" &&
extension.specVersion !== "2.0" &&
extension.specVersion !== "2.1" &&
extension.specVersion !== "2.2") {
extension.specVersion !== "2.2" &&
extension.specVersion !== "2.3") {
throw new Error(
`Unsupported specification version ${extension.specVersion} defined for extension ` +
`${extension.metadata.name}. Your UI5 CLI installation might be outdated. ` +
Expand Down
12 changes: 9 additions & 3 deletions lib/translators/ui5Framework.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ const utils = {
if (!project.framework) {
return;
}
if (project.specVersion !== "2.0" && project.specVersion !== "2.1" && project.specVersion !== "2.2") {
if (
project.specVersion !== "2.0" && project.specVersion !== "2.1" &&
project.specVersion !== "2.2" && project.specVersion !== "2.3"
) {
log.warn(`Project ${project.metadata.name} defines invalid ` +
`specification version ${project.specVersion} for framework.libraries configuration`);
return;
Expand Down Expand Up @@ -241,8 +244,11 @@ module.exports = {
});
queue.push(...project.dependencies);

if ((project.specVersion === "2.0" || project.specVersion === "2.1" || project.specVersion === "2.2") &&
project.framework && project.framework.libraries) {
if (
(
project.specVersion === "2.0" || project.specVersion === "2.1" ||
project.specVersion === "2.2" || project.specVersion === "2.3"
) && project.framework && project.framework.libraries) {
const frameworkDeps = project.framework.libraries
.filter((dependency) => {
if (dependency.optional && frameworkLibs[dependency.name]) {
Expand Down
2 changes: 1 addition & 1 deletion lib/validation/schema/specVersion/2.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "object",
"required": ["specVersion"],
"properties": {
"specVersion": { "enum": ["2.2", "2.1", "2.0"] },
"specVersion": { "enum": ["2.3", "2.2", "2.1", "2.0"] },
"kind": {
"enum": ["project", "extension", null],
"$comment": "Using null to allow not defining 'kind' which defaults to project"
Expand Down
2 changes: 1 addition & 1 deletion lib/validation/schema/specVersion/2.0/kind/extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "object",
"required": ["specVersion", "kind", "type", "metadata"],
"properties": {
"specVersion": { "enum": ["2.2", "2.1", "2.0"] },
"specVersion": { "enum": ["2.3", "2.2", "2.1", "2.0"] },
"kind": {
"enum": ["extension"]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
"required": ["specVersion", "kind", "type", "metadata", "shims"],
"if": {
"properties": {
"specVersion": { "enum": ["2.1", "2.2"] }
"specVersion": { "enum": ["2.1", "2.2", "2.3"] }
}
},
"then": {
"additionalProperties": false,
"properties": {
"specVersion": {
"enum": ["2.1", "2.2"]
"enum": ["2.1", "2.2", "2.3"]
},
"kind": {
"enum": ["extension"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
"required": ["specVersion", "kind", "type", "metadata", "middleware"],
"if": {
"properties": {
"specVersion": { "enum": ["2.1", "2.2"] }
"specVersion": { "enum": ["2.1", "2.2", "2.3"] }
}
},
"then": {
"additionalProperties": false,
"properties": {
"specVersion": { "enum": ["2.1", "2.2"] },
"specVersion": { "enum": ["2.1", "2.2", "2.3"] },
"kind": {
"enum": ["extension"]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
"required": ["specVersion", "kind", "type", "metadata", "task"],
"if": {
"properties": {
"specVersion": { "enum": ["2.1", "2.2"] }
"specVersion": { "enum": ["2.1", "2.2", "2.3"] }
}
},
"then": {
"additionalProperties": false,
"properties": {
"specVersion": { "enum": ["2.1", "2.2"] },
"specVersion": { "enum": ["2.1", "2.2", "2.3"] },
"kind": {
"enum": ["extension"]
},
Expand Down
38 changes: 37 additions & 1 deletion lib/validation/schema/specVersion/2.0/kind/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "object",
"required": ["specVersion", "type"],
"properties": {
"specVersion": { "enum": ["2.2", "2.1", "2.0"] },
"specVersion": { "enum": ["2.3", "2.2", "2.1", "2.0"] },
"kind": {
"enum": ["project", null],
"$comment": "Using null to allow not defining 'kind' which defaults to project"
Expand Down Expand Up @@ -223,6 +223,42 @@
}
}
},
"builder-componentPreload-specVersion-2.3": {
"type": "object",
"additionalProperties": false,
"properties": {
"paths": {
"type": "array",
"items": {
"type": "string"
}
},
"namespaces": {
"type": "array",
"items": {
"type": "string"
}
},
"excludes": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"builder-libraryPreload": {
"type": "object",
"additionalProperties": false,
"properties": {
"excludes": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"server": {
"type": "object",
"additionalProperties": false,
Expand Down
117 changes: 91 additions & 26 deletions lib/validation/schema/specVersion/2.0/kind/project/application.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
"required": ["specVersion", "type", "metadata"],
"if": {
"properties": {
"specVersion": { "enum": ["2.1", "2.2"] }
"specVersion": { "enum": ["2.3"] }
}
},
"then": {
"additionalProperties": false,
"properties": {
"specVersion": { "enum": ["2.1", "2.2"] },
"specVersion": { "enum": ["2.3"] },
"kind": {
"enum": ["project", null]
},
Expand All @@ -29,7 +29,7 @@
"$ref": "#/definitions/resources"
},
"builder": {
"$ref": "#/definitions/builder"
"$ref": "#/definitions/builder-specVersion-2.3"
},
"server": {
"$ref": "../project.json#/definitions/server"
Expand All @@ -41,29 +41,67 @@
}
},
"else": {
"additionalProperties": false,
"properties": {
"specVersion": { "enum": ["2.0"] },
"kind": {
"enum": ["project", null]
},
"type": {
"enum": ["application"]
},
"metadata": {
"$ref": "../project.json#/definitions/metadata"
},
"framework": {
"$ref": "../project.json#/definitions/framework"
},
"resources": {
"$ref": "#/definitions/resources"
},
"builder": {
"$ref": "#/definitions/builder"
},
"server": {
"$ref": "../project.json#/definitions/server"
"if": {
"properties": {
"specVersion": { "enum": ["2.1", "2.2"] }
}
},
"then": {
"additionalProperties": false,
"properties": {
"specVersion": { "enum": ["2.1", "2.2"] },
"kind": {
"enum": ["project", null]
},
"type": {
"enum": ["application"]
},
"metadata": {
"$ref": "../project.json#/definitions/metadata"
},
"framework": {
"$ref": "../project.json#/definitions/framework"
},
"resources": {
"$ref": "#/definitions/resources"
},
"builder": {
"$ref": "#/definitions/builder"
},
"server": {
"$ref": "../project.json#/definitions/server"
},
"customConfiguration": {
"type": "object",
"additionalProperties": true
}
}
},
"else": {
"additionalProperties": false,
"properties": {
"specVersion": { "enum": ["2.0"] },
"kind": {
"enum": ["project", null]
},
"type": {
"enum": ["application"]
},
"metadata": {
"$ref": "../project.json#/definitions/metadata"
},
"framework": {
"$ref": "../project.json#/definitions/framework"
},
"resources": {
"$ref": "#/definitions/resources"
},
"builder": {
"$ref": "#/definitions/builder"
},
"server": {
"$ref": "../project.json#/definitions/server"
}
}
}
},
Expand Down Expand Up @@ -121,6 +159,33 @@
"$ref": "../project.json#/definitions/customTasks"
}
}
},
"builder-specVersion-2.3": {
"type": "object",
"additionalProperties": false,
"properties": {
"resources": {
"$ref": "../project.json#/definitions/builder-resources"
},
"cachebuster": {
"type": "object",
"additionalProperties": false,
"properties": {
"signatureType": {
"enum": ["time", "hash"]
}
}
},
"bundles": {
"$ref": "../project.json#/definitions/builder-bundles"
},
"componentPreload": {
"$ref": "../project.json#/definitions/builder-componentPreload-specVersion-2.3"
},
"customTasks": {
"$ref": "../project.json#/definitions/customTasks"
}
}
}
}
}
Loading

0 comments on commit 3e28026

Please sign in to comment.