generator-easy-ui5 2.4.6 → 3.1.0
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 +13 -0
- package/README.md +66 -168
- package/generators/app/index.js +392 -171
- package/generators/app/postinstall.js +121 -0
- package/package.json +23 -18
- package/generators/additionalmodules/index.js +0 -222
- package/generators/additionalmodules/templates/approuter/package.json +0 -13
- package/generators/additionalmodules/templates/deployer/readme.md +0 -3
- package/generators/additionalmodules/templates/xs-security.json +0 -20
- package/generators/app/templates/_.editorconfig +0 -8
- package/generators/app/templates/_.eslintignore +0 -4
- package/generators/app/templates/_.eslintrc +0 -48
- package/generators/app/templates/_.gitignore +0 -11
- package/generators/app/templates/karma-ci.conf.js +0 -21
- package/generators/app/templates/karma.conf.js +0 -17
- package/generators/app/templates/readme.md +0 -6
- package/generators/newcomponent/index.js +0 -82
- package/generators/newcontrol/index.js +0 -81
- package/generators/newcontrol/templates/webapp/control/template.js +0 -23
- package/generators/newmodel/index.js +0 -142
- package/generators/newopa5journey/index.js +0 -99
- package/generators/newopa5journey/templates/test/integration/$journey.js +0 -23
- package/generators/newopa5po/index.js +0 -107
- package/generators/newopa5po/templates/test/integration/pages/$poFile.js +0 -43
- package/generators/newuiveri5po/index.js +0 -84
- package/generators/newuiveri5po/templates/pages/$poFile.js +0 -20
- package/generators/newuiveri5spec/index.js +0 -51
- package/generators/newuiveri5spec/templates/$specName.spec.js +0 -22
- package/generators/newview/index.js +0 -156
- package/generators/newview/templates/webapp/controller/$ViewName.controller.js +0 -7
- package/generators/newview/templates/webapp/view/$ViewName.view.$ViewEnding +0 -51
- package/generators/newwebapp/index.js +0 -239
- package/generators/newwebapp/templates/uimodule/ui5.yaml +0 -73
- package/generators/newwebapp/templates/uimodule/webapp/Component.js +0 -30
- package/generators/newwebapp/templates/uimodule/webapp/controller/BaseController.js +0 -70
- package/generators/newwebapp/templates/uimodule/webapp/css/style.css +0 -1
- package/generators/newwebapp/templates/uimodule/webapp/flpSandbox.html +0 -66
- package/generators/newwebapp/templates/uimodule/webapp/i18n/i18n.properties +0 -3
- package/generators/newwebapp/templates/uimodule/webapp/i18n/i18n_en.properties +0 -3
- package/generators/newwebapp/templates/uimodule/webapp/index.html +0 -29
- package/generators/newwebapp/templates/uimodule/webapp/manifest.json +0 -92
- package/generators/newwebapp/templates/uimodule/webapp/model/formatter.js +0 -4
- package/generators/newwebapp/templates/uimodule/webapp/model/models.js +0 -14
- package/generators/newwebapp/templates/uimodule/webapp/resources/img/favicon.ico +0 -0
- package/generators/newwebapp/templates/uimodule/webapp/xs-app.json +0 -11
- package/generators/opa5/index.js +0 -114
- package/generators/opa5/templates/test/integration/AllJourneys.js +0 -13
- package/generators/opa5/templates/test/integration/arrangements/Startup.js +0 -19
- package/generators/opa5/templates/test/integration/opaTests.qunit.html +0 -32
- package/generators/opa5/templates/test/integration/opaTests.qunit.js +0 -13
- package/generators/opa5/templates/test/testsuite.qunit.html +0 -10
- package/generators/opa5/templates/test/testsuite.qunit.js +0 -10
- package/generators/uiveri5/index.js +0 -144
- package/generators/uiveri5/templates/.gitignore +0 -2
- package/generators/uiveri5/templates/README.md +0 -11
- package/generators/uiveri5/templates/conf.js +0 -16
- package/generators/wdi5/index.js +0 -96
- package/generators/wdi5/templates/.gitignore +0 -1
- package/generators/wdi5/templates/README-wdi5.md +0 -39
- package/generators/wdi5/templates/basic.test.js +0 -17
- package/generators/wdi5/templates/wdio-wdi5.conf.js +0 -282
- package/helpers/fileaccess.js +0 -90
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<% function upperFirst (str) { return str.charAt(0).toUpperCase() + str.substr(1);} %><% Object.keys(uiveri5pos).forEach(function (poFile) { %>require("./pages/<%= poFile %>");
|
|
2
|
-
<% }) %>
|
|
3
|
-
describe("<%= suiteName %>", function () {
|
|
4
|
-
|
|
5
|
-
it("<%= specName %>", function () {
|
|
6
|
-
// add actions and assertions here
|
|
7
|
-
|
|
8
|
-
expect(true).toBeTruthy();
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
<% Object.keys(uiveri5pos).forEach(function (poFile) { %>it("should see the <%= upperFirst(poFile) %> page", function () {
|
|
12
|
-
// call the page object's actions and assertions:
|
|
13
|
-
// When.onThe<%= upperFirst(poFile) %>Page.iDoSomething();
|
|
14
|
-
// Then.onThe<%= upperFirst(poFile) %>Page.iAssertSomething();<% if (uiveri5pos[poFile].action) { %>
|
|
15
|
-
|
|
16
|
-
When.onThe<%= upperFirst(poFile) %>Page.<%= uiveri5pos[poFile].action %>();<% } %><% if (uiveri5pos[poFile].assertion) { %>
|
|
17
|
-
Then.onThe<%= upperFirst(poFile) %>Page.<%= uiveri5pos[poFile].assertion %>();<% } %>
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
<% }) %>
|
|
21
|
-
|
|
22
|
-
});
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
const Generator = require("yeoman-generator"),
|
|
2
|
-
fileaccess = require("../../helpers/fileaccess");
|
|
3
|
-
|
|
4
|
-
module.exports = class extends Generator {
|
|
5
|
-
|
|
6
|
-
prompting() {
|
|
7
|
-
if (this.options.isSubgeneratorCall) {
|
|
8
|
-
this.destinationRoot(this.options.cwd);
|
|
9
|
-
this.options.oneTimeConfig = this.config.getAll();
|
|
10
|
-
this.options.oneTimeConfig.modulename = this.options.modulename;
|
|
11
|
-
this.options.oneTimeConfig.viewname = this.options.viewname;
|
|
12
|
-
|
|
13
|
-
this.options.oneTimeConfig.appId = this.options.oneTimeConfig.namespace + "." + (this.options.modulename === "uimodule" ? this.options.oneTimeConfig.projectname : this.options.modulename);
|
|
14
|
-
this.options.oneTimeConfig.appURI = this.options.oneTimeConfig.namespaceURI + "/" + (this.options.modulename === "uimodule" ? this.options.oneTimeConfig.projectname : this.options.modulename);
|
|
15
|
-
return [];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const modules = this.config.get("uimodules");
|
|
19
|
-
var aPrompt = [{
|
|
20
|
-
type: "list",
|
|
21
|
-
name: "modulename",
|
|
22
|
-
message: "To which module do you want to add a view?",
|
|
23
|
-
choices: modules || [],
|
|
24
|
-
when: modules && modules.length > 1
|
|
25
|
-
}, {
|
|
26
|
-
type: "input",
|
|
27
|
-
name: "viewname",
|
|
28
|
-
message: "What is the name of the new view?",
|
|
29
|
-
validate: (s) => {
|
|
30
|
-
if (/^\d*[a-zA-Z][a-zA-Z0-9]*$/g.test(s)) {
|
|
31
|
-
return true;
|
|
32
|
-
}
|
|
33
|
-
return "Please use alpha numeric characters only for the view name.";
|
|
34
|
-
}
|
|
35
|
-
}, {
|
|
36
|
-
type: "confirm",
|
|
37
|
-
name: "createcontroller",
|
|
38
|
-
message: "Would you like to create a corresponding controller as well?"
|
|
39
|
-
}, {
|
|
40
|
-
type: "confirm",
|
|
41
|
-
name: "addPO",
|
|
42
|
-
message: "Do you want to add an OPA5 page object?",
|
|
43
|
-
default: false
|
|
44
|
-
}];
|
|
45
|
-
|
|
46
|
-
if (!this.config.getAll().viewtype) {
|
|
47
|
-
aPrompt = aPrompt.concat([{
|
|
48
|
-
type: "input",
|
|
49
|
-
name: "projectname",
|
|
50
|
-
message: "Seems like this project has not been generated with Easy-UI5. Please enter the name your project.",
|
|
51
|
-
validate: (s) => {
|
|
52
|
-
if (/^\d*[a-zA-Z][a-zA-Z0-9]*$/g.test(s)) {
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
return "Please use alpha numeric characters only for the project name.";
|
|
56
|
-
},
|
|
57
|
-
default: "myUI5App"
|
|
58
|
-
}, {
|
|
59
|
-
type: "input",
|
|
60
|
-
name: "namespace",
|
|
61
|
-
message: "Please enter the namespace you use currently",
|
|
62
|
-
validate: (s) => {
|
|
63
|
-
if (/^[a-zA-Z0-9_\.]*$/g.test(s)) {
|
|
64
|
-
return true;
|
|
65
|
-
}
|
|
66
|
-
return "Please use alpha numeric characters and dots only for the namespace.";
|
|
67
|
-
},
|
|
68
|
-
default: "com.myorg"
|
|
69
|
-
}, {
|
|
70
|
-
type: "list",
|
|
71
|
-
name: "viewtype",
|
|
72
|
-
message: "Which view type do you use?",
|
|
73
|
-
choices: ["XML", "JSON", "JS", "HTML"],
|
|
74
|
-
default: "XML"
|
|
75
|
-
}]);
|
|
76
|
-
}
|
|
77
|
-
aPrompt = aPrompt.concat([{
|
|
78
|
-
type: "confirm",
|
|
79
|
-
name: "addToRoute",
|
|
80
|
-
message: "Would you like to create a route in the manifest?"
|
|
81
|
-
}]);
|
|
82
|
-
return this.prompt(aPrompt).then((answers) => {
|
|
83
|
-
this.options.oneTimeConfig = this.config.getAll();
|
|
84
|
-
this.options.oneTimeConfig.viewname = answers.viewname;
|
|
85
|
-
this.options.oneTimeConfig.createcontroller = answers.createcontroller;
|
|
86
|
-
this.options.oneTimeConfig.addToRoute = answers.addToRoute;
|
|
87
|
-
this.options.oneTimeConfig.modulename = answers.modulename || modules[0];
|
|
88
|
-
|
|
89
|
-
if (answers.projectname) {
|
|
90
|
-
this.options.oneTimeConfig.projectname = answers.projectname;
|
|
91
|
-
this.options.oneTimeConfig.namespace = answers.namespace;
|
|
92
|
-
this.options.oneTimeConfig.viewtype = answers.viewtype;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
this.options.oneTimeConfig.appId = this.options.oneTimeConfig.namespace + "." + (this.options.oneTimeConfig.modulename === "uimodule" ? this.options.oneTimeConfig.projectname : answers.modulename);
|
|
96
|
-
this.options.oneTimeConfig.appURI = this.options.oneTimeConfig.namespaceURI + "/" + (this.options.oneTimeConfig.modulename === "uimodule" ? this.options.oneTimeConfig.projectname : answers.modulename);
|
|
97
|
-
|
|
98
|
-
if (this.options.oneTimeConfig.addPO) {
|
|
99
|
-
this.composeWith(require.resolve("../newopa5po"), Object.assign({}, this.options.oneTimeConfig, {
|
|
100
|
-
isSubgeneratorCall: true
|
|
101
|
-
}));
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
async writing() {
|
|
107
|
-
const sViewFileName = "webapp/view/$ViewName.view.$ViewEnding";
|
|
108
|
-
const sControllerFileName = "webapp/controller/$ViewName.controller.js";
|
|
109
|
-
const sViewType = this.options.oneTimeConfig.viewtype;
|
|
110
|
-
const sViewName = this.options.oneTimeConfig.viewname;
|
|
111
|
-
const sModuleName = this.options.oneTimeConfig.modulename;
|
|
112
|
-
this.options.oneTimeConfig.isSubgeneratorCall = this.options.isSubgeneratorCall;
|
|
113
|
-
|
|
114
|
-
const bBaseControllerExists = this.fs.exists(sModuleName + "/webapp/controller/BaseController.js");
|
|
115
|
-
var sControllerToExtend = "sap/ui/core/mvc/Controller";
|
|
116
|
-
if (bBaseControllerExists) {
|
|
117
|
-
sControllerToExtend = this.options.oneTimeConfig.appURI + "/controller/BaseController";
|
|
118
|
-
}
|
|
119
|
-
this.options.oneTimeConfig.controllerToExtend = sControllerToExtend;
|
|
120
|
-
|
|
121
|
-
var sOrigin = this.templatePath(sViewFileName);
|
|
122
|
-
var sTarget = this.destinationPath(sModuleName + "/" + sViewFileName.replace(/\$ViewEnding/, sViewType.toLowerCase()).replace(/\$ViewName/, sViewName));
|
|
123
|
-
this.fs.copyTpl(sOrigin, sTarget, this.options.oneTimeConfig);
|
|
124
|
-
|
|
125
|
-
if (this.options.oneTimeConfig.createcontroller || this.options.isSubgeneratorCall) {
|
|
126
|
-
sOrigin = this.templatePath(sControllerFileName);
|
|
127
|
-
sTarget = this.destinationPath(sModuleName + "/" + sControllerFileName.replace(/\$ViewEnding/, sViewType.toLowerCase()).replace(/\$ViewName/, sViewName));
|
|
128
|
-
this.fs.copyTpl(sOrigin, sTarget, this.options.oneTimeConfig);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (this.options.isSubgeneratorCall) {
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
if (this.options.oneTimeConfig.addToRoute) {
|
|
136
|
-
await fileaccess.manipulateJSON.call(this, "/" + sModuleName + "/webapp/manifest.json", function (json) {
|
|
137
|
-
const ui5Config = json["sap.ui5"];
|
|
138
|
-
const targetName = "Target" + sViewName;
|
|
139
|
-
|
|
140
|
-
ui5Config.routing.routes.push({
|
|
141
|
-
name: sViewName,
|
|
142
|
-
pattern: "Route" + sViewName,
|
|
143
|
-
target: [targetName]
|
|
144
|
-
});
|
|
145
|
-
ui5Config.routing.targets[targetName] = {
|
|
146
|
-
viewType: sViewType,
|
|
147
|
-
viewId: sViewName,
|
|
148
|
-
viewName: sViewName
|
|
149
|
-
};
|
|
150
|
-
return json;
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
this.log("Created a new view.");
|
|
155
|
-
}
|
|
156
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
<% if (viewtype === 'XML') { %> <mvc:View controllerName="<%=appId%>.controller.<%=viewname%>"
|
|
2
|
-
displayBlock="true"
|
|
3
|
-
xmlns="sap.m"
|
|
4
|
-
xmlns:mvc="sap.ui.core.mvc">
|
|
5
|
-
<App id="<%= isSubgeneratorCall ? 'idAppControl' : viewname %>" >
|
|
6
|
-
<pages>
|
|
7
|
-
<Page title="{i18n>title}">
|
|
8
|
-
<content></content>
|
|
9
|
-
</Page>
|
|
10
|
-
</pages>
|
|
11
|
-
</App>
|
|
12
|
-
</mvc:View><% } if (viewtype === 'HTML') { -%>
|
|
13
|
-
<template data-controller-name="<%=appId%>.controller.<%=viewname%>">
|
|
14
|
-
<div data-sap-ui-type="sap.m.App" id="<%= isSubgeneratorCall ? 'idAppControl' : viewname %>" >
|
|
15
|
-
<div data-sap-ui-type="sap.m.Page" data-title="{i18n>title}">
|
|
16
|
-
<div data-sap-ui-aggregation="content">
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
</template><% } if (viewtype === 'JSON') { -%>
|
|
21
|
-
{
|
|
22
|
-
"Type": "sap.ui.core.mvc.JSONView",
|
|
23
|
-
"controllerName": "<%=appId%>.controller.<%=viewname%>",
|
|
24
|
-
"content": [{
|
|
25
|
-
"Type": "sap.m.App",
|
|
26
|
-
"id": "<%= isSubgeneratorCall ? 'idAppControl' : viewname %>",
|
|
27
|
-
"pages": [{
|
|
28
|
-
"Type": "sap.m.Page",
|
|
29
|
-
"title": "{i18n>title}",
|
|
30
|
-
"content": []
|
|
31
|
-
}]
|
|
32
|
-
}]
|
|
33
|
-
}<% } if (viewtype === 'JS') { -%>
|
|
34
|
-
sap.ui.define([ ], function() {
|
|
35
|
-
"use strict";
|
|
36
|
-
sap.ui.jsview("<%=appId%>.view.<%=viewname%>", {
|
|
37
|
-
|
|
38
|
-
getControllerName: function () {
|
|
39
|
-
return "<%=appId%>.controller.<%=viewname%>";
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
createContent: function () {
|
|
43
|
-
return new sap.m.App(this.createId("<%= isSubgeneratorCall ? 'idAppControl' : viewname %>"), {
|
|
44
|
-
pages: new sap.m.Page({
|
|
45
|
-
title: "{i18n>title}",
|
|
46
|
-
content: []
|
|
47
|
-
})
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
});<% } -%>
|
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
const Generator = require("yeoman-generator"),
|
|
2
|
-
fileaccess = require("../../helpers/fileaccess"),
|
|
3
|
-
path = require("path"),
|
|
4
|
-
glob = require("glob");
|
|
5
|
-
|
|
6
|
-
module.exports = class extends Generator {
|
|
7
|
-
|
|
8
|
-
prompting() {
|
|
9
|
-
if (this.options.isSubgeneratorCall) {
|
|
10
|
-
return this.prompt([{
|
|
11
|
-
type: "input",
|
|
12
|
-
name: "tilename",
|
|
13
|
-
message: "What name should be displayed on the Fiori Launchpad tile?",
|
|
14
|
-
default: "Fiori App",
|
|
15
|
-
when: this.options.platform === "SAP Launchpad service"
|
|
16
|
-
}]).then((answers) => {
|
|
17
|
-
this.destinationRoot(this.options.cwd);
|
|
18
|
-
this.options.oneTimeConfig = this.config.getAll();
|
|
19
|
-
this.options.oneTimeConfig.modulename = this.options.modulename;
|
|
20
|
-
this.options.oneTimeConfig.tilename = answers.tilename;
|
|
21
|
-
|
|
22
|
-
this.options.oneTimeConfig.appId = this.options.oneTimeConfig.namespace + "." + (this.options.modulename === "uimodule" ? this.options.oneTimeConfig.projectname : this.options.modulename);
|
|
23
|
-
this.options.oneTimeConfig.appURI = this.options.oneTimeConfig.namespaceURI + "/" + (this.options.modulename === "uimodule" ? this.options.oneTimeConfig.projectname : this.options.modulename);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
var aPrompt = [{
|
|
28
|
-
type: "input",
|
|
29
|
-
name: "modulename",
|
|
30
|
-
message: "What is the name the module?",
|
|
31
|
-
validate: (s) => {
|
|
32
|
-
if (/^\d*[a-zA-Z][a-zA-Z0-9]*$/g.test(s)) {
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
return "Please use alpha numeric characters only for the module name.";
|
|
36
|
-
}
|
|
37
|
-
}, {
|
|
38
|
-
type: "input",
|
|
39
|
-
name: "viewname",
|
|
40
|
-
message: "What is the name of the new view?",
|
|
41
|
-
validate: (s) => {
|
|
42
|
-
if (/^\d*[a-zA-Z][a-zA-Z0-9]*$/g.test(s)) {
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
45
|
-
return "Please use alpha numeric characters only for the view name.";
|
|
46
|
-
},
|
|
47
|
-
default: "MainView"
|
|
48
|
-
}, {
|
|
49
|
-
type: "input",
|
|
50
|
-
name: "tilename",
|
|
51
|
-
message: "What name should be displayed on the Fiori Launchpad tile?",
|
|
52
|
-
default: "Fiori App",
|
|
53
|
-
when: this.config.get("platform") === "SAP Launchpad service"
|
|
54
|
-
}, {
|
|
55
|
-
type: "confirm",
|
|
56
|
-
name: "addOPA5",
|
|
57
|
-
message: "Do you want to add OPA5 tests?",
|
|
58
|
-
default: true
|
|
59
|
-
}];
|
|
60
|
-
|
|
61
|
-
if (!this.config.getAll().viewtype) {
|
|
62
|
-
aPrompt = aPrompt.concat([{
|
|
63
|
-
type: "input",
|
|
64
|
-
name: "projectname",
|
|
65
|
-
message: "Seems like this project has not been generated with Easy-UI5. Please enter the name your project.",
|
|
66
|
-
validate: (s) => {
|
|
67
|
-
if (/^\d*[a-zA-Z][a-zA-Z0-9]*$/g.test(s)) {
|
|
68
|
-
return true;
|
|
69
|
-
}
|
|
70
|
-
return "Please use alpha numeric characters only for the project name.";
|
|
71
|
-
},
|
|
72
|
-
default: "myUI5App"
|
|
73
|
-
}, {
|
|
74
|
-
type: "input",
|
|
75
|
-
name: "namespace",
|
|
76
|
-
message: "Please enter the namespace you use currently",
|
|
77
|
-
validate: (s) => {
|
|
78
|
-
if (/^[a-zA-Z0-9_\.]*$/g.test(s)) {
|
|
79
|
-
return true;
|
|
80
|
-
}
|
|
81
|
-
return "Please use alpha numeric characters and dots only for the namespace.";
|
|
82
|
-
},
|
|
83
|
-
default: "com.myorg"
|
|
84
|
-
}, {
|
|
85
|
-
type: "list",
|
|
86
|
-
name: "viewtype",
|
|
87
|
-
message: "Which view type do you use?",
|
|
88
|
-
choices: ["XML", "JSON", "JS", "HTML"],
|
|
89
|
-
default: "XML"
|
|
90
|
-
}]);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
return this.prompt(aPrompt).then((answers) => {
|
|
95
|
-
|
|
96
|
-
this.options.oneTimeConfig = this.config.getAll();
|
|
97
|
-
this.options.oneTimeConfig.viewname = answers.viewname;
|
|
98
|
-
this.options.oneTimeConfig.modulename = answers.modulename;
|
|
99
|
-
this.options.oneTimeConfig.tilename = answers.tilename;
|
|
100
|
-
|
|
101
|
-
if (answers.projectname) {
|
|
102
|
-
this.options.oneTimeConfig.projectname = answers.projectname;
|
|
103
|
-
this.options.oneTimeConfig.namespace = answers.namespace;
|
|
104
|
-
this.options.oneTimeConfig.namespaceURI = answers.namespace.split(".").join("/");
|
|
105
|
-
this.options.oneTimeConfig.viewtype = answers.viewtype;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
this.options.oneTimeConfig.appId = this.options.oneTimeConfig.namespace + "." + (answers.modulename === "uimodule" ? this.options.oneTimeConfig.projectname : answers.modulename);
|
|
109
|
-
this.options.oneTimeConfig.appURI = this.options.oneTimeConfig.namespaceURI + "/" + (answers.modulename === "uimodule" ? this.options.oneTimeConfig.projectname : answers.modulename);
|
|
110
|
-
|
|
111
|
-
if (answers.addOPA5) {
|
|
112
|
-
this.composeWith(require.resolve("../opa5"), Object.assign({}, this.options.oneTimeConfig, {
|
|
113
|
-
isSubgeneratorCall: true,
|
|
114
|
-
namespaceInput: this.options.oneTimeConfig.namespace
|
|
115
|
-
}));
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
async writing() {
|
|
121
|
-
const sModuleName = this.options.oneTimeConfig.modulename;
|
|
122
|
-
const localResources = (this.options.oneTimeConfig.ui5libs === "Local resources (OpenUI5)" || this.options.oneTimeConfig.ui5libs === "Local resources (SAPUI5)");
|
|
123
|
-
const platformIsAppRouter = this.options.oneTimeConfig.platform.includes("Application Router");
|
|
124
|
-
const netweaver = this.options.oneTimeConfig.platform.includes("SAP NetWeaver");
|
|
125
|
-
|
|
126
|
-
// Write files in new module folder
|
|
127
|
-
this.sourceRoot(path.join(__dirname, "templates"));
|
|
128
|
-
glob.sync("**", {
|
|
129
|
-
cwd: this.sourceRoot(),
|
|
130
|
-
nodir: true
|
|
131
|
-
}).forEach((file) => {
|
|
132
|
-
const sOrigin = this.templatePath(file);
|
|
133
|
-
const sTarget = this.destinationPath(file.replace("uimodule", sModuleName).replace(/\/_/, "/"));
|
|
134
|
-
|
|
135
|
-
const isUnneededFlpSandbox = sTarget.includes("flpSandbox") && this.options.oneTimeConfig.platform !== "SAP Launchpad service";
|
|
136
|
-
const isUnneededXsApp = sTarget.includes("xs-app") && !(this.options.oneTimeConfig.platform === "SAP Launchpad service" || this.options.oneTimeConfig.platform === "SAP HTML5 Application Repository service for SAP BTP");
|
|
137
|
-
|
|
138
|
-
if (isUnneededXsApp || isUnneededFlpSandbox) {
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
this.fs.copyTpl(sOrigin, sTarget, this.options.oneTimeConfig);
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
if (this.options.oneTimeConfig.platform.includes("Application Router")) {
|
|
146
|
-
await fileaccess.manipulateJSON.call(this, "/approuter/xs-app.json", {
|
|
147
|
-
"routes": [{
|
|
148
|
-
"source": "^/" + sModuleName + "/(.*)$",
|
|
149
|
-
"target": "$1",
|
|
150
|
-
"authenticationType": "none",
|
|
151
|
-
"localDir": sModuleName + "/webapp"
|
|
152
|
-
}]
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
if (this.options.oneTimeConfig.platform === "SAP HTML5 Application Repository service for SAP BTP" || this.options.oneTimeConfig.platform === "SAP Launchpad service") {
|
|
158
|
-
if (this.options.oneTimeConfig.platform === "SAP Launchpad service") {
|
|
159
|
-
await fileaccess.manipulateJSON.call(this, "/" + sModuleName + "/webapp/manifest.json", {
|
|
160
|
-
["sap.cloud"]: {
|
|
161
|
-
"service": this.options.oneTimeConfig.projectname + ".service"
|
|
162
|
-
},
|
|
163
|
-
["sap.app"]: {
|
|
164
|
-
crossNavigation: {
|
|
165
|
-
inbounds: {
|
|
166
|
-
intent1: {
|
|
167
|
-
"signature": {
|
|
168
|
-
"parameters": {},
|
|
169
|
-
"additionalParameters": "allowed"
|
|
170
|
-
},
|
|
171
|
-
"semanticObject": sModuleName,
|
|
172
|
-
"action": "display",
|
|
173
|
-
"title": this.options.oneTimeConfig.tilename,
|
|
174
|
-
"icon": "sap-icon://add"
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// Append to master package.json
|
|
184
|
-
await fileaccess.manipulateJSON.call(this, "/package.json", function (packge) {
|
|
185
|
-
packge.scripts["serve:" + sModuleName] = "ui5 serve --config=" + sModuleName + "/ui5.yaml";
|
|
186
|
-
packge.scripts["build:ui"] += " build:" + sModuleName;
|
|
187
|
-
let buildCommand = "ui5 build --config=" + sModuleName + "/ui5.yaml --clean-dest";
|
|
188
|
-
if (localResources) {
|
|
189
|
-
buildCommand += " --a";
|
|
190
|
-
}
|
|
191
|
-
if (platformIsAppRouter) {
|
|
192
|
-
buildCommand += ` --dest approuter/${sModuleName}/webapp`;
|
|
193
|
-
} else if (!netweaver) {
|
|
194
|
-
buildCommand += ` --dest ${sModuleName}/dist`;
|
|
195
|
-
buildCommand += " --include-task=generateManifestBundle";
|
|
196
|
-
} else {
|
|
197
|
-
buildCommand += " --dest dist/" + sModuleName;
|
|
198
|
-
}
|
|
199
|
-
packge.scripts["build:" + sModuleName] = buildCommand;
|
|
200
|
-
return packge;
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
if (this.options.oneTimeConfig.platform === "SAP HTML5 Application Repository service for SAP BTP" || this.options.oneTimeConfig.platform === "SAP Launchpad service") {
|
|
204
|
-
await fileaccess.writeYAML.call(this, "/mta.yaml", (mta) => {
|
|
205
|
-
|
|
206
|
-
const deployer = mta.modules.find((module) => module.name === "webapp_deployer");
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
deployer["build-parameters"]["requires"].push({
|
|
210
|
-
name: sModuleName,
|
|
211
|
-
artifacts: [`dist/${sModuleName}.zip`],
|
|
212
|
-
["target-path"]: "resources/"
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
mta.modules.push({
|
|
216
|
-
"name": sModuleName,
|
|
217
|
-
"type": "html5",
|
|
218
|
-
"path": sModuleName,
|
|
219
|
-
"build-parameters": {
|
|
220
|
-
"builder": "custom",
|
|
221
|
-
"commands": [`npm run build:${sModuleName} --prefix ..`],
|
|
222
|
-
"supported-platforms": []
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
return mta;
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
const oSubGen = Object.assign({}, this.options.oneTimeConfig);
|
|
231
|
-
oSubGen.isSubgeneratorCall = true;
|
|
232
|
-
oSubGen.cwd = this.destinationRoot();
|
|
233
|
-
this.composeWith(require.resolve("../newview"), oSubGen);
|
|
234
|
-
|
|
235
|
-
const modules = this.config.get("uimodules") || [];
|
|
236
|
-
modules.push(this.options.oneTimeConfig.modulename);
|
|
237
|
-
this.config.set("uimodules", modules);
|
|
238
|
-
}
|
|
239
|
-
};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
specVersion: "2.2"
|
|
2
|
-
metadata:
|
|
3
|
-
name: <%= projectname %>_<%= modulename %>
|
|
4
|
-
type: application
|
|
5
|
-
resources:
|
|
6
|
-
configuration:
|
|
7
|
-
paths:
|
|
8
|
-
webapp: <%= modulename %>/webapp
|
|
9
|
-
framework:
|
|
10
|
-
name: <%= (ui5libs === "Local resources (OpenUI5)" || ui5libs === "Content delivery network (OpenUI5)") ? "OpenUI5" : "SAPUI5" %>
|
|
11
|
-
version: 1.84.0
|
|
12
|
-
libraries:
|
|
13
|
-
- name: sap.ui.core
|
|
14
|
-
- name: sap.m
|
|
15
|
-
- name: sap.ui.layout
|
|
16
|
-
- name: themelib_sap_fiori_3
|
|
17
|
-
server:
|
|
18
|
-
customMiddleware:
|
|
19
|
-
- name: ui5-middleware-livereload
|
|
20
|
-
afterMiddleware: compression
|
|
21
|
-
configuration:
|
|
22
|
-
port: 35729
|
|
23
|
-
path: <%= modulename %>/webapp
|
|
24
|
-
<% if(platform !== 'Static webserver' && platform !== 'SAP NetWeaver'){ -%>
|
|
25
|
-
- name: ui5-middleware-cfdestination
|
|
26
|
-
afterMiddleware: compression
|
|
27
|
-
configuration:
|
|
28
|
-
debug: true
|
|
29
|
-
port: 1091
|
|
30
|
-
xsappJson: <%= platform.includes("Application Router") ? "approuter/xs-app.json" : modulename+"/webapp/xs-app.json" %>
|
|
31
|
-
destinations: []
|
|
32
|
-
<% if(platform === 'SAP HTML5 Application Repository service for SAP BTP' || platform === 'SAP Launchpad service'){ -%>
|
|
33
|
-
builder:
|
|
34
|
-
customTasks:
|
|
35
|
-
- name: ui5-task-zipper
|
|
36
|
-
afterTask: uglify
|
|
37
|
-
configuration:
|
|
38
|
-
includeDependencies: <%= (ui5libs === "Local resources (OpenUI5)" || ui5libs === "Local resources (SAPUI5)") %>
|
|
39
|
-
archiveName: <%=modulename%>
|
|
40
|
-
<% } -%>
|
|
41
|
-
<% } -%>
|
|
42
|
-
<% if(platform === 'SAP NetWeaver'){ -%>
|
|
43
|
-
- name: ui5-middleware-route-proxy
|
|
44
|
-
afterMiddleware: compression
|
|
45
|
-
configuration:
|
|
46
|
-
debug: false
|
|
47
|
-
/sap/opu/odata/sap/:
|
|
48
|
-
target: http://<yourserver>:<yourserverport>
|
|
49
|
-
auth:
|
|
50
|
-
fromEnv: false
|
|
51
|
-
user: <youruser>
|
|
52
|
-
pass: <yourpassword>
|
|
53
|
-
builder:
|
|
54
|
-
customTasks:
|
|
55
|
-
- name: ui5-task-nwabap-deployer
|
|
56
|
-
afterTask: generateVersionInfo
|
|
57
|
-
configuration:
|
|
58
|
-
resources:
|
|
59
|
-
path: dist/<%= modulename %>
|
|
60
|
-
pattern: "**/*.*"
|
|
61
|
-
connection:
|
|
62
|
-
server: http://<yourserver>:<yourserverport>
|
|
63
|
-
authentication:
|
|
64
|
-
user: <youruser>
|
|
65
|
-
password: <yourpassword>
|
|
66
|
-
ui5:
|
|
67
|
-
language: EN
|
|
68
|
-
package: <yourpackage>
|
|
69
|
-
bspContainer: <yourbspapplication>
|
|
70
|
-
bspContainerText: Generated with easy-ui5
|
|
71
|
-
transportNo: <yourtransport>
|
|
72
|
-
calculateApplicationIndex: true
|
|
73
|
-
<% } -%>
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
sap.ui.define([
|
|
2
|
-
"sap/ui/core/UIComponent",
|
|
3
|
-
"sap/ui/Device",
|
|
4
|
-
"<%=appURI%>/model/models"
|
|
5
|
-
], function(UIComponent, Device, models) {
|
|
6
|
-
"use strict";
|
|
7
|
-
|
|
8
|
-
return UIComponent.extend("<%=appId%>.Component", {
|
|
9
|
-
|
|
10
|
-
metadata: {
|
|
11
|
-
manifest: "json"
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* The component is initialized by UI5 automatically during the startup of the app and calls the init method once.
|
|
16
|
-
* @public
|
|
17
|
-
* @override
|
|
18
|
-
*/
|
|
19
|
-
init: function() {
|
|
20
|
-
// call the base component's init function
|
|
21
|
-
UIComponent.prototype.init.apply(this, arguments);
|
|
22
|
-
|
|
23
|
-
// enable routing
|
|
24
|
-
this.getRouter().initialize();
|
|
25
|
-
|
|
26
|
-
// set the device model
|
|
27
|
-
this.setModel(models.createDeviceModel(), "device");
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
});
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
sap.ui.define([
|
|
2
|
-
"sap/ui/core/mvc/Controller",
|
|
3
|
-
"sap/ui/core/routing/History",
|
|
4
|
-
"sap/ui/core/UIComponent",
|
|
5
|
-
"<%=appURI%>/model/formatter"
|
|
6
|
-
], function(Controller, History, UIComponent, formatter) {
|
|
7
|
-
"use strict";
|
|
8
|
-
|
|
9
|
-
return Controller.extend("<%=appId%>.controller.BaseController", {
|
|
10
|
-
|
|
11
|
-
formatter: formatter,
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Convenience method for getting the view model by name in every controller of the application.
|
|
15
|
-
* @public
|
|
16
|
-
* @param {string} sName the model name
|
|
17
|
-
* @returns {sap.ui.model.Model} the model instance
|
|
18
|
-
*/
|
|
19
|
-
getModel: function(sName) {
|
|
20
|
-
return this.getView().getModel(sName);
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Convenience method for setting the view model in every controller of the application.
|
|
25
|
-
* @public
|
|
26
|
-
* @param {sap.ui.model.Model} oModel the model instance
|
|
27
|
-
* @param {string} sName the model name
|
|
28
|
-
* @returns {sap.ui.mvc.View} the view instance
|
|
29
|
-
*/
|
|
30
|
-
setModel: function(oModel, sName) {
|
|
31
|
-
return this.getView().setModel(oModel, sName);
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Convenience method for getting the resource bundle.
|
|
36
|
-
* @public
|
|
37
|
-
* @returns {sap.ui.model.resource.ResourceModel} the resourceModel of the component
|
|
38
|
-
*/
|
|
39
|
-
getResourceBundle: function() {
|
|
40
|
-
return this.getOwnerComponent().getModel("i18n").getResourceBundle();
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Method for navigation to specific view
|
|
45
|
-
* @public
|
|
46
|
-
* @param {string} psTarget Parameter containing the string for the target navigation
|
|
47
|
-
* @param {Object.<string, string>} pmParameters? Parameters for navigation
|
|
48
|
-
* @param {boolean} pbReplace? Defines if the hash should be replaced (no browser history entry) or set (browser history entry)
|
|
49
|
-
*/
|
|
50
|
-
navTo: function(psTarget, pmParameters, pbReplace) {
|
|
51
|
-
this.getRouter().navTo(psTarget, pmParameters, pbReplace);
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
getRouter: function() {
|
|
55
|
-
return UIComponent.getRouterFor(this);
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
onNavBack: function() {
|
|
59
|
-
var sPreviousHash = History.getInstance().getPreviousHash();
|
|
60
|
-
|
|
61
|
-
if (sPreviousHash !== undefined) {
|
|
62
|
-
window.history.back();
|
|
63
|
-
} else {
|
|
64
|
-
this.getRouter().navTo("appHome", {}, true /*no history*/ );
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/* Enter your custom styles here */
|