@sap-ux/ui5-library-reference-writer 0.0.24 → 0.1.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/helpers.js +15 -27
- package/dist/index.js +7 -18
- package/package.json +3 -3
package/dist/helpers.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
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
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.updateYaml = exports.updateManifest = void 0;
|
|
13
4
|
const ui5_config_1 = require("@sap-ux/ui5-config");
|
|
@@ -21,23 +12,20 @@ const constants_1 = require("./constants");
|
|
|
21
12
|
* @param reuseLibs reuse libraries for referencing
|
|
22
13
|
* @param fs mem-fs editor instance
|
|
23
14
|
*/
|
|
24
|
-
function updateManifest(projectPath, reuseLibs, fs) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
Object.assign((_f = (_e = (_d = manifest['sap.ui5']) === null || _d === void 0 ? void 0 : _d.dependencies) === null || _e === void 0 ? void 0 : _e[reuseType]) !== null && _f !== void 0 ? _f : {}, {
|
|
36
|
-
[lib.name]: { lazy: false }
|
|
37
|
-
});
|
|
15
|
+
async function updateManifest(projectPath, reuseLibs, fs) {
|
|
16
|
+
const webapp = await (0, project_access_1.getWebappPath)(projectPath);
|
|
17
|
+
const manifestPath = (0, path_1.join)(webapp, 'manifest.json');
|
|
18
|
+
const manifest = fs.readJSON(manifestPath);
|
|
19
|
+
reuseLibs.forEach((lib) => {
|
|
20
|
+
const reuseType = lib.type === 'library' ? constants_1.ManifestReuseType.Library : constants_1.ManifestReuseType.Component;
|
|
21
|
+
if (manifest['sap.ui5']?.dependencies && !manifest['sap.ui5']?.dependencies?.[reuseType]) {
|
|
22
|
+
manifest['sap.ui5'].dependencies[reuseType] = {};
|
|
23
|
+
}
|
|
24
|
+
Object.assign(manifest['sap.ui5']?.dependencies?.[reuseType] ?? {}, {
|
|
25
|
+
[lib.name]: { lazy: false }
|
|
38
26
|
});
|
|
39
|
-
fs.writeJSON(manifestPath, manifest);
|
|
40
27
|
});
|
|
28
|
+
fs.writeJSON(manifestPath, manifest);
|
|
41
29
|
}
|
|
42
30
|
exports.updateManifest = updateManifest;
|
|
43
31
|
/**
|
|
@@ -48,15 +36,15 @@ exports.updateManifest = updateManifest;
|
|
|
48
36
|
* @param fs mem-fs editor instance
|
|
49
37
|
*/
|
|
50
38
|
function updateYaml(projectPath, reuseLibs, fs) {
|
|
51
|
-
constants_1.yamlFiles.forEach((yaml) =>
|
|
39
|
+
constants_1.yamlFiles.forEach(async (yaml) => {
|
|
52
40
|
const yamlPath = (0, path_1.join)(projectPath, yaml);
|
|
53
41
|
if (fs.exists(yamlPath)) {
|
|
54
|
-
const ui5Config =
|
|
42
|
+
const ui5Config = await ui5_config_1.UI5Config.newInstance(fs.read(yamlPath));
|
|
55
43
|
const serveStaticPaths = getServeStaticPaths(reuseLibs, projectPath);
|
|
56
44
|
ui5Config.addServeStaticConfig(serveStaticPaths);
|
|
57
45
|
fs.write(yamlPath, ui5Config.toString());
|
|
58
46
|
}
|
|
59
|
-
})
|
|
47
|
+
});
|
|
60
48
|
}
|
|
61
49
|
exports.updateYaml = updateYaml;
|
|
62
50
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
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
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.generate = void 0;
|
|
13
4
|
const mem_fs_1 = require("mem-fs");
|
|
@@ -21,15 +12,13 @@ const helpers_1 = require("./helpers");
|
|
|
21
12
|
* @param fs - the memfs editor instance
|
|
22
13
|
* @returns the updated memfs editor instance
|
|
23
14
|
*/
|
|
24
|
-
function generate(basePath, referenceLibraries, fs) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return fs;
|
|
32
|
-
});
|
|
15
|
+
async function generate(basePath, referenceLibraries, fs) {
|
|
16
|
+
if (!fs) {
|
|
17
|
+
fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
18
|
+
}
|
|
19
|
+
(0, helpers_1.updateYaml)(basePath, referenceLibraries, fs);
|
|
20
|
+
await (0, helpers_1.updateManifest)(basePath, referenceLibraries, fs);
|
|
21
|
+
return fs;
|
|
33
22
|
}
|
|
34
23
|
exports.generate = generate;
|
|
35
24
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
7
7
|
"directory": "packages/ui5-library-reference-writer"
|
|
8
8
|
},
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.1.1",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"main": "dist/index.js",
|
|
12
12
|
"files": [
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"mem-fs": "2.1.0",
|
|
23
23
|
"mem-fs-editor": "9.4.0",
|
|
24
|
-
"@sap-ux/project-access": "1.
|
|
25
|
-
"@sap-ux/ui5-config": "0.
|
|
24
|
+
"@sap-ux/project-access": "1.24.0",
|
|
25
|
+
"@sap-ux/ui5-config": "0.23.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/fs-extra": "9.0.13",
|