@sap-ux/ui5-library-writer 0.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/LICENSE +201 -0
- package/README.md +48 -0
- package/dist/data/index.d.ts +9 -0
- package/dist/data/index.js +23 -0
- package/dist/data/validators.d.ts +36 -0
- package/dist/data/validators.js +101 -0
- package/dist/i18n.d.ts +14 -0
- package/dist/i18n.js +52 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +54 -0
- package/dist/options/index.d.ts +2 -0
- package/dist/options/index.js +18 -0
- package/dist/options/typescript.d.ts +12 -0
- package/dist/options/typescript.js +92 -0
- package/dist/translations/ui5-library-writer.i18n.json +16 -0
- package/dist/types.d.ts +19 -0
- package/dist/types.js +3 -0
- package/package.json +59 -0
- package/templates/common/gitignore.tmpl +9 -0
- package/templates/common/karma.conf.tmpl +7 -0
- package/templates/common/package.json +19 -0
- package/templates/common/src/baselibrary/.library +14 -0
- package/templates/common/src/baselibrary/Example.gen.d.ts +33 -0
- package/templates/common/src/baselibrary/Example.js +68 -0
- package/templates/common/src/baselibrary/Example.ts +65 -0
- package/templates/common/src/baselibrary/ExampleRenderer.js +47 -0
- package/templates/common/src/baselibrary/ExampleRenderer.ts +41 -0
- package/templates/common/src/baselibrary/library.js +67 -0
- package/templates/common/src/baselibrary/library.ts +56 -0
- package/templates/common/src/baselibrary/messagebundle.properties +2 -0
- package/templates/common/src/baselibrary/themes/base/Example.less +19 -0
- package/templates/common/src/baselibrary/themes/base/library.source.less +4 -0
- package/templates/common/src/baselibrary/themes/sap_belize/library.source.less +3 -0
- package/templates/common/src/baselibrary/themes/sap_belize_hcb/library.source.less +3 -0
- package/templates/common/src/baselibrary/themes/sap_belize_hcw/library.source.less +3 -0
- package/templates/common/src/baselibrary/themes/sap_belize_plus/library.source.less +3 -0
- package/templates/common/src/baselibrary/themes/sap_fiori_3/library.source.less +3 -0
- package/templates/common/src/baselibrary/themes/sap_fiori_3_dark/library.source.less +3 -0
- package/templates/common/src/baselibrary/themes/sap_fiori_3_hcb/library.source.less +3 -0
- package/templates/common/src/baselibrary/themes/sap_fiori_3_hcw/library.source.less +3 -0
- package/templates/common/test/baselibrary/Example.html +20 -0
- package/templates/common/test/baselibrary/Example.js +18 -0
- package/templates/common/test/baselibrary/Example.ts +9 -0
- package/templates/common/test/baselibrary/qunit/Example.qunit.js +65 -0
- package/templates/common/test/baselibrary/qunit/Example.qunit.ts +68 -0
- package/templates/common/test/baselibrary/qunit/testsuite.qunit.html +13 -0
- package/templates/common/test/baselibrary/qunit/testsuite.qunit.js +35 -0
- package/templates/common/test/baselibrary/qunit/testsuite.qunit.ts +35 -0
- package/templates/common/ui5.yaml +19 -0
- package/templates/optional/typescript/.eslintrc +4 -0
- package/templates/optional/typescript/package.json +37 -0
- package/templates/optional/typescript/src/.babelrc.json +25 -0
- package/templates/optional/typescript/tsconfig.json +26 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
5
|
+
<title>Test Page for <%= libraryNamespace %>.Example</title>
|
|
6
|
+
<base href="<%= libraryBasepath %>../">
|
|
7
|
+
<script src="resources/sap-ui-core.js"
|
|
8
|
+
id="sap-ui-bootstrap"
|
|
9
|
+
data-sap-ui-async="true"
|
|
10
|
+
data-sap-ui-oninit="module:local/Example"
|
|
11
|
+
data-sap-ui-libs="sap.ui.core,<%= libraryNamespace %>"
|
|
12
|
+
data-sap-ui-theme="sap_fiori_3"
|
|
13
|
+
data-sap-ui-resourceroots='{"local" : "./test-resources/<%= libraryNamespaceURI %>/"}'>
|
|
14
|
+
</script>
|
|
15
|
+
</head>
|
|
16
|
+
<body class="sapUiBody">
|
|
17
|
+
<h1 id="header">Test Page for <code><%= libraryNamespace %>.Example</code></h1>
|
|
18
|
+
<div id="content"></div>
|
|
19
|
+
</body>
|
|
20
|
+
</html>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// eslint-disable-next-line no-undef
|
|
2
|
+
sap.ui.define([
|
|
3
|
+
"<%= libraryNamespaceURI %>/library",
|
|
4
|
+
"<%= libraryNamespaceURI %>/Example"
|
|
5
|
+
], function(library, Example) {
|
|
6
|
+
"use strict";
|
|
7
|
+
|
|
8
|
+
// refer to library types
|
|
9
|
+
var ExampleColor = library.ExampleColor;
|
|
10
|
+
|
|
11
|
+
// create a new instance of the Example control and
|
|
12
|
+
// place it into the DOM element with the id "content"
|
|
13
|
+
new Example({
|
|
14
|
+
text: "Example",
|
|
15
|
+
color: ExampleColor.Highlight
|
|
16
|
+
}).placeAt("content");
|
|
17
|
+
|
|
18
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ExampleColor } from '<%= libraryNamespaceURI %>/library';
|
|
2
|
+
import Example from '<%= libraryNamespaceURI %>/Example';
|
|
3
|
+
|
|
4
|
+
// Create a new instance of the Example control and
|
|
5
|
+
// place it into the DOM element with the id "content"
|
|
6
|
+
new Example({
|
|
7
|
+
text: 'Example',
|
|
8
|
+
color: ExampleColor.Highlight,
|
|
9
|
+
}).placeAt('content');
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/*global QUnit */
|
|
2
|
+
// eslint-disable-next-line no-undef
|
|
3
|
+
sap.ui.define([
|
|
4
|
+
"sap/ui/qunit/QUnitUtils",
|
|
5
|
+
"sap/ui/qunit/utils/createAndAppendDiv",
|
|
6
|
+
"<%= libraryNamespaceURI %>/library",
|
|
7
|
+
"<%= libraryNamespaceURI %>/Example"
|
|
8
|
+
], function(qutils, createAndAppendDiv, library, Example) {
|
|
9
|
+
"use strict";
|
|
10
|
+
|
|
11
|
+
// refer to library types
|
|
12
|
+
var ExampleColor = library.ExampleColor;
|
|
13
|
+
|
|
14
|
+
// prepare DOM
|
|
15
|
+
createAndAppendDiv("uiArea1");
|
|
16
|
+
|
|
17
|
+
// module for basic checks
|
|
18
|
+
QUnit.module("Example Tests");
|
|
19
|
+
|
|
20
|
+
// example sync test
|
|
21
|
+
QUnit.test("Sync", function(assert) {
|
|
22
|
+
assert.expect(1);
|
|
23
|
+
assert.ok(true, "ok");
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
// example async test
|
|
27
|
+
QUnit.test("Async", function(assert) {
|
|
28
|
+
assert.expect(1);
|
|
29
|
+
return new Promise(function(resolve, reject) {
|
|
30
|
+
assert.ok(true, "ok");
|
|
31
|
+
resolve();
|
|
32
|
+
});
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
// module for basic checks
|
|
36
|
+
QUnit.module("Basic Control Checks");
|
|
37
|
+
|
|
38
|
+
// some basic control checks
|
|
39
|
+
QUnit.test("Test get properties", function(assert) {
|
|
40
|
+
assert.expect(2);
|
|
41
|
+
var oExample = new Example({
|
|
42
|
+
text: "Example"
|
|
43
|
+
});
|
|
44
|
+
assert.equal(oExample.getText(), "Example", "Check text equals 'Example'");
|
|
45
|
+
assert.equal(oExample.getColor(), ExampleColor.Default, "Check color equals 'Default'");
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// some basic eventing check
|
|
49
|
+
QUnit.test("Test click event", function(assert) {
|
|
50
|
+
assert.expect(1);
|
|
51
|
+
var oExample = new Example("example", {
|
|
52
|
+
text: "Example",
|
|
53
|
+
press: function() {
|
|
54
|
+
assert.ok(true, "Event has been fired!")
|
|
55
|
+
}
|
|
56
|
+
}).placeAt("uiArea1");
|
|
57
|
+
return new Promise(function(resolve, reject) {
|
|
58
|
+
setTimeout(function() {
|
|
59
|
+
qutils.triggerMouseEvent("example", "click", 1, 1);
|
|
60
|
+
resolve();
|
|
61
|
+
}, 100);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
|
|
4
|
+
/*global QUnit */
|
|
5
|
+
// eslint-disable-next-line no-undef
|
|
6
|
+
sap.ui.define([
|
|
7
|
+
"sap/ui/qunit/QUnitUtils",
|
|
8
|
+
"sap/ui/qunit/utils/createAndAppendDiv",
|
|
9
|
+
"<%= libraryNamespaceURI %>/library",
|
|
10
|
+
"<%= libraryNamespaceURI %>/Example"
|
|
11
|
+
], function(qutils, createAndAppendDiv, library, Example) {
|
|
12
|
+
"use strict";
|
|
13
|
+
|
|
14
|
+
// refer to library types
|
|
15
|
+
const ExampleColor = library.ExampleColor;
|
|
16
|
+
|
|
17
|
+
// prepare DOM
|
|
18
|
+
createAndAppendDiv("uiArea1");
|
|
19
|
+
|
|
20
|
+
// module for basic checks
|
|
21
|
+
QUnit.module("Example Tests");
|
|
22
|
+
|
|
23
|
+
// example sync test
|
|
24
|
+
QUnit.test("Sync", function(assert) {
|
|
25
|
+
assert.expect(1);
|
|
26
|
+
assert.ok(true, "ok");
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// example async test
|
|
30
|
+
QUnit.test("Async", function(assert) {
|
|
31
|
+
assert.expect(1);
|
|
32
|
+
return new Promise(function(resolve, reject) {
|
|
33
|
+
assert.ok(true, "ok");
|
|
34
|
+
resolve();
|
|
35
|
+
});
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
// module for basic checks
|
|
39
|
+
QUnit.module("Basic Control Checks");
|
|
40
|
+
|
|
41
|
+
// some basic control checks
|
|
42
|
+
QUnit.test("Test get properties", function(assert) {
|
|
43
|
+
assert.expect(2);
|
|
44
|
+
const oExample = new Example({
|
|
45
|
+
text: "Example"
|
|
46
|
+
});
|
|
47
|
+
assert.equal(oExample.getText(), "Example", "Check text equals 'Example'");
|
|
48
|
+
assert.equal(oExample.getColor(), ExampleColor.Default, "Check color equals 'Default'");
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// some basic eventing check
|
|
52
|
+
QUnit.test("Test click event", function(assert) {
|
|
53
|
+
assert.expect(1);
|
|
54
|
+
const oExample = new Example("example", {
|
|
55
|
+
text: "Example",
|
|
56
|
+
press: function() {
|
|
57
|
+
assert.ok(true, "Event has been fired!")
|
|
58
|
+
}
|
|
59
|
+
}).placeAt("uiArea1");
|
|
60
|
+
return new Promise(function(resolve, reject) {
|
|
61
|
+
setTimeout(function() {
|
|
62
|
+
qutils.triggerMouseEvent("example", "click", 1, 1);
|
|
63
|
+
resolve();
|
|
64
|
+
}, 100);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<base href="<%= libraryBasepath %>../../">
|
|
7
|
+
<title>QUnit TestSuite for <%= libraryNamespace %></title>
|
|
8
|
+
<script src="resources/sap/ui/test/starter/createSuite.js"
|
|
9
|
+
data-sap-ui-testsuite="test-resources/<%= libraryNamespaceURI %>/qunit/testsuite.qunit"></script>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// eslint-disable-next-line no-undef
|
|
2
|
+
sap.ui.define(function() {
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
return {
|
|
6
|
+
name: "QUnit TestSuite for <%= libraryNamespace %>",
|
|
7
|
+
defaults: {
|
|
8
|
+
bootCore: true,
|
|
9
|
+
ui5: {
|
|
10
|
+
libs: "sap.ui.core,<%= libraryNamespace %>",
|
|
11
|
+
theme: "sap_fiori_3",
|
|
12
|
+
noConflict: true,
|
|
13
|
+
preload: "auto"
|
|
14
|
+
},
|
|
15
|
+
qunit: {
|
|
16
|
+
version: 2,
|
|
17
|
+
reorder: false
|
|
18
|
+
},
|
|
19
|
+
sinon: {
|
|
20
|
+
version: 4,
|
|
21
|
+
qunitBridge: true,
|
|
22
|
+
useFakeTimers: false
|
|
23
|
+
},
|
|
24
|
+
module: "./{name}.qunit"
|
|
25
|
+
},
|
|
26
|
+
tests: {
|
|
27
|
+
// test file for the Example control
|
|
28
|
+
Example: {
|
|
29
|
+
title: "QUnit Test for Example",
|
|
30
|
+
_alternativeTitle: "QUnit tests: <%= libraryNamespace %>.Example"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// eslint-disable-next-line no-undef
|
|
2
|
+
sap.ui.define(function() {
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
return {
|
|
6
|
+
name: "QUnit TestSuite for <%= libraryNamespace %>",
|
|
7
|
+
defaults: {
|
|
8
|
+
bootCore: true,
|
|
9
|
+
ui5: {
|
|
10
|
+
libs: "sap.ui.core,<%= libraryNamespace %>",
|
|
11
|
+
theme: "sap_fiori_3",
|
|
12
|
+
noConflict: true,
|
|
13
|
+
preload: "auto"
|
|
14
|
+
},
|
|
15
|
+
qunit: {
|
|
16
|
+
version: 2,
|
|
17
|
+
reorder: false
|
|
18
|
+
},
|
|
19
|
+
sinon: {
|
|
20
|
+
version: 4,
|
|
21
|
+
qunitBridge: true,
|
|
22
|
+
useFakeTimers: false
|
|
23
|
+
},
|
|
24
|
+
module: "./{name}.qunit"
|
|
25
|
+
},
|
|
26
|
+
tests: {
|
|
27
|
+
// test file for the Example control
|
|
28
|
+
Example: {
|
|
29
|
+
title: "QUnit Test for Example",
|
|
30
|
+
_alternativeTitle: "QUnit tests: <%= libraryNamespace %>.Example"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
specVersion: '2.2'
|
|
2
|
+
metadata:
|
|
3
|
+
name: "<%= libraryName %>"
|
|
4
|
+
type: library
|
|
5
|
+
framework:
|
|
6
|
+
name: <%= framework %>
|
|
7
|
+
version: <%= frameworkVersion %>
|
|
8
|
+
libraries:
|
|
9
|
+
- name: sap.ui.core
|
|
10
|
+
- name: themelib_sap_belize
|
|
11
|
+
- name: themelib_sap_fiori_3
|
|
12
|
+
server:
|
|
13
|
+
customMiddleware:
|
|
14
|
+
- name: fiori-tools-appreload
|
|
15
|
+
afterMiddleware: compression
|
|
16
|
+
configuration:
|
|
17
|
+
path: test
|
|
18
|
+
port: 35729
|
|
19
|
+
delay: 300
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "<%= libraryName %>",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"devDependencies": {
|
|
6
|
+
"@babel/cli": "^7.17.6",
|
|
7
|
+
"@babel/core": "^7.17.8",
|
|
8
|
+
"@babel/preset-env": "^7.16.11",
|
|
9
|
+
"@babel/preset-typescript": "^7.16.7",
|
|
10
|
+
"<%= tsTypes %>": "<%= tsTypesVersion %>",
|
|
11
|
+
"@typescript-eslint/eslint-plugin": "^5.59.0",
|
|
12
|
+
"@typescript-eslint/parser": "^5.59.0",
|
|
13
|
+
"@ui5/cli": "^3.0.0",
|
|
14
|
+
"@ui5/ts-interface-generator": "^0.6.2",
|
|
15
|
+
"babel-preset-transform-ui5": "^7.0.5",
|
|
16
|
+
"eslint": "^7.32.0",
|
|
17
|
+
"karma": "^6.3.17",
|
|
18
|
+
"karma-chrome-launcher": "^3.1.1",
|
|
19
|
+
"karma-cli": "^2.0.0",
|
|
20
|
+
"karma-ui5": "^3.0.3",
|
|
21
|
+
"npm-run-all": "^4.1.5",
|
|
22
|
+
"typescript": "^4.6.3",
|
|
23
|
+
"@sap/ux-ui5-tooling": "1",
|
|
24
|
+
"ui5-tooling-transpile": "^0.7.10",
|
|
25
|
+
"@sap-ux/eslint-plugin-fiori-tools": "^0.1.0"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "run-p -l build-app build-interface",
|
|
29
|
+
"build-app": "ui5 build --config=ui5.yaml --clean-dest --dest dist",
|
|
30
|
+
"build-interface": "npx @ui5/ts-interface-generator",
|
|
31
|
+
"start": "fiori run --open \"test-resources/<%= libraryNamespaceURI %>/Example.html\"",
|
|
32
|
+
"testsuite": "fiori run --open test-resources/<%= libraryNamespaceURI %>/qunit/testsuite.qunit.html",
|
|
33
|
+
"test": "karma start --browsers=ChromeHeadless --singleRun=true",
|
|
34
|
+
"ts-typecheck": "tsc --noEmit",
|
|
35
|
+
"lint": "eslint ."
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"ignore": [
|
|
3
|
+
"**/*.d.ts"
|
|
4
|
+
],
|
|
5
|
+
"presets": [
|
|
6
|
+
"@babel/preset-env",
|
|
7
|
+
[
|
|
8
|
+
"transform-ui5",
|
|
9
|
+
{
|
|
10
|
+
"overridesToOverride": true
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"@babel/preset-typescript"
|
|
14
|
+
],
|
|
15
|
+
"plugins": [
|
|
16
|
+
"transform-remove-console",
|
|
17
|
+
[
|
|
18
|
+
"transform-async-to-promises",
|
|
19
|
+
{
|
|
20
|
+
"inlineHelpers": true
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
],
|
|
24
|
+
"sourceMaps": true
|
|
25
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2022",
|
|
4
|
+
"module": "es2022",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
"allowJs": true,
|
|
8
|
+
"strict": true,
|
|
9
|
+
"strictPropertyInitialization": false,
|
|
10
|
+
"rootDir": "./",
|
|
11
|
+
"outDir": "./dist",
|
|
12
|
+
"baseUrl": "./",
|
|
13
|
+
"types": [
|
|
14
|
+
"<%= tsTypes %>"
|
|
15
|
+
],
|
|
16
|
+
"paths": {
|
|
17
|
+
"<%= libraryNamespaceURI %>/*": [
|
|
18
|
+
"./src/<%= libraryNamespaceURI %>/*"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"include": [
|
|
23
|
+
"./src/**/*",
|
|
24
|
+
"./test/**/*"
|
|
25
|
+
]
|
|
26
|
+
}
|