@sap-ux/ui5-application-writer 0.14.5 → 0.15.1
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/dist/data/ui5Libs.d.ts +42 -0
- package/dist/data/ui5Libs.js +40 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +11 -2
- package/dist/types.d.ts +7 -0
- package/package.json +2 -2
- package/templates/optional/typescript/.babelrc.json +4 -0
- package/templates/optional/typescript/.eslintrc +23 -0
- package/templates/optional/typescript/package.json +19 -0
- package/templates/optional/typescript/tsconfig.json +26 -0
- package/templates/optional/typescript/webapp/Component.ts +24 -0
package/dist/data/ui5Libs.d.ts
CHANGED
|
@@ -5,4 +5,46 @@
|
|
|
5
5
|
* @returns UI5 libs with defaults
|
|
6
6
|
*/
|
|
7
7
|
export declare const getUI5Libs: (ui5Libs?: string | string[] | undefined) => string[];
|
|
8
|
+
/**
|
|
9
|
+
* UI5 tasks configurations required for TypeScript projects
|
|
10
|
+
*/
|
|
11
|
+
export declare const ui5TsTasks: ({
|
|
12
|
+
name: string;
|
|
13
|
+
afterTask: string;
|
|
14
|
+
configuration: {
|
|
15
|
+
debug?: undefined;
|
|
16
|
+
removeConsoleStatements?: undefined;
|
|
17
|
+
transpileAsync?: undefined;
|
|
18
|
+
transpileTypeScript?: undefined;
|
|
19
|
+
};
|
|
20
|
+
} | {
|
|
21
|
+
name: string;
|
|
22
|
+
afterTask: string;
|
|
23
|
+
configuration: {
|
|
24
|
+
debug: boolean;
|
|
25
|
+
removeConsoleStatements: boolean;
|
|
26
|
+
transpileAsync: boolean;
|
|
27
|
+
transpileTypeScript: boolean;
|
|
28
|
+
};
|
|
29
|
+
})[];
|
|
30
|
+
/**
|
|
31
|
+
* UI5 middleware configurations required for TypeScript projects
|
|
32
|
+
*/
|
|
33
|
+
export declare const ui5TsMiddlewares: ({
|
|
34
|
+
name: string;
|
|
35
|
+
afterMiddleware: string;
|
|
36
|
+
configuration: {
|
|
37
|
+
debug?: undefined;
|
|
38
|
+
transpileAsync?: undefined;
|
|
39
|
+
transpileTypeScript?: undefined;
|
|
40
|
+
};
|
|
41
|
+
} | {
|
|
42
|
+
name: string;
|
|
43
|
+
afterMiddleware: string;
|
|
44
|
+
configuration: {
|
|
45
|
+
debug: boolean;
|
|
46
|
+
transpileAsync: boolean;
|
|
47
|
+
transpileTypeScript: boolean;
|
|
48
|
+
};
|
|
49
|
+
})[];
|
|
8
50
|
//# sourceMappingURL=ui5Libs.d.ts.map
|
package/dist/data/ui5Libs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getUI5Libs = void 0;
|
|
3
|
+
exports.ui5TsMiddlewares = exports.ui5TsTasks = exports.getUI5Libs = void 0;
|
|
4
4
|
const defaults_1 = require("./defaults");
|
|
5
5
|
/**
|
|
6
6
|
* Merges the specified ui5 libs with the defaults.
|
|
@@ -14,4 +14,43 @@ exports.getUI5Libs = (ui5Libs) => {
|
|
|
14
14
|
return self.indexOf(value) === index;
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* UI5 tasks configurations required for TypeScript projects
|
|
19
|
+
*/
|
|
20
|
+
exports.ui5TsTasks = [
|
|
21
|
+
{
|
|
22
|
+
name: 'ui5-tooling-modules-task',
|
|
23
|
+
afterTask: 'replaceVersion',
|
|
24
|
+
configuration: {}
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'ui5-tooling-transpile-task',
|
|
28
|
+
afterTask: 'replaceVersion',
|
|
29
|
+
configuration: {
|
|
30
|
+
debug: true,
|
|
31
|
+
removeConsoleStatements: true,
|
|
32
|
+
transpileAsync: true,
|
|
33
|
+
transpileTypeScript: true
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
];
|
|
37
|
+
/**
|
|
38
|
+
* UI5 middleware configurations required for TypeScript projects
|
|
39
|
+
*/
|
|
40
|
+
exports.ui5TsMiddlewares = [
|
|
41
|
+
{
|
|
42
|
+
name: 'ui5-tooling-modules-middleware',
|
|
43
|
+
afterMiddleware: 'compression',
|
|
44
|
+
configuration: {}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'ui5-tooling-transpile-middleware',
|
|
48
|
+
afterMiddleware: 'compression',
|
|
49
|
+
configuration: {
|
|
50
|
+
debug: true,
|
|
51
|
+
transpileAsync: true,
|
|
52
|
+
transpileTypeScript: true
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
];
|
|
17
56
|
//# sourceMappingURL=ui5Libs.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Editor } from 'mem-fs-editor';
|
|
2
|
+
import type { App, AppOptions, Package, UI5 } from './types';
|
|
2
3
|
import { Ui5App } from './types';
|
|
3
4
|
/**
|
|
4
5
|
* Writes the template to the memfs editor instance.
|
|
@@ -10,5 +11,5 @@ import { Ui5App } from './types';
|
|
|
10
11
|
*/
|
|
11
12
|
declare function generate(basePath: string, ui5AppConfig: Ui5App, fs?: Editor): Promise<Editor>;
|
|
12
13
|
export { Ui5App, generate };
|
|
13
|
-
export { App, Package, UI5 }
|
|
14
|
+
export { App, Package, UI5, AppOptions };
|
|
14
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -18,6 +18,7 @@ const json_merger_1 = require("json-merger");
|
|
|
18
18
|
const ejs_1 = require("ejs");
|
|
19
19
|
const files_1 = require("./files");
|
|
20
20
|
const ui5_config_1 = require("@sap-ux/ui5-config");
|
|
21
|
+
const ui5Libs_1 = require("./data/ui5Libs");
|
|
21
22
|
/**
|
|
22
23
|
* Writes the template to the memfs editor instance.
|
|
23
24
|
*
|
|
@@ -47,13 +48,11 @@ function generate(basePath, ui5AppConfig, fs) {
|
|
|
47
48
|
}
|
|
48
49
|
});
|
|
49
50
|
ui5Config.addFioriToolsAppReloadMiddleware();
|
|
50
|
-
fs.write(ui5ConfigPath, ui5Config.toString());
|
|
51
51
|
// ui5-local.yaml
|
|
52
52
|
const ui5LocalConfigPath = path_1.join(basePath, 'ui5-local.yaml');
|
|
53
53
|
const ui5LocalConfig = yield ui5_config_1.UI5Config.newInstance(fs.read(ui5LocalConfigPath));
|
|
54
54
|
ui5LocalConfig.addUI5Framework(ui5App.ui5.framework, ui5App.ui5.localVersion, ui5App.ui5.ui5Libs, ui5App.ui5.ui5Theme);
|
|
55
55
|
ui5LocalConfig.addFioriToolsAppReloadMiddleware();
|
|
56
|
-
fs.write(ui5LocalConfigPath, ui5LocalConfig.toString());
|
|
57
56
|
// Add optional features
|
|
58
57
|
if (ui5App.appOptions) {
|
|
59
58
|
Object.entries(ui5App.appOptions).forEach(([key, value]) => {
|
|
@@ -78,7 +77,17 @@ function generate(basePath, ui5AppConfig, fs) {
|
|
|
78
77
|
});
|
|
79
78
|
}
|
|
80
79
|
});
|
|
80
|
+
if (ui5App.appOptions.typescript) {
|
|
81
|
+
fs.delete(path_1.join(basePath, 'webapp/Component.js'));
|
|
82
|
+
ui5Config.addCustomMiddleware(ui5Libs_1.ui5TsMiddlewares);
|
|
83
|
+
ui5Config.addCustomTasks(ui5Libs_1.ui5TsTasks);
|
|
84
|
+
ui5LocalConfig.addCustomMiddleware(ui5Libs_1.ui5TsMiddlewares);
|
|
85
|
+
ui5LocalConfig.addCustomTasks(ui5Libs_1.ui5TsTasks);
|
|
86
|
+
}
|
|
81
87
|
}
|
|
88
|
+
// write ui5 yamls
|
|
89
|
+
fs.write(ui5ConfigPath, ui5Config.toString());
|
|
90
|
+
fs.write(ui5LocalConfigPath, ui5LocalConfig.toString());
|
|
82
91
|
return fs;
|
|
83
92
|
});
|
|
84
93
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -51,7 +51,14 @@ export interface AppOptions {
|
|
|
51
51
|
codeAssist: boolean;
|
|
52
52
|
eslint: boolean;
|
|
53
53
|
sapux: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Enables loading of re-use libs
|
|
56
|
+
*/
|
|
54
57
|
loadReuseLibs: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Enable Typescript support and generate all files in Typescript instead of Javascript
|
|
60
|
+
*/
|
|
61
|
+
typescript: boolean;
|
|
55
62
|
}
|
|
56
63
|
export interface Ui5App {
|
|
57
64
|
app: App;
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"bugs": {
|
|
10
10
|
"url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Aui5-application-writer"
|
|
11
11
|
},
|
|
12
|
-
"version": "0.
|
|
12
|
+
"version": "0.15.1",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"main": "dist/index.js",
|
|
15
15
|
"files": [
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"!dist/**/*.map"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@sap-ux/ui5-config": "0.14.
|
|
23
|
+
"@sap-ux/ui5-config": "0.14.5",
|
|
24
24
|
"ejs": "3.1.7",
|
|
25
25
|
"mem-fs": "2.1.0",
|
|
26
26
|
"mem-fs-editor": "9.4.0",
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"root": true,
|
|
3
|
+
"env": {
|
|
4
|
+
"browser": true,
|
|
5
|
+
"es6": true,
|
|
6
|
+
"node": true
|
|
7
|
+
},
|
|
8
|
+
"extends": [
|
|
9
|
+
"eslint:recommended",
|
|
10
|
+
"plugin:@typescript-eslint/recommended",
|
|
11
|
+
"plugin:@typescript-eslint/recommended-requiring-type-checking"
|
|
12
|
+
],
|
|
13
|
+
"ignorePatterns": [".eslintignore.js"],
|
|
14
|
+
"parser": "@typescript-eslint/parser",
|
|
15
|
+
"parserOptions": {
|
|
16
|
+
"project": ["./tsconfig.json"],
|
|
17
|
+
"tsconfigRootDir": ".",
|
|
18
|
+
"sourceType": "module"
|
|
19
|
+
},
|
|
20
|
+
"plugins": [
|
|
21
|
+
"@typescript-eslint"
|
|
22
|
+
]
|
|
23
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"scripts": {
|
|
3
|
+
"ts-typecheck": "tsc --noEmit"
|
|
4
|
+
},
|
|
5
|
+
"devDependencies": {
|
|
6
|
+
"@sapui5/ts-types-esm": "latest",
|
|
7
|
+
"ui5-tooling-modules": "^0.6.0",
|
|
8
|
+
"ui5-tooling-transpile": "^0.2.0",
|
|
9
|
+
"typescript": "^4.6.3",
|
|
10
|
+
"@typescript-eslint/eslint-plugin": "^5.17.0",
|
|
11
|
+
"@typescript-eslint/parser": "^5.17.0"
|
|
12
|
+
},
|
|
13
|
+
"ui5": {
|
|
14
|
+
"dependencies": [
|
|
15
|
+
"ui5-tooling-modules",
|
|
16
|
+
"ui5-tooling-transpile"
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2015",
|
|
4
|
+
"module": "es2015",
|
|
5
|
+
"skipLibCheck": true,
|
|
6
|
+
"preserveConstEnums": true,
|
|
7
|
+
"inlineSourceMap": true,
|
|
8
|
+
"allowJs": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"strictNullChecks": true,
|
|
11
|
+
"strictPropertyInitialization": false,
|
|
12
|
+
"moduleResolution": "node",
|
|
13
|
+
"rootDir": "webapp",
|
|
14
|
+
"outDir": "./dist",
|
|
15
|
+
"baseUrl": "./",
|
|
16
|
+
"paths": {
|
|
17
|
+
"<%- app.id %>/*": [
|
|
18
|
+
"webapp/*"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
"types": [ "@sapui5/ts-types-esm" ]
|
|
22
|
+
},
|
|
23
|
+
"include": [
|
|
24
|
+
"webapp/**/*"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import UIComponent from "<%- app.baseComponent %>";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @namespace <%- app.id %>
|
|
5
|
+
*/
|
|
6
|
+
export default class Component extends UIComponent {
|
|
7
|
+
|
|
8
|
+
public static metadata = {
|
|
9
|
+
manifest: "json"
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The component is initialized by UI5 automatically during the startup of the app and calls the init method once.
|
|
14
|
+
* @public
|
|
15
|
+
* @override
|
|
16
|
+
*/
|
|
17
|
+
public init() : void {
|
|
18
|
+
// call the base component's init function
|
|
19
|
+
super.init();
|
|
20
|
+
|
|
21
|
+
// enable routing
|
|
22
|
+
this.getRouter().initialize();
|
|
23
|
+
}
|
|
24
|
+
}
|