@ui5/task-adaptation 1.6.6 → 1.6.7
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 +5 -1
- package/dist/adapters/abapAdapter.d.ts +2 -1
- package/dist/adapters/abapAdapter.js +3 -0
- package/dist/adapters/adapter.d.ts +2 -1
- package/dist/adapters/cfAdapter.d.ts +2 -1
- package/dist/adapters/cfAdapter.js +14 -0
- package/dist/adapters/commands/command.d.ts +7 -7
- package/dist/adapters/commands/command.js +3 -2
- package/dist/adapters/commands/downloadAnnotationsCommand.d.ts +1 -1
- package/dist/adapters/commands/downloadAnnotationsCommand.js +4 -3
- package/dist/adapters/commands/fetchPreviewResourcesCommand.js +4 -2
- package/dist/adapters/commands/filterFilesCommand.d.ts +1 -1
- package/dist/adapters/commands/filterFilesCommand.js +2 -1
- package/dist/adapters/commands/i18nPropertiesMergeCommand.d.ts +1 -1
- package/dist/adapters/commands/i18nPropertiesMergeCommand.js +9 -6
- package/dist/adapters/commands/omitDeletedResourcesCommand.d.ts +1 -1
- package/dist/adapters/commands/omitDeletedResourcesCommand.js +1 -1
- package/dist/adapters/commands/processPreviewResourcesCommand.d.ts +1 -1
- package/dist/adapters/commands/processPreviewResourcesCommand.js +14 -7
- package/dist/adapters/commands/renameFilesCommand.d.ts +10 -2
- package/dist/adapters/commands/renameFilesCommand.js +45 -17
- package/dist/adapters/commands/renameManifestCommand.d.ts +14 -0
- package/dist/adapters/commands/renameManifestCommand.js +32 -0
- package/dist/adapters/commands/writeResourcesCommand.d.ts +1 -1
- package/dist/adapters/commands/xsAppJsonEnhanceRoutesCommand.d.ts +1 -1
- package/dist/adapters/commands/xsAppJsonEnhanceRoutesCommand.js +4 -3
- package/dist/adapters/commands/xsAppJsonMergeCommand.d.ts +1 -1
- package/dist/adapters/commands/xsAppJsonMergeCommand.js +4 -3
- package/dist/adapters/previewAdapter.d.ts +2 -1
- package/dist/adapters/previewAdapter.js +3 -0
- package/dist/annotations/abapAnnotationManager.js +1 -1
- package/dist/annotations/dataSource/dataSourceManager.d.ts +2 -1
- package/dist/annotations/dataSource/dataSourceManager.js +16 -8
- package/dist/appVariant.d.ts +4 -3
- package/dist/appVariant.js +14 -7
- package/dist/baseApp.d.ts +3 -3
- package/dist/baseApp.js +4 -4
- package/dist/bundle.js +24 -8
- package/dist/cache/cacheHolder.d.ts +11 -2
- package/dist/cache/cacheHolder.js +23 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +24 -4
- package/dist/landscapeConfiguration.d.ts +3 -3
- package/dist/landscapeConfiguration.js +38 -28
- package/dist/model/types.d.ts +4 -1
- package/dist/repositories/abapProvider.js +2 -2
- package/dist/repositories/abapRepository.d.ts +1 -1
- package/dist/repositories/cacheRepository.d.ts +10 -0
- package/dist/repositories/cacheRepository.js +29 -0
- package/dist/repositories/html5Repository.d.ts +1 -1
- package/dist/repositories/localRepository.d.ts +1 -1
- package/dist/repositories/repository.d.ts +1 -1
- package/dist/util/commonUtil.d.ts +6 -1
- package/dist/util/commonUtil.js +16 -1
- package/dist/util/fsUtil.d.ts +2 -2
- package/dist/util/fsUtil.js +4 -4
- package/dist/util/manifestUtil.d.ts +6 -0
- package/dist/util/manifestUtil.js +15 -0
- package/dist/util/movingHandler/changeFileMoveHandler.d.ts +3 -3
- package/dist/util/movingHandler/changeFileMoveHandler.js +5 -4
- package/dist/util/renamingHandlers/jsonRenamingHandler.d.ts +6 -5
- package/dist/util/renamingHandlers/jsonRenamingHandler.js +15 -15
- package/dist/util/renamingUtil.d.ts +17 -0
- package/dist/util/renamingUtil.js +102 -81
- package/dist/util/resourceUtil.d.ts +15 -6
- package/dist/util/resourceUtil.js +45 -13
- package/dist/util/validator/abapConnectionValidator.d.ts +5 -0
- package/dist/util/validator/abapConnectionValidator.js +22 -0
- package/dist/util/validator/abapValidator.d.ts +2 -4
- package/dist/util/validator/abapValidator.js +4 -16
- package/dist/util/zipUtil.d.ts +1 -1
- package/dist/util/zipUtil.js +1 -1
- package/package.json +7 -7
- package/types/ui5.d.ts +2 -0
- package/dist/util/renamingHandlers/renamingHandler.d.ts +0 -4
- package/dist/util/renamingHandlers/renamingHandler.js +0 -2
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
import * as resourceFactory from "@ui5/fs/resourceFactory";
|
|
2
2
|
import { posix as path } from "path";
|
|
3
3
|
const UTF8 = "utf8";
|
|
4
|
+
/**
|
|
5
|
+
* Extensions of files whose contents are processed by the adaptation
|
|
6
|
+
* pipeline as text. Anything outside this whitelist is treated as binary
|
|
7
|
+
* (e.g. images, fonts) and is saved to the workspace verbatim by WorkspaceManager.
|
|
8
|
+
*
|
|
9
|
+
* Kept in sync with EXTENSIONS_TO_PROCESS in appVariant.ts.
|
|
10
|
+
*/
|
|
11
|
+
export const TEXT_EXTENSIONS = new Set([
|
|
12
|
+
"js",
|
|
13
|
+
"json",
|
|
14
|
+
"xml",
|
|
15
|
+
"html",
|
|
16
|
+
"properties",
|
|
17
|
+
"change",
|
|
18
|
+
"appdescr_variant",
|
|
19
|
+
"ctrl_variant",
|
|
20
|
+
"ctrl_variant_change",
|
|
21
|
+
"ctrl_variant_management_change",
|
|
22
|
+
"annotation_change",
|
|
23
|
+
"variant",
|
|
24
|
+
"fioriversion",
|
|
25
|
+
"codeChange",
|
|
26
|
+
"xmlViewChange",
|
|
27
|
+
"context",
|
|
28
|
+
]);
|
|
4
29
|
export default class ResourceUtil {
|
|
5
30
|
static getRootFolder(projectNamespace) {
|
|
6
31
|
const newPath = ["/resources"];
|
|
@@ -21,7 +46,7 @@ export default class ResourceUtil {
|
|
|
21
46
|
* NOTE: to write in project folder (folder where 'webapp',
|
|
22
47
|
* 'package.json', 'ui5.yaml' located), use writeInProject method.
|
|
23
48
|
* @param dir The directory to write files to.
|
|
24
|
-
* @param files A Map of file paths and their contents.
|
|
49
|
+
* @param files A Map of file paths and their contents as Buffer.
|
|
25
50
|
* @returns A promise that resolves when all files have been written.
|
|
26
51
|
*/
|
|
27
52
|
static write(dir, files) {
|
|
@@ -30,8 +55,8 @@ export default class ResourceUtil {
|
|
|
30
55
|
virBasePath: "/"
|
|
31
56
|
});
|
|
32
57
|
const promises = [];
|
|
33
|
-
files.forEach((
|
|
34
|
-
const resource =
|
|
58
|
+
files.forEach((content, filename) => {
|
|
59
|
+
const resource = ResourceUtil.createResourceFromContent("/" + filename, content);
|
|
35
60
|
promises.push(fsTarget.write(resource));
|
|
36
61
|
});
|
|
37
62
|
return Promise.all(promises);
|
|
@@ -40,7 +65,7 @@ export default class ResourceUtil {
|
|
|
40
65
|
* Write files to the project folder (folder where 'webapp',
|
|
41
66
|
* 'package.json', 'ui5.yaml' located), use writeInProject method.
|
|
42
67
|
* @param dir The directory to write files to.
|
|
43
|
-
* @param files A Map of file paths and their contents.
|
|
68
|
+
* @param files A Map of file paths and their contents as Buffer.
|
|
44
69
|
* @returns A promise that resolves when all files have been written.
|
|
45
70
|
*/
|
|
46
71
|
static writeInProject(dir, files) {
|
|
@@ -53,22 +78,27 @@ export default class ResourceUtil {
|
|
|
53
78
|
* @param dir The directory to search in.
|
|
54
79
|
* @param pattern The glob pattern to match files, e.g., "/ui5AppInfo.json".
|
|
55
80
|
* @param excludes An array of glob patterns to exclude from the search.
|
|
56
|
-
* @returns A promise that resolves to a Map of file paths and their contents.
|
|
81
|
+
* @returns A promise that resolves to a Map of file paths and their contents as Buffer.
|
|
57
82
|
*/
|
|
58
|
-
static byGlob(dir, pattern, excludes = []) {
|
|
83
|
+
static async byGlob(dir, pattern, excludes = []) {
|
|
59
84
|
const adapter = resourceFactory.createAdapter({
|
|
60
85
|
fsBasePath: dir,
|
|
61
86
|
virBasePath: "/",
|
|
62
87
|
excludes
|
|
63
88
|
});
|
|
64
|
-
|
|
89
|
+
const resources = await adapter.byGlob(pattern);
|
|
90
|
+
const files = new Map();
|
|
91
|
+
for (const resource of resources) {
|
|
92
|
+
files.set(resource.getPath().substring(1), await resource.getBuffer());
|
|
93
|
+
}
|
|
94
|
+
return files;
|
|
65
95
|
}
|
|
66
96
|
/*
|
|
67
97
|
* Search files in the adaptation project (folder where 'webapp',
|
|
68
98
|
* 'package.json', 'ui5.yaml' located), excluding specified glob patterns.
|
|
69
99
|
* @param pattern The glob pattern to match files, e.g., "/ui5AppInfo.json".
|
|
70
100
|
* @param excludes An array of glob patterns to exclude from the search.
|
|
71
|
-
* @returns A promise that resolves to a Map of file paths and their contents.
|
|
101
|
+
* @returns A promise that resolves to a Map of file paths and their contents as Buffer.
|
|
72
102
|
*/
|
|
73
103
|
static byGlobInProject(pattern, excludes = []) {
|
|
74
104
|
return ResourceUtil.byGlob("./", pattern, [
|
|
@@ -87,16 +117,18 @@ export default class ResourceUtil {
|
|
|
87
117
|
resource.setBuffer(Buffer.from(str, UTF8));
|
|
88
118
|
}
|
|
89
119
|
static createResource(filename, projectNamespace, content) {
|
|
90
|
-
return
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
120
|
+
return ResourceUtil.createResourceFromContent(this.getResourcePath(projectNamespace, filename), content);
|
|
121
|
+
}
|
|
122
|
+
static createResourceFromContent(resourcePath, content) {
|
|
123
|
+
return resourceFactory.createResource(Buffer.isBuffer(content)
|
|
124
|
+
? { path: resourcePath, buffer: content }
|
|
125
|
+
: { path: resourcePath, string: content });
|
|
94
126
|
}
|
|
95
127
|
static async toFileMap(resources, projectNamespace) {
|
|
96
128
|
const files = new Map();
|
|
97
129
|
const rootFolderLength = projectNamespace ? ResourceUtil.getRootFolder(projectNamespace).length : 0;
|
|
98
130
|
for (const resource of resources) {
|
|
99
|
-
files.set(resource.getPath().substring(rootFolderLength + 1), await
|
|
131
|
+
files.set(resource.getPath().substring(rootFolderLength + 1), await resource.getBuffer());
|
|
100
132
|
}
|
|
101
133
|
return files;
|
|
102
134
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AbapTarget } from "@sap-ux/system-access";
|
|
2
|
+
import { IAbapTargetMeta } from "../../model/configuration.js";
|
|
3
|
+
export default class AbapConnectionValidator {
|
|
4
|
+
validateAndGetAbapTarget(target: AbapTarget & IAbapTargetMeta | undefined, destination: string | undefined): AbapTarget & IAbapTargetMeta;
|
|
5
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { validateObject } from "../commonUtil.js";
|
|
2
|
+
import { isAppStudio } from "@sap-ux/btp-utils";
|
|
3
|
+
import { getLogger } from "@ui5/logger";
|
|
4
|
+
const log = getLogger("@ui5/task-adaptation::AbapConnectionValidator");
|
|
5
|
+
export default class AbapConnectionValidator {
|
|
6
|
+
validateAndGetAbapTarget(target, destination) {
|
|
7
|
+
if (target) {
|
|
8
|
+
// if target configuration appears, we validate that it should be
|
|
9
|
+
// either target/destination for BAS or target/url for IDE we're
|
|
10
|
+
// trying to detect is it destination for BAS or url for IDE
|
|
11
|
+
const abapTargetProperties = isAppStudio() ? ["destination"] : ["url"];
|
|
12
|
+
validateObject(target, abapTargetProperties, "should be specified in ui5.yaml configuration/target");
|
|
13
|
+
return target;
|
|
14
|
+
}
|
|
15
|
+
else if (destination) {
|
|
16
|
+
log.warn("Destination is deprecated, use target/destination configuration instead");
|
|
17
|
+
return { destination };
|
|
18
|
+
}
|
|
19
|
+
throw new Error("Target should be specified in ui5.yaml configuration to connect the ABAP system");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=abapConnectionValidator.js.map
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { IAbapTargetMeta, IConfiguration, LandscapeType } from "../../model/configuration.js";
|
|
1
|
+
import { IConfiguration, LandscapeType } from "../../model/configuration.js";
|
|
3
2
|
import IValidator from "./validator.js";
|
|
4
3
|
export default class AbapValidator implements IValidator {
|
|
5
4
|
type: LandscapeType;
|
|
6
|
-
|
|
7
|
-
validateConfiguration({ target, destination }: IConfiguration): void;
|
|
5
|
+
validateConfiguration({ destination, target }: IConfiguration): void;
|
|
8
6
|
}
|
|
@@ -1,26 +1,14 @@
|
|
|
1
|
-
import { validateObject } from "../commonUtil.js";
|
|
2
|
-
import { isAppStudio } from "@sap-ux/btp-utils";
|
|
3
1
|
import { getLogger } from "@ui5/logger";
|
|
4
2
|
const log = getLogger("@ui5/task-adaptation::AbapValidator");
|
|
5
3
|
export default class AbapValidator {
|
|
6
4
|
type = "abap";
|
|
7
|
-
|
|
8
|
-
if (target) {
|
|
9
|
-
|
|
10
|
-
// either target/destination for BAS or target/url for IDE we're
|
|
11
|
-
// trying to detect is it destination for BAS or url for IDE
|
|
12
|
-
const abapTargetProperties = isAppStudio() ? ["destination"] : ["url"];
|
|
13
|
-
validateObject(target, abapTargetProperties, "should be specified in ui5.yaml configuration/target");
|
|
14
|
-
return target;
|
|
5
|
+
validateConfiguration({ destination, target }) {
|
|
6
|
+
if (!destination && !target) {
|
|
7
|
+
throw new Error("'target' should be specified in ui5.yaml configuration");
|
|
15
8
|
}
|
|
16
|
-
else if (destination) {
|
|
9
|
+
else if (destination && !target) {
|
|
17
10
|
log.warn("Destination is deprecated, use target/destination configuration instead");
|
|
18
|
-
return { destination };
|
|
19
11
|
}
|
|
20
|
-
throw new Error("Target should be specified in ui5.yaml configuration to connect the ABAP system");
|
|
21
|
-
}
|
|
22
|
-
validateConfiguration({ target, destination }) {
|
|
23
|
-
this.validateAndGetAbapTarget(target, destination);
|
|
24
12
|
}
|
|
25
13
|
}
|
|
26
14
|
//# sourceMappingURL=abapValidator.js.map
|
package/dist/util/zipUtil.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function unzipZipEntries(zip: Buffer): Promise<Map<string,
|
|
1
|
+
export declare function unzipZipEntries(zip: Buffer): Promise<Map<string, Buffer>>;
|
package/dist/util/zipUtil.js
CHANGED
|
@@ -11,6 +11,6 @@ export async function unzipZipEntries(zip) {
|
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
function mapEntries(entries) {
|
|
14
|
-
return new Map(entries.filter(entry => !entry.isDirectory).map(entry => [entry.entryName, entry.getData()
|
|
14
|
+
return new Map(entries.filter(entry => !entry.isDirectory).map(entry => [entry.entryName, entry.getData()]));
|
|
15
15
|
}
|
|
16
16
|
//# sourceMappingURL=zipUtil.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.7",
|
|
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": {
|
|
@@ -32,15 +32,15 @@
|
|
|
32
32
|
"author": "SAP SE",
|
|
33
33
|
"license": "Apache-2.0",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@sap-ux/axios-extension": "^2.0.
|
|
36
|
-
"@sap-ux/btp-utils": "^2.0.
|
|
37
|
-
"@sap-ux/store": "^2.0.
|
|
38
|
-
"@sap-ux/system-access": "^1.0.
|
|
35
|
+
"@sap-ux/axios-extension": "^2.0.8",
|
|
36
|
+
"@sap-ux/btp-utils": "^2.0.6",
|
|
37
|
+
"@sap-ux/store": "^2.0.6",
|
|
38
|
+
"@sap-ux/system-access": "^1.0.10",
|
|
39
39
|
"@sap/cf-tools": "^3.2.2",
|
|
40
40
|
"@ui5/fs": "^4.0.1",
|
|
41
41
|
"@ui5/logger": "^4.0.1",
|
|
42
|
-
"adm-zip": "^0.
|
|
43
|
-
"axios": "^1.
|
|
42
|
+
"adm-zip": "^0.6.0",
|
|
43
|
+
"axios": "^1.18.1",
|
|
44
44
|
"crc": "^4.3.2",
|
|
45
45
|
"dotenv": "^16.0.3",
|
|
46
46
|
"filenamify": "^6.0.0",
|
package/types/ui5.d.ts
CHANGED