@sap-ux/ui5-application-writer 0.22.3 → 0.23.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/dist/data/defaults.d.ts +0 -42
- package/dist/data/defaults.js +3 -64
- package/dist/data/index.js +2 -1
- package/dist/index.js +3 -4
- package/dist/options.d.ts +3 -3
- package/dist/options.js +65 -48
- package/package.json +6 -6
- package/dist/files.d.ts +0 -9
- package/dist/files.js +0 -21
package/dist/data/defaults.d.ts
CHANGED
|
@@ -7,31 +7,6 @@ import type { App, AppOptions, Package, UI5 } from '../types';
|
|
|
7
7
|
* @returns {Partial<Package>} the package instance
|
|
8
8
|
*/
|
|
9
9
|
export declare function packageDefaults(version?: string, description?: string): Partial<Package>;
|
|
10
|
-
/**
|
|
11
|
-
* Merges two objects. All properties from base and from extension will be present.
|
|
12
|
-
* Overlapping properties will be used from extension. Arrays will be concatenated and de-duped.
|
|
13
|
-
*
|
|
14
|
-
* @param base - any object definition
|
|
15
|
-
* @param extension - another object definition
|
|
16
|
-
* @returns - a merged package defintion
|
|
17
|
-
*/
|
|
18
|
-
export declare function mergeObjects<B, E>(base: B, extension: E): B & E;
|
|
19
|
-
export declare const enum UI5_DEFAULT {
|
|
20
|
-
DEFAULT_UI5_VERSION = "",
|
|
21
|
-
DEFAULT_LOCAL_UI5_VERSION = "1.95.0",
|
|
22
|
-
MIN_UI5_VERSION = "1.60.0",
|
|
23
|
-
MIN_LOCAL_SAPUI5_VERSION = "1.76.0",
|
|
24
|
-
MIN_LOCAL_OPENUI5_VERSION = "1.52.5",
|
|
25
|
-
SAPUI5_CDN = "https://ui5.sap.com",
|
|
26
|
-
OPENUI5_CDN = "https://openui5.hana.ondemand.com",
|
|
27
|
-
TYPES_VERSION_SINCE = "1.76.0",
|
|
28
|
-
TYPES_VERSION_BEST_MIN = "1.102.0",
|
|
29
|
-
TYPES_VERSION_PREVIOUS = "1.71.15",
|
|
30
|
-
TYPES_VERSION_BEST = "1.108.0",
|
|
31
|
-
ESM_TYPES_VERSION_SINCE = "1.94.0",
|
|
32
|
-
MANIFEST_VERSION = "1.12.0",
|
|
33
|
-
BASE_COMPONENT = "sap/ui/core/UIComponent"
|
|
34
|
-
}
|
|
35
10
|
/**
|
|
36
11
|
* Returns an app instance merged with default properties.
|
|
37
12
|
*
|
|
@@ -49,23 +24,6 @@ export declare const defaultUI5Libs: string[];
|
|
|
49
24
|
* @returns {UI5} the updated copy of UI5 instance (does not change `ui5`)
|
|
50
25
|
*/
|
|
51
26
|
export declare function mergeUi5(ui5: Partial<UI5>, options?: Partial<AppOptions>): UI5;
|
|
52
|
-
/**
|
|
53
|
-
* Get the best types version for the given minUI5Version for https://www.npmjs.com/package/@sapui5/ts-types where specific versions are missing.
|
|
54
|
-
*
|
|
55
|
-
* @param minUI5Version the minimum UI5 version that needs to be supported
|
|
56
|
-
* @returns semantic version representing the types version.
|
|
57
|
-
*/
|
|
58
|
-
export declare function getTypesVersion(minUI5Version?: string): string;
|
|
59
|
-
/**
|
|
60
|
-
* Get the best types version for the given minUI5Version within a selective range, starting at 1.90.0
|
|
61
|
-
* for https://www.npmjs.com/package/@sapui5/ts-types-esm
|
|
62
|
-
* For the latest versions the LTS S/4 on-premise version (1.102.x) is used, for anything before we
|
|
63
|
-
* match the versions as far back as available.
|
|
64
|
-
*
|
|
65
|
-
* @param minUI5Version the minimum UI5 version that needs to be supported
|
|
66
|
-
* @returns semantic version representing the types version.
|
|
67
|
-
*/
|
|
68
|
-
export declare function getEsmTypesVersion(minUI5Version?: string): string;
|
|
69
27
|
/**
|
|
70
28
|
* Retrieve the tag version of the @sap/ux-specification based on the given version.
|
|
71
29
|
*
|
package/dist/data/defaults.js
CHANGED
|
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getSpecTagVersion = exports.
|
|
6
|
+
exports.getSpecTagVersion = exports.mergeUi5 = exports.defaultUI5Libs = exports.mergeApp = exports.packageDefaults = void 0;
|
|
7
|
+
const ui5_config_1 = require("@sap-ux/ui5-config");
|
|
7
8
|
const mapping_json_1 = __importDefault(require("@ui5/manifest/mapping.json")); // from https://github.com/SAP/ui5-manifest/blob/master/mapping.json
|
|
8
9
|
const ui5Libs_1 = require("./ui5Libs");
|
|
9
10
|
const semver_1 = __importDefault(require("semver"));
|
|
@@ -32,26 +33,6 @@ function packageDefaults(version, description) {
|
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
35
|
exports.packageDefaults = packageDefaults;
|
|
35
|
-
/**
|
|
36
|
-
* Merges two objects. All properties from base and from extension will be present.
|
|
37
|
-
* Overlapping properties will be used from extension. Arrays will be concatenated and de-duped.
|
|
38
|
-
*
|
|
39
|
-
* @param base - any object definition
|
|
40
|
-
* @param extension - another object definition
|
|
41
|
-
* @returns - a merged package defintion
|
|
42
|
-
*/
|
|
43
|
-
function mergeObjects(base, extension) {
|
|
44
|
-
return (0, mergeWith_1.default)({}, base, extension, (objValue, srcValue) => {
|
|
45
|
-
// merge and de-dup arrays
|
|
46
|
-
if (objValue instanceof Array && srcValue instanceof Array) {
|
|
47
|
-
return [...new Set([...objValue, ...srcValue])];
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
return undefined;
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
exports.mergeObjects = mergeObjects;
|
|
55
36
|
/**
|
|
56
37
|
* Returns an app instance merged with default properties.
|
|
57
38
|
*
|
|
@@ -97,54 +78,12 @@ function mergeUi5(ui5, options) {
|
|
|
97
78
|
};
|
|
98
79
|
merged.descriptorVersion = getManifestVersion(merged.minUI5Version, ui5.descriptorVersion);
|
|
99
80
|
merged.typesVersion =
|
|
100
|
-
(_d = ui5.typesVersion) !== null && _d !== void 0 ? _d : ((options === null || options === void 0 ? void 0 : options.typescript) ? getEsmTypesVersion : getTypesVersion)(merged.minUI5Version);
|
|
81
|
+
(_d = ui5.typesVersion) !== null && _d !== void 0 ? _d : ((options === null || options === void 0 ? void 0 : options.typescript) ? ui5_config_1.getEsmTypesVersion : ui5_config_1.getTypesVersion)(merged.minUI5Version);
|
|
101
82
|
merged.ui5Theme = (_e = ui5.ui5Theme) !== null && _e !== void 0 ? _e : 'sap_fiori_3';
|
|
102
83
|
merged.ui5Libs = (0, ui5Libs_1.getUI5Libs)(ui5.ui5Libs);
|
|
103
84
|
return Object.assign({}, ui5, merged);
|
|
104
85
|
}
|
|
105
86
|
exports.mergeUi5 = mergeUi5;
|
|
106
|
-
/**
|
|
107
|
-
* Get the best types version for the given minUI5Version for https://www.npmjs.com/package/@sapui5/ts-types where specific versions are missing.
|
|
108
|
-
*
|
|
109
|
-
* @param minUI5Version the minimum UI5 version that needs to be supported
|
|
110
|
-
* @returns semantic version representing the types version.
|
|
111
|
-
*/
|
|
112
|
-
function getTypesVersion(minUI5Version) {
|
|
113
|
-
const version = semver_1.default.coerce(minUI5Version);
|
|
114
|
-
if (!version) {
|
|
115
|
-
return `~${"1.108.0" /* UI5_DEFAULT.TYPES_VERSION_BEST */}`;
|
|
116
|
-
}
|
|
117
|
-
else if (semver_1.default.gte(version, "1.108.0" /* UI5_DEFAULT.TYPES_VERSION_BEST */)) {
|
|
118
|
-
return `~${"1.108.0" /* UI5_DEFAULT.TYPES_VERSION_BEST */}`;
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
return semver_1.default.gte(version, "1.76.0" /* UI5_DEFAULT.TYPES_VERSION_SINCE */)
|
|
122
|
-
? `~${semver_1.default.major(version)}.${semver_1.default.minor(version)}.${semver_1.default.patch(version)}`
|
|
123
|
-
: "1.71.15" /* UI5_DEFAULT.TYPES_VERSION_PREVIOUS */;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
exports.getTypesVersion = getTypesVersion;
|
|
127
|
-
/**
|
|
128
|
-
* Get the best types version for the given minUI5Version within a selective range, starting at 1.90.0
|
|
129
|
-
* for https://www.npmjs.com/package/@sapui5/ts-types-esm
|
|
130
|
-
* For the latest versions the LTS S/4 on-premise version (1.102.x) is used, for anything before we
|
|
131
|
-
* match the versions as far back as available.
|
|
132
|
-
*
|
|
133
|
-
* @param minUI5Version the minimum UI5 version that needs to be supported
|
|
134
|
-
* @returns semantic version representing the types version.
|
|
135
|
-
*/
|
|
136
|
-
function getEsmTypesVersion(minUI5Version) {
|
|
137
|
-
const version = semver_1.default.coerce(minUI5Version);
|
|
138
|
-
if (!version || semver_1.default.gte(version, "1.102.0" /* UI5_DEFAULT.TYPES_VERSION_BEST_MIN */)) {
|
|
139
|
-
return `~${"1.108.0" /* UI5_DEFAULT.TYPES_VERSION_BEST */}`;
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
return semver_1.default.gte(version, "1.94.0" /* UI5_DEFAULT.ESM_TYPES_VERSION_SINCE */)
|
|
143
|
-
? `~${semver_1.default.major(version)}.${semver_1.default.minor(version)}.0`
|
|
144
|
-
: `~${"1.94.0" /* UI5_DEFAULT.ESM_TYPES_VERSION_SINCE */}`;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
exports.getEsmTypesVersion = getEsmTypesVersion;
|
|
148
87
|
/**
|
|
149
88
|
* Gets the miminum UI5 version based on the specified version.
|
|
150
89
|
*
|
package/dist/data/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mergeWithDefaults = void 0;
|
|
4
|
+
const ui5_config_1 = require("@sap-ux/ui5-config");
|
|
4
5
|
const defaults_1 = require("./defaults");
|
|
5
6
|
const validators_1 = require("./validators");
|
|
6
7
|
/**
|
|
@@ -19,7 +20,7 @@ function mergeWithDefaults(ui5App) {
|
|
|
19
20
|
ui5App.appOptions.codeAssist = false;
|
|
20
21
|
}
|
|
21
22
|
ui5App.ui5 = (0, defaults_1.mergeUi5)(ui5App.ui5 || {}, ui5App.appOptions);
|
|
22
|
-
ui5App.package = (0,
|
|
23
|
+
ui5App.package = (0, ui5_config_1.mergeObjects)((0, defaults_1.packageDefaults)(ui5App.package.version, ui5App.app.description), ui5App.package);
|
|
23
24
|
if (ui5App.appOptions.sapux) {
|
|
24
25
|
ui5App.package.devDependencies = ui5App.package.devDependencies || {};
|
|
25
26
|
ui5App.package.devDependencies['@sap/ux-specification'] = (0, defaults_1.getSpecTagVersion)(ui5App.ui5.version);
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,6 @@ const ui5_config_1 = require("@sap-ux/ui5-config");
|
|
|
17
17
|
const data_1 = require("./data");
|
|
18
18
|
const ui5Libs_1 = require("./data/ui5Libs");
|
|
19
19
|
const options_1 = require("./options");
|
|
20
|
-
const defaults_1 = require("./data/defaults");
|
|
21
20
|
/**
|
|
22
21
|
* Writes the template to the memfs editor instance.
|
|
23
22
|
*
|
|
@@ -57,7 +56,7 @@ function generate(basePath, ui5AppConfig, fs) {
|
|
|
57
56
|
ui5LocalConfig.addUI5Framework(ui5App.ui5.framework, ui5App.ui5.localVersion, ui5App.ui5.ui5Libs, ui5App.ui5.ui5Theme);
|
|
58
57
|
ui5LocalConfig.addFioriToolsAppReloadMiddleware();
|
|
59
58
|
// Add optional features
|
|
60
|
-
(0, options_1.applyOptionalFeatures)(ui5App, fs, basePath, tmplPath, [ui5Config, ui5LocalConfig]);
|
|
59
|
+
yield (0, options_1.applyOptionalFeatures)(ui5App, fs, basePath, tmplPath, [ui5Config, ui5LocalConfig]);
|
|
61
60
|
// write ui5 yamls
|
|
62
61
|
fs.write(ui5ConfigPath, ui5Config.toString());
|
|
63
62
|
fs.write(ui5LocalConfigPath, ui5LocalConfig.toString());
|
|
@@ -116,10 +115,10 @@ function enableTypescript(basePath, fs) {
|
|
|
116
115
|
const ui5App = {
|
|
117
116
|
app: manifest['sap.app'],
|
|
118
117
|
ui5: {
|
|
119
|
-
typesVersion: (0,
|
|
118
|
+
typesVersion: (0, ui5_config_1.getEsmTypesVersion)((_b = (_a = manifest['sap.ui5']) === null || _a === void 0 ? void 0 : _a.dependencies) === null || _b === void 0 ? void 0 : _b.minUI5Version)
|
|
120
119
|
}
|
|
121
120
|
};
|
|
122
|
-
(0, options_1.enableTypescript)({ basePath, fs, ui5Configs: [ui5Config], tmplPath, ui5App }, true);
|
|
121
|
+
yield (0, options_1.enableTypescript)({ basePath, fs, ui5Configs: [ui5Config], tmplPath, ui5App }, true);
|
|
123
122
|
fs.write(ui5ConfigPath, ui5Config.toString());
|
|
124
123
|
return fs;
|
|
125
124
|
});
|
package/dist/options.d.ts
CHANGED
|
@@ -22,13 +22,13 @@ export interface FeatureInput {
|
|
|
22
22
|
* @param input Input required to enable the optional typescript features
|
|
23
23
|
* @param keepOldComponent if set to true then the old Component.js will be renamed but kept.
|
|
24
24
|
*/
|
|
25
|
-
export declare function enableTypescript(input: FeatureInput, keepOldComponent?: boolean): void
|
|
25
|
+
export declare function enableTypescript(input: FeatureInput, keepOldComponent?: boolean): Promise<void>;
|
|
26
26
|
/**
|
|
27
27
|
* Enable npm module import for the given input.
|
|
28
28
|
*
|
|
29
29
|
* @param input Input required to enable the optional npm modules import
|
|
30
30
|
*/
|
|
31
|
-
export declare function enableNpmPackageConsumption(input: FeatureInput): void
|
|
31
|
+
export declare function enableNpmPackageConsumption(input: FeatureInput): Promise<void>;
|
|
32
32
|
/**
|
|
33
33
|
* Check if the ui5 app config requires optional features to be enabled and if yes, enable them.
|
|
34
34
|
*
|
|
@@ -38,5 +38,5 @@ export declare function enableNpmPackageConsumption(input: FeatureInput): void;
|
|
|
38
38
|
* @param tmplPath template basepath
|
|
39
39
|
* @param ui5Configs available UI5 configs
|
|
40
40
|
*/
|
|
41
|
-
export declare function applyOptionalFeatures(ui5App: Ui5App, fs: Editor, basePath: string, tmplPath: string, ui5Configs: UI5Config[]): void
|
|
41
|
+
export declare function applyOptionalFeatures(ui5App: Ui5App, fs: Editor, basePath: string, tmplPath: string, ui5Configs: UI5Config[]): Promise<void>;
|
|
42
42
|
//# sourceMappingURL=options.d.ts.map
|
package/dist/options.js
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.applyOptionalFeatures = exports.enableNpmPackageConsumption = exports.enableTypescript = void 0;
|
|
4
13
|
const path_1 = require("path");
|
|
5
14
|
const ejs_1 = require("ejs");
|
|
6
|
-
const
|
|
15
|
+
const project_access_1 = require("@sap-ux/project-access");
|
|
7
16
|
const ui5Libs_1 = require("./data/ui5Libs");
|
|
8
|
-
const
|
|
17
|
+
const ui5_config_1 = require("@sap-ux/ui5-config");
|
|
9
18
|
/**
|
|
10
19
|
* Copy all template files into the target project.
|
|
11
20
|
*
|
|
@@ -17,35 +26,37 @@ const defaults_1 = require("./data/defaults");
|
|
|
17
26
|
* @param input.tmplPath template basepath
|
|
18
27
|
*/
|
|
19
28
|
function copyTemplates(name, { ui5App, fs, basePath, tmplPath }) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
fs.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
const optTmplDirPath = (0, path_1.join)(tmplPath, 'optional', `${name}`);
|
|
31
|
+
const optTmplFilePaths = yield (0, project_access_1.getFilePaths)(optTmplDirPath);
|
|
32
|
+
optTmplFilePaths.forEach((optTmplFilePath) => {
|
|
33
|
+
const relPath = optTmplFilePath.replace(optTmplDirPath, '');
|
|
34
|
+
const outPath = (0, path_1.join)(basePath, relPath);
|
|
35
|
+
// Extend or add
|
|
36
|
+
if (!fs.exists(outPath)) {
|
|
37
|
+
fs.copyTpl(optTmplFilePath, outPath, ui5App, undefined, {
|
|
38
|
+
globOptions: { dot: true }
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
const add = JSON.parse((0, ejs_1.render)(fs.read(optTmplFilePath), ui5App, {}));
|
|
43
|
+
const existingFile = JSON.parse(fs.read(outPath));
|
|
44
|
+
const merged = (0, ui5_config_1.mergeObjects)(existingFile, add);
|
|
45
|
+
fs.writeJSON(outPath, merged);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
37
48
|
});
|
|
38
49
|
}
|
|
39
50
|
/**
|
|
40
51
|
* Factory functions for applying optional features.
|
|
41
52
|
*/
|
|
42
53
|
const factories = {
|
|
43
|
-
codeAssist: (input) => copyTemplates('codeAssist', input),
|
|
44
|
-
eslint: (input) => copyTemplates('eslint', input),
|
|
45
|
-
loadReuseLibs: (input) => copyTemplates('loadReuseLibs', input),
|
|
46
|
-
sapux: (input) => copyTemplates('sapux', input),
|
|
47
|
-
typescript: enableTypescript,
|
|
48
|
-
npmPackageConsumption: enableNpmPackageConsumption
|
|
54
|
+
codeAssist: (input) => __awaiter(void 0, void 0, void 0, function* () { return yield copyTemplates('codeAssist', input); }),
|
|
55
|
+
eslint: (input) => __awaiter(void 0, void 0, void 0, function* () { return yield copyTemplates('eslint', input); }),
|
|
56
|
+
loadReuseLibs: (input) => __awaiter(void 0, void 0, void 0, function* () { return yield copyTemplates('loadReuseLibs', input); }),
|
|
57
|
+
sapux: (input) => __awaiter(void 0, void 0, void 0, function* () { return yield copyTemplates('sapux', input); }),
|
|
58
|
+
typescript: (input) => __awaiter(void 0, void 0, void 0, function* () { return yield enableTypescript(input); }),
|
|
59
|
+
npmPackageConsumption: (input) => __awaiter(void 0, void 0, void 0, function* () { return yield enableNpmPackageConsumption(input); })
|
|
49
60
|
};
|
|
50
61
|
/**
|
|
51
62
|
* Enable typescript for the given input.
|
|
@@ -55,19 +66,21 @@ const factories = {
|
|
|
55
66
|
*/
|
|
56
67
|
function enableTypescript(input, keepOldComponent = false) {
|
|
57
68
|
var _a;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
69
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
input.ui5App.app.baseComponent = (_a = input.ui5App.app.baseComponent) !== null && _a !== void 0 ? _a : "sap/ui/core/UIComponent" /* UI5_DEFAULT.BASE_COMPONENT */;
|
|
71
|
+
yield copyTemplates('typescript', input);
|
|
72
|
+
input.ui5Configs.forEach((ui5Config) => {
|
|
73
|
+
ui5Config.addCustomMiddleware([ui5Libs_1.ui5TSSupport.middleware]);
|
|
74
|
+
ui5Config.addCustomTasks([ui5Libs_1.ui5TSSupport.task]);
|
|
75
|
+
});
|
|
76
|
+
const compPath = (0, path_1.join)(input.basePath, 'webapp/Component.js');
|
|
77
|
+
if (keepOldComponent) {
|
|
78
|
+
input.fs.move(compPath, `${compPath}.old`);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
input.fs.delete(compPath);
|
|
82
|
+
}
|
|
63
83
|
});
|
|
64
|
-
const compPath = (0, path_1.join)(input.basePath, 'webapp/Component.js');
|
|
65
|
-
if (keepOldComponent) {
|
|
66
|
-
input.fs.move(compPath, `${compPath}.old`);
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
input.fs.delete(compPath);
|
|
70
|
-
}
|
|
71
84
|
}
|
|
72
85
|
exports.enableTypescript = enableTypescript;
|
|
73
86
|
/**
|
|
@@ -76,10 +89,12 @@ exports.enableTypescript = enableTypescript;
|
|
|
76
89
|
* @param input Input required to enable the optional npm modules import
|
|
77
90
|
*/
|
|
78
91
|
function enableNpmPackageConsumption(input) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
92
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
yield copyTemplates('npmPackageConsumption', input);
|
|
94
|
+
input.ui5Configs.forEach((ui5Config) => {
|
|
95
|
+
ui5Config.addCustomMiddleware([ui5Libs_1.ui5NPMSupport.middleware]);
|
|
96
|
+
ui5Config.addCustomTasks([ui5Libs_1.ui5NPMSupport.task]);
|
|
97
|
+
});
|
|
83
98
|
});
|
|
84
99
|
}
|
|
85
100
|
exports.enableNpmPackageConsumption = enableNpmPackageConsumption;
|
|
@@ -93,14 +108,16 @@ exports.enableNpmPackageConsumption = enableNpmPackageConsumption;
|
|
|
93
108
|
* @param ui5Configs available UI5 configs
|
|
94
109
|
*/
|
|
95
110
|
function applyOptionalFeatures(ui5App, fs, basePath, tmplPath, ui5Configs) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
(
|
|
111
|
+
var _a;
|
|
112
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
113
|
+
if (ui5App.appOptions) {
|
|
114
|
+
for (const [key, value] of Object.entries(ui5App.appOptions)) {
|
|
115
|
+
if (value === true) {
|
|
116
|
+
yield ((_a = factories[key]) === null || _a === void 0 ? void 0 : _a.call(factories, { ui5App, fs, basePath, tmplPath, ui5Configs }));
|
|
117
|
+
}
|
|
101
118
|
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
119
|
+
}
|
|
120
|
+
});
|
|
104
121
|
}
|
|
105
122
|
exports.applyOptionalFeatures = applyOptionalFeatures;
|
|
106
123
|
//# sourceMappingURL=options.js.map
|
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.23.0",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"main": "dist/index.js",
|
|
15
15
|
"files": [
|
|
@@ -20,25 +20,25 @@
|
|
|
20
20
|
"!dist/**/*.map"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@sap-ux/ui5-config": "0.16.6",
|
|
24
23
|
"@ui5/manifest": "1.49.2",
|
|
25
24
|
"ejs": "3.1.7",
|
|
26
25
|
"i18next": "21.6.11",
|
|
27
26
|
"lodash": "4.17.21",
|
|
28
27
|
"mem-fs": "2.1.0",
|
|
29
28
|
"mem-fs-editor": "9.4.0",
|
|
30
|
-
"semver": "7.3.5"
|
|
29
|
+
"semver": "7.3.5",
|
|
30
|
+
"@sap-ux/ui5-config": "0.17.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@sap-ux/eslint-plugin-fiori-tools": "0.1.5",
|
|
34
|
-
"@sap-ux/project-access": "1.5.0",
|
|
35
33
|
"@types/ejs": "3.1.0",
|
|
36
34
|
"@types/fs-extra": "9.0.13",
|
|
37
35
|
"@types/lodash": "4.14.176",
|
|
38
36
|
"@types/mem-fs": "1.1.2",
|
|
39
37
|
"@types/mem-fs-editor": "7.0.1",
|
|
40
38
|
"@types/semver": "7.3.9",
|
|
41
|
-
"fs-extra": "10.0.0"
|
|
39
|
+
"fs-extra": "10.0.0",
|
|
40
|
+
"@sap-ux/eslint-plugin-fiori-tools": "0.1.5",
|
|
41
|
+
"@sap-ux/project-access": "1.7.0"
|
|
42
42
|
},
|
|
43
43
|
"engines": {
|
|
44
44
|
"pnpm": ">=6.26.1 < 7.0.0 || >=7.1.0",
|
package/dist/files.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description Returns a flat list of all file paths under a directory tree,
|
|
3
|
-
* recursing through all subdirectories
|
|
4
|
-
* @param {string} dir - the directory to walk
|
|
5
|
-
* @returns {string[]} - array of file path strings
|
|
6
|
-
* @throws if an error occurs reading a file path
|
|
7
|
-
*/
|
|
8
|
-
export declare function getFilePaths(dir: string): string[] | [];
|
|
9
|
-
//# sourceMappingURL=files.d.ts.map
|
package/dist/files.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFilePaths = void 0;
|
|
4
|
-
const fs_1 = require("fs");
|
|
5
|
-
const path_1 = require("path");
|
|
6
|
-
/**
|
|
7
|
-
* @description Returns a flat list of all file paths under a directory tree,
|
|
8
|
-
* recursing through all subdirectories
|
|
9
|
-
* @param {string} dir - the directory to walk
|
|
10
|
-
* @returns {string[]} - array of file path strings
|
|
11
|
-
* @throws if an error occurs reading a file path
|
|
12
|
-
*/
|
|
13
|
-
function getFilePaths(dir) {
|
|
14
|
-
return (0, fs_1.readdirSync)(dir).reduce((files, entry) => {
|
|
15
|
-
const entryPath = (0, path_1.join)(dir, entry);
|
|
16
|
-
const isDirectory = (0, fs_1.statSync)(entryPath).isDirectory();
|
|
17
|
-
return isDirectory ? [...files, ...getFilePaths(entryPath)] : [...files, entryPath];
|
|
18
|
-
}, []);
|
|
19
|
-
}
|
|
20
|
-
exports.getFilePaths = getFilePaths;
|
|
21
|
-
//# sourceMappingURL=files.js.map
|