@ui5/task-adaptation 1.6.3 → 1.6.4-rc.2
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 +42 -3
- package/dist/adapters/abapAdapter.d.ts +2 -4
- package/dist/adapters/abapAdapter.js +2 -4
- package/dist/adapters/commands/downloadAnnotationsCommand.d.ts +2 -4
- package/dist/adapters/commands/downloadAnnotationsCommand.js +2 -6
- package/dist/adapters/commands/i18nPropertiesMergeCommand.js +7 -4
- package/dist/annotations/abapAnnotationManager.d.ts +17 -0
- package/dist/{annotationManager.js → annotations/abapAnnotationManager.js} +12 -10
- package/dist/annotations/annotationManager.d.ts +3 -0
- package/dist/annotations/annotationManager.js +2 -0
- package/dist/annotations/localAnnotationManager.d.ts +4 -0
- package/dist/annotations/localAnnotationManager.js +7 -0
- package/dist/annotations/serviceRequestor.d.ts +3 -3
- package/dist/annotations/serviceRequestor.js +4 -4
- package/dist/bundle.js +119 -2
- package/dist/index.js +5 -6
- package/dist/landscapeConfiguration.d.ts +9 -0
- package/dist/landscapeConfiguration.js +65 -0
- package/dist/model/configuration.d.ts +2 -0
- package/dist/previewManager.d.ts +2 -2
- package/dist/previewManager.js +7 -7
- package/dist/repositories/{abapRepoManager.d.ts → abapRepository.d.ts} +5 -3
- package/dist/repositories/{abapRepoManager.js → abapRepository.js} +17 -4
- package/dist/repositories/html5Repository.d.ts +18 -0
- package/dist/repositories/{html5RepoManager.js → html5Repository.js} +58 -27
- package/dist/repositories/localRepository.d.ts +16 -0
- package/dist/repositories/localRepository.js +66 -0
- package/dist/repositories/repository.d.ts +8 -0
- package/dist/repositories/repository.js +2 -0
- package/dist/util/commonUtil.d.ts +1 -0
- package/dist/util/commonUtil.js +3 -0
- package/dist/util/fsUtil.d.ts +2 -0
- package/dist/util/fsUtil.js +34 -0
- package/package.json +5 -2
- package/scripts/publish.ts +256 -0
- package/scripts/test-integration-prep.sh +4 -0
- package/dist/annotationManager.d.ts +0 -17
- package/dist/processors/abapProcessor.d.ts +0 -18
- package/dist/processors/abapProcessor.js +0 -43
- package/dist/processors/cfProcessor.d.ts +0 -14
- package/dist/processors/cfProcessor.js +0 -46
- package/dist/processors/previewProcessor.d.ts +0 -8
- package/dist/processors/previewProcessor.js +0 -11
- package/dist/processors/processor.d.ts +0 -10
- package/dist/processors/processor.js +0 -39
- package/dist/repositories/html5RepoManager.d.ts +0 -12
package/dist/previewManager.js
CHANGED
|
@@ -10,7 +10,7 @@ const XS_APP_JSON_FILE = "xs-app.json";
|
|
|
10
10
|
export default class PreviewManager {
|
|
11
11
|
fetchLibsPromises = new Map();
|
|
12
12
|
configuration;
|
|
13
|
-
static async createFromRoot(appId,
|
|
13
|
+
static async createFromRoot(appId, repository, configuration) {
|
|
14
14
|
let ui5AppInfo = "";
|
|
15
15
|
if (PreviewManager.isPreviewRequested()) {
|
|
16
16
|
try {
|
|
@@ -23,12 +23,12 @@ export default class PreviewManager {
|
|
|
23
23
|
else {
|
|
24
24
|
log.verbose("Preview mode not requested (env variable ADP_BUILDER_MODE=preview is not set), skipping preview resources processing.");
|
|
25
25
|
}
|
|
26
|
-
return new PreviewManager(appId, ui5AppInfo,
|
|
26
|
+
return new PreviewManager(appId, ui5AppInfo, repository, configuration);
|
|
27
27
|
}
|
|
28
28
|
static isPreviewRequested() {
|
|
29
29
|
return process.env.ADP_BUILDER_MODE === "preview";
|
|
30
30
|
}
|
|
31
|
-
constructor(appId, ui5AppInfo,
|
|
31
|
+
constructor(appId, ui5AppInfo, repository, configuration) {
|
|
32
32
|
this.configuration = configuration;
|
|
33
33
|
// If no ui5AppInfo is provided, no preview processing is needed
|
|
34
34
|
if (!ui5AppInfo) {
|
|
@@ -41,7 +41,7 @@ export default class PreviewManager {
|
|
|
41
41
|
}
|
|
42
42
|
const reuseLibs = appInfo.asyncHints.libs.filter(lib => lib.html5AppHostId && lib.html5AppName && lib.html5AppVersion);
|
|
43
43
|
if (reuseLibs.length > 0) {
|
|
44
|
-
this.fetchLibsPromises = this.preReadLibs(reuseLibs,
|
|
44
|
+
this.fetchLibsPromises = this.preReadLibs(reuseLibs, repository);
|
|
45
45
|
}
|
|
46
46
|
const logMap = {
|
|
47
47
|
Error: log.error,
|
|
@@ -83,13 +83,13 @@ export default class PreviewManager {
|
|
|
83
83
|
}
|
|
84
84
|
await ResourceUtil.writeInProject(REUSE_DIR, mergedFiles);
|
|
85
85
|
}
|
|
86
|
-
preReadLibs(reuseLibs,
|
|
86
|
+
preReadLibs(reuseLibs, repository) {
|
|
87
87
|
const promises = new Map();
|
|
88
88
|
reuseLibs.forEach(lib => {
|
|
89
89
|
log.info(`Downloading reuse library '${lib.html5AppName}' version '${lib.html5AppVersion}'`);
|
|
90
|
-
const promise =
|
|
90
|
+
const promise = repository
|
|
91
91
|
.fetchReuseLib(lib.html5AppName, lib.html5CacheBusterToken, lib)
|
|
92
|
-
.then(libFiles => PreviewManager.moveLibraryFiles(libFiles, lib.html5AppName, lib.name));
|
|
92
|
+
.then((libFiles) => PreviewManager.moveLibraryFiles(libFiles, lib.html5AppName, lib.name));
|
|
93
93
|
promises.set(lib.html5AppName, promise);
|
|
94
94
|
});
|
|
95
95
|
return promises;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { IConfiguration, IMetadata } from "../model/types.js";
|
|
1
|
+
import { IConfiguration, IMetadata, IReuseLibInfo } from "../model/types.js";
|
|
2
2
|
import AbapProvider from "./abapProvider.js";
|
|
3
3
|
import { IAppVariantIdHierarchyItem } from "../model/appVariantIdHierarchyItem.js";
|
|
4
|
-
|
|
4
|
+
import IRepository from "./repository.js";
|
|
5
|
+
export default class AbapRepository implements IRepository {
|
|
5
6
|
private configuration;
|
|
6
7
|
private abapProvider;
|
|
7
8
|
constructor(configuration: IConfiguration, abapProvider?: AbapProvider);
|
|
9
|
+
fetchReuseLib(_libName: string, _cachebusterToken: string, _lib: IReuseLibInfo): Promise<Map<string, string>>;
|
|
8
10
|
getAppVariantIdHierarchy(id: string): Promise<IAppVariantIdHierarchyItem[]>;
|
|
9
11
|
getAnnotationMetadata(uri: string): Promise<IMetadata>;
|
|
10
12
|
downloadAnnotationFile(uri: string): Promise<Map<string, any>>;
|
|
11
13
|
getMetadata(id: string): Promise<IMetadata>;
|
|
12
|
-
fetch(repoName: string): Promise<Map<string, string>>;
|
|
14
|
+
fetch(repoName: string, _cachebusterToken: string): Promise<Map<string, string>>;
|
|
13
15
|
}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
1
7
|
import AbapProvider from "./abapProvider.js";
|
|
2
8
|
import { getLogger } from "@ui5/logger";
|
|
3
9
|
import { unzipZipEntries } from "../util/zipUtil.js";
|
|
4
|
-
|
|
10
|
+
import { cached } from "../cache/cacheHolder.js";
|
|
11
|
+
const log = getLogger("@ui5/task-adaptation::AbapRepository");
|
|
5
12
|
const REQUEST_OPTIONS_XML = {
|
|
6
13
|
responseType: "text",
|
|
7
14
|
headers: {
|
|
@@ -13,13 +20,16 @@ const REQUEST_OPTIONS_JSON = {
|
|
|
13
20
|
"Accept": "application/json"
|
|
14
21
|
}
|
|
15
22
|
};
|
|
16
|
-
export default class
|
|
23
|
+
export default class AbapRepository {
|
|
17
24
|
configuration;
|
|
18
25
|
abapProvider;
|
|
19
26
|
constructor(configuration, abapProvider) {
|
|
20
27
|
this.configuration = configuration;
|
|
21
28
|
this.abapProvider = abapProvider ? abapProvider : new AbapProvider();
|
|
22
29
|
}
|
|
30
|
+
fetchReuseLib(_libName, _cachebusterToken, _lib) {
|
|
31
|
+
throw new Error("Preview is not available on SAP S/4HANA On-Premise or Cloud Systems. Please create a ticket on CA-UI5-FL-ADP-BAS component.");
|
|
32
|
+
}
|
|
23
33
|
async getAppVariantIdHierarchy(id) {
|
|
24
34
|
const provider = await this.abapProvider.get(this.configuration);
|
|
25
35
|
const lrep = provider.getLayeredRepository();
|
|
@@ -68,7 +78,7 @@ export default class AbapRepoManager {
|
|
|
68
78
|
id
|
|
69
79
|
};
|
|
70
80
|
}
|
|
71
|
-
async fetch(repoName) {
|
|
81
|
+
async fetch(repoName, _cachebusterToken) {
|
|
72
82
|
const encodedRepoName = encodeURIComponent(repoName);
|
|
73
83
|
const provider = await this.abapProvider.get(this.configuration);
|
|
74
84
|
const ui5Repo = provider.getUi5AbapRepository();
|
|
@@ -87,4 +97,7 @@ export default class AbapRepoManager {
|
|
|
87
97
|
throw new Error(`App '${repoName}' doesn't contain files`);
|
|
88
98
|
}
|
|
89
99
|
}
|
|
90
|
-
|
|
100
|
+
__decorate([
|
|
101
|
+
cached()
|
|
102
|
+
], AbapRepository.prototype, "fetch", null);
|
|
103
|
+
//# sourceMappingURL=abapRepository.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IConfiguration, IReuseLibInfo } from "./../model/types.js";
|
|
2
|
+
import IRepository from "./repository.js";
|
|
3
|
+
import { IAppVariantIdHierarchyItem } from "../model/appVariantIdHierarchyItem.js";
|
|
4
|
+
export default class HTML5Repository implements IRepository {
|
|
5
|
+
private configuration;
|
|
6
|
+
constructor(configuration: IConfiguration);
|
|
7
|
+
getAppVariantIdHierarchy(appId: string): Promise<IAppVariantIdHierarchyItem[]>;
|
|
8
|
+
fetch(_repoName: string, _cachebusterToken: string): Promise<Map<string, string>>;
|
|
9
|
+
fetchReuseLib(_libName: string, _cachebusterToken: string, lib: IReuseLibInfo): Promise<Map<string, string>>;
|
|
10
|
+
getMetadata(): Promise<any>;
|
|
11
|
+
private getHtml5RepoInfo;
|
|
12
|
+
private getHTML5Credentials;
|
|
13
|
+
private getToken;
|
|
14
|
+
private requestMetadata;
|
|
15
|
+
private getAppZipEntries;
|
|
16
|
+
private download;
|
|
17
|
+
downloadAnnotationFile(_uri: string): Promise<Map<string, string>>;
|
|
18
|
+
}
|
|
@@ -1,24 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import CFUtil from "../util/cfUtil.js";
|
|
8
|
+
import RequestUtil from "../util/requestUtil.js";
|
|
3
9
|
import { getLogger } from "@ui5/logger";
|
|
4
|
-
import { unzipZipEntries } from "
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
import { unzipZipEntries } from "../util/zipUtil.js";
|
|
11
|
+
import { cached } from "../cache/cacheHolder.js";
|
|
12
|
+
import { validateConfiguration } from "../util/commonUtil.js";
|
|
13
|
+
const log = getLogger("@ui5/task-adaptation::HTML5Repository");
|
|
14
|
+
export default class HTML5Repository {
|
|
15
|
+
configuration;
|
|
16
|
+
constructor(configuration) {
|
|
17
|
+
this.configuration = configuration;
|
|
18
|
+
validateConfiguration(configuration, ["appHostId", "appName", "appVersion"]);
|
|
19
|
+
}
|
|
20
|
+
async getAppVariantIdHierarchy(appId) {
|
|
21
|
+
const metadata = await this.getMetadata();
|
|
22
|
+
return [{
|
|
23
|
+
repoName: this.configuration.appName,
|
|
24
|
+
appVariantId: appId,
|
|
25
|
+
cachebusterToken: metadata.changedOn
|
|
26
|
+
}];
|
|
15
27
|
}
|
|
16
|
-
|
|
17
|
-
const { token, baseUri } = await this.getHtml5RepoInfo(
|
|
18
|
-
|
|
28
|
+
async fetch(_repoName, _cachebusterToken) {
|
|
29
|
+
const { token, baseUri } = await this.getHtml5RepoInfo();
|
|
30
|
+
const appData = {
|
|
31
|
+
appName: this.configuration.appName,
|
|
32
|
+
appVersion: this.configuration.appVersion,
|
|
33
|
+
appHostId: this.configuration.appHostId
|
|
34
|
+
};
|
|
35
|
+
return this.getAppZipEntries(appData, baseUri, token);
|
|
19
36
|
}
|
|
20
|
-
|
|
21
|
-
const { token, baseUri } = await this.getHtml5RepoInfo(
|
|
37
|
+
async fetchReuseLib(_libName, _cachebusterToken, lib) {
|
|
38
|
+
const { token, baseUri } = await this.getHtml5RepoInfo();
|
|
22
39
|
const libAppData = {
|
|
23
40
|
appName: lib.html5AppName,
|
|
24
41
|
appVersion: lib.html5AppVersion,
|
|
@@ -26,8 +43,12 @@ export default class HTML5RepoManager {
|
|
|
26
43
|
};
|
|
27
44
|
return this.getAppZipEntries(libAppData, baseUri, token);
|
|
28
45
|
}
|
|
29
|
-
|
|
30
|
-
const
|
|
46
|
+
async getMetadata() {
|
|
47
|
+
const { token, baseUri } = await this.getHtml5RepoInfo();
|
|
48
|
+
return this.requestMetadata(baseUri, token);
|
|
49
|
+
}
|
|
50
|
+
async getHtml5RepoInfo() {
|
|
51
|
+
const spaceGuid = await CFUtil.getSpaceGuid(this.configuration?.space);
|
|
31
52
|
const credentials = await this.getHTML5Credentials(spaceGuid);
|
|
32
53
|
const token = await this.getToken(credentials);
|
|
33
54
|
if (!token || token.length === 0) {
|
|
@@ -41,7 +62,7 @@ export default class HTML5RepoManager {
|
|
|
41
62
|
baseUri: credentials.uri
|
|
42
63
|
};
|
|
43
64
|
}
|
|
44
|
-
|
|
65
|
+
async getHTML5Credentials(spaceGuid) {
|
|
45
66
|
log.verbose("Getting HTML5 Repo Runtime credentials from space " + spaceGuid);
|
|
46
67
|
const PLAN_NAME = "app-runtime";
|
|
47
68
|
const SERVIСE_INSTANCE_NAME = "html5-apps-repo-runtime";
|
|
@@ -60,7 +81,7 @@ export default class HTML5RepoManager {
|
|
|
60
81
|
const serviceKeys = await CFUtil.getServiceInstanceKeys(getParams, createParams);
|
|
61
82
|
return serviceKeys.credentials;
|
|
62
83
|
}
|
|
63
|
-
|
|
84
|
+
async getToken({ uaa }) {
|
|
64
85
|
log.verbose("Getting HTML5 Repo token");
|
|
65
86
|
const auth = Buffer.from(uaa.clientid + ":" + uaa.clientsecret);
|
|
66
87
|
const options = {
|
|
@@ -72,8 +93,8 @@ export default class HTML5RepoManager {
|
|
|
72
93
|
const uri = `${uaa.url}/oauth/token?grant_type=client_credentials`;
|
|
73
94
|
return RequestUtil.get(uri, options).then((json) => json["access_token"]);
|
|
74
95
|
}
|
|
75
|
-
|
|
76
|
-
const { appHostId, appName, appVersion } =
|
|
96
|
+
async requestMetadata(html5RepoBaseUri, token) {
|
|
97
|
+
const { appHostId, appName, appVersion } = this.configuration;
|
|
77
98
|
const uri = `${html5RepoBaseUri}/applications/metadata/`;
|
|
78
99
|
const requestOptions = {
|
|
79
100
|
headers: {
|
|
@@ -85,12 +106,12 @@ export default class HTML5RepoManager {
|
|
|
85
106
|
const metadata = await RequestUtil.get(uri, requestOptions);
|
|
86
107
|
return metadata.find((item) => item.appHostId === appHostId && item.applicationName === appName && item.applicationVersion === appVersion);
|
|
87
108
|
}
|
|
88
|
-
|
|
109
|
+
async getAppZipEntries(app, html5RepoBaseUri, token) {
|
|
89
110
|
const uri = `${html5RepoBaseUri}/applications/content/${app.appName}-${app.appVersion}/`;
|
|
90
111
|
const zip = await this.download(token, app.appHostId, uri);
|
|
91
112
|
return unzipZipEntries(zip);
|
|
92
113
|
}
|
|
93
|
-
|
|
114
|
+
async download(token, appHostId, uri) {
|
|
94
115
|
if (!token) {
|
|
95
116
|
throw new Error("HTML5 token is undefined");
|
|
96
117
|
}
|
|
@@ -103,5 +124,15 @@ export default class HTML5RepoManager {
|
|
|
103
124
|
}
|
|
104
125
|
});
|
|
105
126
|
}
|
|
127
|
+
downloadAnnotationFile(_uri) {
|
|
128
|
+
log.verbose("No annotation processing in CF");
|
|
129
|
+
return Promise.resolve(new Map());
|
|
130
|
+
}
|
|
106
131
|
}
|
|
107
|
-
|
|
132
|
+
__decorate([
|
|
133
|
+
cached()
|
|
134
|
+
], HTML5Repository.prototype, "fetch", null);
|
|
135
|
+
__decorate([
|
|
136
|
+
cached()
|
|
137
|
+
], HTML5Repository.prototype, "fetchReuseLib", null);
|
|
138
|
+
//# sourceMappingURL=html5Repository.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IAppVariantIdHierarchyItem } from "../model/appVariantIdHierarchyItem.js";
|
|
2
|
+
import { IConfiguration } from "../model/configuration.js";
|
|
3
|
+
import { IReuseLibInfo } from "../model/types.js";
|
|
4
|
+
import IRepository from "./repository.js";
|
|
5
|
+
export default class LocalRepository implements IRepository {
|
|
6
|
+
private configuration;
|
|
7
|
+
constructor(configuration: IConfiguration);
|
|
8
|
+
downloadAnnotationFile(_uri: string): Promise<Map<string, string>>;
|
|
9
|
+
getAppVariantIdHierarchy(appId: string): Promise<IAppVariantIdHierarchyItem[]>;
|
|
10
|
+
fetch(appId: string, cachebusterToken: string): Promise<Map<string, string>>;
|
|
11
|
+
fetchReuseLib(libName: string, cachebusterToken: string, _lib: IReuseLibInfo): Promise<Map<string, string>>;
|
|
12
|
+
private collectAppVariantIdHierarchyItems;
|
|
13
|
+
private getExistingManifestPath;
|
|
14
|
+
private readFilesInBaseAppDir;
|
|
15
|
+
private getLocalFilesDirectory;
|
|
16
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { getLogger } from "@ui5/logger";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import fs from "node:fs/promises";
|
|
4
|
+
import FsUtil from "../util/fsUtil.js";
|
|
5
|
+
const log = getLogger("@ui5/task-adaptation::LocalRepository");
|
|
6
|
+
export default class LocalRepository {
|
|
7
|
+
configuration;
|
|
8
|
+
constructor(configuration) {
|
|
9
|
+
this.configuration = configuration;
|
|
10
|
+
}
|
|
11
|
+
async downloadAnnotationFile(_uri) {
|
|
12
|
+
log.verbose("Downloading annotation files is not supported in LocalRepository.");
|
|
13
|
+
return new Map();
|
|
14
|
+
}
|
|
15
|
+
async getAppVariantIdHierarchy(appId) {
|
|
16
|
+
const items = [];
|
|
17
|
+
await this.collectAppVariantIdHierarchyItems(appId, items);
|
|
18
|
+
return items;
|
|
19
|
+
}
|
|
20
|
+
fetch(appId, cachebusterToken) {
|
|
21
|
+
return this.readFilesInBaseAppDir(appId, cachebusterToken);
|
|
22
|
+
}
|
|
23
|
+
fetchReuseLib(libName, cachebusterToken, _lib) {
|
|
24
|
+
return this.readFilesInBaseAppDir(libName, cachebusterToken);
|
|
25
|
+
}
|
|
26
|
+
async collectAppVariantIdHierarchyItems(appId, items) {
|
|
27
|
+
const appDir = this.getLocalFilesDirectory(appId);
|
|
28
|
+
const filenames = [
|
|
29
|
+
["manifest.json"],
|
|
30
|
+
["manifest.appdescr_variant"],
|
|
31
|
+
["webapp", "manifest.json"],
|
|
32
|
+
["webapp", "manifest.appdescr_variant"],
|
|
33
|
+
];
|
|
34
|
+
const filepaths = filenames.map((filename) => path.join(appDir, ...filename));
|
|
35
|
+
const existingManifestPath = await this.getExistingManifestPath(filepaths);
|
|
36
|
+
items.push({
|
|
37
|
+
appVariantId: appId,
|
|
38
|
+
repoName: appId,
|
|
39
|
+
cachebusterToken: path.dirname(existingManifestPath)
|
|
40
|
+
});
|
|
41
|
+
if (existingManifestPath.endsWith("manifest.appdescr_variant")) {
|
|
42
|
+
const manifestContent = await fs.readFile(existingManifestPath, "utf-8");
|
|
43
|
+
const manifest = JSON.parse(manifestContent);
|
|
44
|
+
await this.collectAppVariantIdHierarchyItems(manifest.reference, items);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async getExistingManifestPath(filePaths) {
|
|
48
|
+
const existenceChecks = await Promise.all(filePaths.map((filePath) => FsUtil.exists(filePath)));
|
|
49
|
+
const existingIndex = existenceChecks.findIndex((exists) => exists);
|
|
50
|
+
if (existingIndex !== -1) {
|
|
51
|
+
return filePaths[existingIndex];
|
|
52
|
+
}
|
|
53
|
+
throw new Error(`None of the paths exist: '${filePaths.join("', '")}'.`);
|
|
54
|
+
}
|
|
55
|
+
readFilesInBaseAppDir(_appId, cachebusterToken) {
|
|
56
|
+
log.verbose(`Fetching base app files from local directory: ${cachebusterToken}`);
|
|
57
|
+
return FsUtil.readFilesRecursively(cachebusterToken);
|
|
58
|
+
}
|
|
59
|
+
getLocalFilesDirectory(appId) {
|
|
60
|
+
const baseDir = this.configuration.adpDir
|
|
61
|
+
? path.normalize(this.configuration.adpDir).replace(/\\/g, "/").replace(/\/+$/, "").split("/")
|
|
62
|
+
: [".."];
|
|
63
|
+
return path.join(process.cwd(), ...baseDir, appId);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=localRepository.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IAppVariantIdHierarchyItem } from "../model/appVariantIdHierarchyItem.js";
|
|
2
|
+
import { IReuseLibInfo } from "../model/types.js";
|
|
3
|
+
export default interface IRepository {
|
|
4
|
+
getAppVariantIdHierarchy(appId: string): Promise<IAppVariantIdHierarchyItem[]>;
|
|
5
|
+
fetch(repoName: string, cachebusterToken: string): Promise<Map<string, string>>;
|
|
6
|
+
fetchReuseLib(libName: string, cachebusterToken: string, lib: IReuseLibInfo): Promise<Map<string, string>>;
|
|
7
|
+
downloadAnnotationFile(uri: string): Promise<Map<string, string>>;
|
|
8
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IConfiguration } from "../model/types.js";
|
|
2
2
|
import Language from "../model/language.js";
|
|
3
3
|
export declare function dotToUnderscore(value: string): string;
|
|
4
|
+
export declare function validateConfiguration<T extends object>(options: T, properties: Array<keyof T>): void;
|
|
4
5
|
export declare function validateObject<T extends object>(options: T, properties: Array<keyof T>, message: string): void;
|
|
5
6
|
export declare function escapeRegex(update: string): string;
|
|
6
7
|
export declare function insertInArray<T>(array: T[], index: number, insert: T): void;
|
package/dist/util/commonUtil.js
CHANGED
|
@@ -9,6 +9,9 @@ const MANIFEST_CHANGE = "appdescr_";
|
|
|
9
9
|
export function dotToUnderscore(value) {
|
|
10
10
|
return value.replace(/\./g, "_");
|
|
11
11
|
}
|
|
12
|
+
export function validateConfiguration(options, properties) {
|
|
13
|
+
validateObject(options, properties, "should be specified in ui5.yaml configuration");
|
|
14
|
+
}
|
|
12
15
|
export function validateObject(options, properties, message) {
|
|
13
16
|
for (const property of properties) {
|
|
14
17
|
if (!options[property]) {
|
package/dist/util/fsUtil.d.ts
CHANGED
package/dist/util/fsUtil.js
CHANGED
|
@@ -36,5 +36,39 @@ export default class FsUtil {
|
|
|
36
36
|
throw e;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
+
static async readFilesRecursively(rootDirectory) {
|
|
40
|
+
const directoriesToScan = [rootDirectory];
|
|
41
|
+
const fileReadTasks = [];
|
|
42
|
+
while (directoriesToScan.length > 0) {
|
|
43
|
+
const currentDirectory = directoriesToScan.pop();
|
|
44
|
+
if (!currentDirectory) {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
const entries = await fs.readdir(currentDirectory, { withFileTypes: true });
|
|
48
|
+
for (const entry of entries) {
|
|
49
|
+
const entryPath = path.join(currentDirectory, entry.name);
|
|
50
|
+
if (entry.isDirectory()) {
|
|
51
|
+
directoriesToScan.push(entryPath);
|
|
52
|
+
}
|
|
53
|
+
else if (entry.isFile()) {
|
|
54
|
+
fileReadTasks.push((async () => {
|
|
55
|
+
const relativeFilePath = path.relative(rootDirectory, entryPath);
|
|
56
|
+
const content = await fs.readFile(entryPath, "utf-8");
|
|
57
|
+
return [relativeFilePath, content];
|
|
58
|
+
})());
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return new Map(await Promise.all(fileReadTasks));
|
|
63
|
+
}
|
|
64
|
+
static async exists(filePath) {
|
|
65
|
+
try {
|
|
66
|
+
await fs.access(filePath);
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
39
73
|
}
|
|
40
74
|
//# sourceMappingURL=fsUtil.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui5/task-adaptation",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.4-rc.2",
|
|
4
4
|
"description": "Custom task for ui5-builder which allows building UI5 Flexibility Adaptation Projects for SAP BTP, Cloud Foundry environment",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -115,7 +115,10 @@
|
|
|
115
115
|
"src/model/configuration.ts",
|
|
116
116
|
"src/model/appVariantIdHierarchyItem.ts",
|
|
117
117
|
"src/adapters/adapter.ts",
|
|
118
|
-
"src/adapters/previewAdapter.ts"
|
|
118
|
+
"src/adapters/previewAdapter.ts",
|
|
119
|
+
"src/repositories/repository.ts",
|
|
120
|
+
"src/annotations/annotationManager.ts",
|
|
121
|
+
"src/processors/processor.ts"
|
|
119
122
|
],
|
|
120
123
|
"check-coverage": true,
|
|
121
124
|
"statements": 85,
|