@adobe/aem-cs-source-migration-repository-modernizer 1.2.1 → 1.2.3
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 +15 -0
- package/coverage/clover.xml +114 -110
- package/coverage/coverage-final.json +4 -4
- package/coverage/lcov-report/block-navigation.js +9 -1
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +28 -23
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +40 -0
- package/coverage/lcov-report/src/create-base-project-structure.js.html +67 -14
- package/coverage/lcov-report/src/index.html +29 -24
- package/coverage/lcov-report/src/restructure-filters.js.html +16 -11
- package/coverage/lcov-report/src/restructure-pom.js.html +14 -9
- package/coverage/lcov-report/src/util/constants.js.html +8 -3
- package/coverage/lcov-report/src/util/index.html +13 -8
- package/coverage/lcov-report/src/util/pom-manipulation-util.js.html +12 -7
- package/coverage/lcov.info +204 -192
- package/executors/config.yaml +0 -1
- package/junit.xml +39 -39
- package/package.json +3 -3
- package/src/create-base-project-structure.js +18 -2
- package/src/restructure-config.js +35 -3
- package/target/result.log +2 -2
- package/test/create-base-project-structure.test.js +8 -5
- package/test/resources/com.adobe.config.test.cfg.json +1 -0
- package/test/resources/com.adobe.config.test.xml +42 -0
package/junit.xml
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<testsuites name="jest tests" tests="29" failures="0" time="
|
|
3
|
-
<testsuite name="
|
|
4
|
-
<testcase classname="
|
|
2
|
+
<testsuites name="jest tests" tests="29" failures="0" time="6.49">
|
|
3
|
+
<testsuite name="pom manipulation" errors="0" failures="0" skipped="0" timestamp="2026-01-23T09:36:57" time="3.442" tests="10">
|
|
4
|
+
<testcase classname="pom manipulation removeDuplicates" name="pom manipulation removeDuplicates" time="0.006">
|
|
5
5
|
</testcase>
|
|
6
|
-
<testcase classname="
|
|
6
|
+
<testcase classname="pom manipulation removeDuplicate plugins" name="pom manipulation removeDuplicate plugins" time="0">
|
|
7
7
|
</testcase>
|
|
8
|
-
<testcase classname="
|
|
8
|
+
<testcase classname="pom manipulation verifyArtifactPackagingTyperemoveDuplicates" name="pom manipulation verifyArtifactPackagingTyperemoveDuplicates" time="0.001">
|
|
9
9
|
</testcase>
|
|
10
|
-
<testcase classname="
|
|
10
|
+
<testcase classname="pom manipulation verify add plugins" name="pom manipulation verify add plugins" time="0.003">
|
|
11
11
|
</testcase>
|
|
12
|
-
|
|
13
|
-
<testsuite name="pom manipulation" errors="0" failures="0" skipped="0" timestamp="2021-07-20T10:36:09" time="0.304" tests="10">
|
|
14
|
-
<testcase classname="pom manipulation removeDuplicates" name="pom manipulation removeDuplicates" time="0.004">
|
|
15
|
-
</testcase>
|
|
16
|
-
<testcase classname="pom manipulation removeDuplicate plugins" name="pom manipulation removeDuplicate plugins" time="0.001">
|
|
17
|
-
</testcase>
|
|
18
|
-
<testcase classname="pom manipulation verifyArtifactPackagingTyperemoveDuplicates" name="pom manipulation verifyArtifactPackagingTyperemoveDuplicates" time="0">
|
|
12
|
+
<testcase classname="pom manipulation verify add plugins with no pluginManagement tags" name="pom manipulation verify add plugins with no pluginManagement tags" time="0.001">
|
|
19
13
|
</testcase>
|
|
20
|
-
<testcase classname="pom manipulation verify add
|
|
14
|
+
<testcase classname="pom manipulation verify add sdk dependencies" name="pom manipulation verify add sdk dependencies" time="0.001">
|
|
21
15
|
</testcase>
|
|
22
|
-
<testcase classname="pom manipulation verify add
|
|
23
|
-
</testcase>
|
|
24
|
-
<testcase classname="pom manipulation verify add sdk dependencies" name="pom manipulation verify add sdk dependencies" time="0.002">
|
|
25
|
-
</testcase>
|
|
26
|
-
<testcase classname="pom manipulation verify add dependencies" name="pom manipulation verify add dependencies" time="0.001">
|
|
16
|
+
<testcase classname="pom manipulation verify add dependencies" name="pom manipulation verify add dependencies" time="0.002">
|
|
27
17
|
</testcase>
|
|
28
18
|
<testcase classname="pom manipulation embeddedArtifactsToFileVaultPlugin" name="pom manipulation embeddedArtifactsToFileVaultPlugin" time="0.001">
|
|
29
19
|
</testcase>
|
|
30
|
-
<testcase classname="pom manipulation embeddArtifactsUsingTemplate" name="pom manipulation embeddArtifactsUsingTemplate" time="0.
|
|
20
|
+
<testcase classname="pom manipulation embeddArtifactsUsingTemplate" name="pom manipulation embeddArtifactsUsingTemplate" time="0.002">
|
|
31
21
|
</testcase>
|
|
32
22
|
<testcase classname="pom manipulation replaceVariables" name="pom manipulation replaceVariables" time="0.001">
|
|
33
23
|
</testcase>
|
|
34
24
|
</testsuite>
|
|
35
|
-
<testsuite name="restructure
|
|
36
|
-
<testcase classname="restructure
|
|
25
|
+
<testsuite name=" restructure filter" errors="0" failures="0" skipped="0" timestamp="2026-01-23T09:37:01" time="1.826" tests="6">
|
|
26
|
+
<testcase classname=" restructure filter exports" name=" restructure filter exports" time="0.001">
|
|
37
27
|
</testcase>
|
|
38
|
-
<testcase classname="restructure
|
|
28
|
+
<testcase classname=" restructure filter restructure" name=" restructure filter restructure" time="0.013">
|
|
39
29
|
</testcase>
|
|
40
|
-
<testcase classname="restructure
|
|
30
|
+
<testcase classname=" restructure filter restructure project & sub project" name=" restructure filter restructure project & sub project" time="0.005">
|
|
41
31
|
</testcase>
|
|
42
|
-
<testcase classname="restructure
|
|
32
|
+
<testcase classname=" restructure filter segregateFilterPaths" name=" restructure filter segregateFilterPaths" time="0.002">
|
|
43
33
|
</testcase>
|
|
44
|
-
<testcase classname="restructure
|
|
34
|
+
<testcase classname=" restructure filter isImmutableContentFilter" name=" restructure filter isImmutableContentFilter" time="0">
|
|
35
|
+
</testcase>
|
|
36
|
+
<testcase classname=" restructure filter getFiltersFromPomFile" name=" restructure filter getFiltersFromPomFile" time="0.001">
|
|
45
37
|
</testcase>
|
|
46
|
-
|
|
38
|
+
</testsuite>
|
|
39
|
+
<testsuite name="create-base-project-structure" errors="0" failures="0" skipped="0" timestamp="2026-01-23T09:36:57" time="5.554" tests="4">
|
|
40
|
+
<testcase classname="create-base-project-structure check type" name="create-base-project-structure check type" time="0.002">
|
|
41
|
+
</testcase>
|
|
42
|
+
<testcase classname="create-base-project-structure create" name="create-base-project-structure create" time="0.005">
|
|
47
43
|
</testcase>
|
|
48
|
-
<testcase classname="
|
|
44
|
+
<testcase classname="create-base-project-structure create multi project" name="create-base-project-structure create multi project" time="0.005">
|
|
49
45
|
</testcase>
|
|
50
|
-
<testcase classname="
|
|
46
|
+
<testcase classname="create-base-project-structure create project with sub project" name="create-base-project-structure create project with sub project" time="0.005">
|
|
51
47
|
</testcase>
|
|
52
48
|
</testsuite>
|
|
53
|
-
<testsuite name=" restructure
|
|
54
|
-
<testcase classname=" restructure
|
|
49
|
+
<testsuite name=" restructure config" errors="0" failures="0" skipped="0" timestamp="2026-01-23T09:37:02" time="0.206" tests="1">
|
|
50
|
+
<testcase classname=" restructure config formatConfig" name=" restructure config formatConfig" time="0.016">
|
|
55
51
|
</testcase>
|
|
56
|
-
|
|
52
|
+
</testsuite>
|
|
53
|
+
<testsuite name="restructure pom" errors="0" failures="0" skipped="0" timestamp="2026-01-23T09:36:57" time="6.062" tests="8">
|
|
54
|
+
<testcase classname="restructure pom restructure pom" name="restructure pom restructure pom" time="0.175">
|
|
57
55
|
</testcase>
|
|
58
|
-
<testcase classname="
|
|
56
|
+
<testcase classname="restructure pom get dependencies" name="restructure pom get dependencies" time="0.002">
|
|
59
57
|
</testcase>
|
|
60
|
-
<testcase classname="
|
|
58
|
+
<testcase classname="restructure pom get 3rd party dependencies" name="restructure pom get 3rd party dependencies" time="0.001">
|
|
61
59
|
</testcase>
|
|
62
|
-
<testcase classname="
|
|
60
|
+
<testcase classname="restructure pom exports" name="restructure pom exports" time="0">
|
|
63
61
|
</testcase>
|
|
64
|
-
<testcase classname="
|
|
62
|
+
<testcase classname="restructure pom get plugins from pom" name="restructure pom get plugins from pom" time="0.001">
|
|
65
63
|
</testcase>
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
<testcase classname=" restructure
|
|
64
|
+
<testcase classname="restructure pom fetch sdk version" name="restructure pom fetch sdk version" time="0.216">
|
|
65
|
+
</testcase>
|
|
66
|
+
<testcase classname="restructure pom restructure pom multi project" name="restructure pom restructure pom multi project" time="0.084">
|
|
67
|
+
</testcase>
|
|
68
|
+
<testcase classname="restructure pom restructure project & sub project pom" name="restructure pom restructure project & sub project pom" time="0.088">
|
|
69
69
|
</testcase>
|
|
70
70
|
</testsuite>
|
|
71
71
|
</testsuites>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/aem-cs-source-migration-repository-modernizer",
|
|
3
3
|
"description": "AEM as a Cloud Service Project Restructuring tool",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.3",
|
|
5
5
|
"repository": "https://github.com/adobe/aem-cloud-service-source-migration/tree/master/packages/repository-modernizer",
|
|
6
6
|
"author": "Adobe Inc.",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
"test": "jest --coverage"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@adobe/aem-cs-source-migration-commons": "^0.0.
|
|
22
|
+
"@adobe/aem-cs-source-migration-commons": "^0.0.6",
|
|
23
|
+
"dirty-json": "^0.9.2",
|
|
23
24
|
"fs-extra": "^9.0.0",
|
|
24
25
|
"js-yaml": "^3.14.0",
|
|
25
26
|
"node-fetch": "^2.6.1",
|
|
26
|
-
"node-pom-parser": "^0.1.1",
|
|
27
27
|
"rewire": "^5.0.0",
|
|
28
28
|
"stdout-stderr": "^0.1.9",
|
|
29
29
|
"winston": "^3.2.1",
|
|
@@ -22,9 +22,25 @@ const constants = require("./util/constants");
|
|
|
22
22
|
const path = require("path");
|
|
23
23
|
const fs = require("fs");
|
|
24
24
|
const fsExtra = require("fs-extra");
|
|
25
|
-
const
|
|
25
|
+
const xmlJs = require("xml-js");
|
|
26
26
|
let allPackagePomFile = "",
|
|
27
27
|
analysePackagePomFile = "";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Parse a POM file and extract artifactId and version
|
|
31
|
+
* @param {string} filePath - Path to the POM file
|
|
32
|
+
* @returns {object} Object containing artifactId and version
|
|
33
|
+
*/
|
|
34
|
+
function parsePomFile(filePath) {
|
|
35
|
+
const xmlContent = fs.readFileSync(filePath, "utf8");
|
|
36
|
+
const result = xmlJs.xml2js(xmlContent, { compact: true });
|
|
37
|
+
const project = result.project || {};
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
artifactId: project.artifactId && project.artifactId._text,
|
|
41
|
+
version: project.version && project.version._text,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
28
44
|
var CreateBaseProjectStructure = {
|
|
29
45
|
/**
|
|
30
46
|
*
|
|
@@ -629,7 +645,7 @@ function copyModuleFromSource(
|
|
|
629
645
|
destinationFolderPath
|
|
630
646
|
)
|
|
631
647
|
);
|
|
632
|
-
let pom =
|
|
648
|
+
let pom = parsePomFile(pomFile);
|
|
633
649
|
if (typeof pom.version === "undefined") {
|
|
634
650
|
logger.warn(
|
|
635
651
|
pomFile +
|
|
@@ -21,6 +21,7 @@ const constants = require("./util/constants");
|
|
|
21
21
|
const fs = require("fs");
|
|
22
22
|
const path = require("path");
|
|
23
23
|
const xmljs = require("xml-js");
|
|
24
|
+
const dJSON = require("dirty-json");
|
|
24
25
|
|
|
25
26
|
var RestructureContent = {
|
|
26
27
|
/**
|
|
@@ -504,10 +505,11 @@ async function formatConfig(osgiConfigFilePath, conversionStep) {
|
|
|
504
505
|
*/
|
|
505
506
|
function removeUnwantedChars(key, val, filePath) {
|
|
506
507
|
//replace \ with empty space
|
|
507
|
-
val = val.replace(/\\/g, "");
|
|
508
508
|
let str = "";
|
|
509
509
|
if (filePath.endsWith(constants.XML_EXTENSION)) {
|
|
510
510
|
if (val.charAt(0) == "{") {
|
|
511
|
+
//json element logic
|
|
512
|
+
val = val.replace(/\\/g, "");
|
|
511
513
|
let type;
|
|
512
514
|
if (
|
|
513
515
|
constants.ALL_CONFIGS_TYPES.includes(
|
|
@@ -529,20 +531,50 @@ function removeUnwantedChars(key, val, filePath) {
|
|
|
529
531
|
str = '"' + key + ":" + type + '"' + ":" + val;
|
|
530
532
|
}
|
|
531
533
|
} else if (val.charAt(0) == "[") {
|
|
534
|
+
//json array logic
|
|
532
535
|
str = '"' + key + '"' + ":" + "[";
|
|
533
536
|
let tokens = val.substring(1, val.indexOf("]"));
|
|
537
|
+
|
|
534
538
|
if (tokens.length > 0) {
|
|
535
539
|
tokens = tokens.split(",");
|
|
536
540
|
for (let i = 0; i < tokens.length; i++) {
|
|
537
541
|
if (i == tokens.length - 1) {
|
|
538
|
-
|
|
542
|
+
if (
|
|
543
|
+
tokens[i].trim().charAt(0) == "{" ||
|
|
544
|
+
tokens[i].trim().charAt(0) == "["
|
|
545
|
+
) {
|
|
546
|
+
//remove \\ and \u002c which is encoded ','
|
|
547
|
+
const modifiedStr = tokens[i]
|
|
548
|
+
.trim()
|
|
549
|
+
.replace(/\\u002c/g, "")
|
|
550
|
+
.replace(/\\/g, "");
|
|
551
|
+
//remove errors from dirty json
|
|
552
|
+
const json = dJSON.parse(modifiedStr);
|
|
553
|
+
str = str + JSON.stringify(json);
|
|
554
|
+
} else {
|
|
555
|
+
str = str + '"' + tokens[i] + '"';
|
|
556
|
+
}
|
|
539
557
|
} else {
|
|
540
|
-
|
|
558
|
+
if (
|
|
559
|
+
tokens[i].trim().charAt(0) == "{" ||
|
|
560
|
+
tokens[i].trim().charAt(0) == "["
|
|
561
|
+
) {
|
|
562
|
+
const modifiedStr = tokens[i]
|
|
563
|
+
.trim()
|
|
564
|
+
.replace(/\\u002c/g, "")
|
|
565
|
+
.replace(/\\/g, "");
|
|
566
|
+
const json = dJSON.parse(modifiedStr);
|
|
567
|
+
str = str + JSON.stringify(json) + ",";
|
|
568
|
+
} else {
|
|
569
|
+
str = str + '"' + tokens[i] + '"' + ",";
|
|
570
|
+
}
|
|
541
571
|
}
|
|
542
572
|
}
|
|
543
573
|
}
|
|
574
|
+
|
|
544
575
|
str = str + "]";
|
|
545
576
|
} else {
|
|
577
|
+
val = val.replace(/\\/g, "");
|
|
546
578
|
val = val.replace(/[^\x20-\x7E]/gim, "");
|
|
547
579
|
str = '"' + key + '"' + ":" + '"' + val + '"';
|
|
548
580
|
}
|
package/target/result.log
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
Fri, 23 Jan 2026 09:37:03 | info: RestructureConfig: Formatted OSGi config file 'com.adobe.config.test.xml' to 'com.adobe.config.test.cfg.json'.
|
|
2
|
+
Fri, 23 Jan 2026 09:37:03 | info: RestructureConfig: Formatted OSGi config file 'com.adobe.test.config' to 'com.adobe.test.cfg.json'.
|
|
@@ -13,12 +13,15 @@ jest.mock("@adobe/aem-cs-source-migration-commons");
|
|
|
13
13
|
jest.mock("../src/util/pom-manipulation-util");
|
|
14
14
|
jest.mock("fs");
|
|
15
15
|
jest.mock("fs-extra");
|
|
16
|
-
jest.mock("
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
jest.mock("xml-js", () => {
|
|
17
|
+
return {
|
|
18
|
+
xml2js: jest.fn(() => ({
|
|
19
|
+
project: {
|
|
20
|
+
artifactId: { _text: "test.artifactId" },
|
|
21
|
+
version: { _text: "1.0.0" },
|
|
22
|
+
},
|
|
23
|
+
})),
|
|
20
24
|
};
|
|
21
|
-
return { parsePom: jest.fn(() => pomObj) };
|
|
22
25
|
});
|
|
23
26
|
|
|
24
27
|
const {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
+
"localeLangSettings":[{"localeLanguage":"us-en_us","destinationPath":"/content/hbtbt/us/en/products","byCategoryPath":"/content/hbtbt/us/en/products/by-category","categoryFragmentPath":"/content/experience-fragments/hbtbt/us/en/products","alternativeProductsTitle":"Related Products","productDocumentType":"Product","navigationTitle":"","heroTitleField":"longLabel"},{"localeLanguage":"in-en","destinationPath":"/content/hbtbt/in/en/products","byCategoryPath":"/content/hbtbt/in/en/products/by-category","categoryFragmentPath":"/content/experience-fragments/hbtbt/in/en/products","alternativeProductsTitle":"Related Products","productDocumentType":"Product","navigationTitle":"","heroTitleField":"longLabel"},{"localeLanguage":"gb-en_gb","destinationPath":"/content/hbtbt/gb/en/products","byCategoryPath":"/content/hbtbt/gb/en/products/by-category","categoryFragmentPath":"/content/experience-fragments/hbtbt/gb/en/products","alternativeProductsTitle":"Related Products","productDocumentType":"Product","navigationTitle":"","heroTitleField":"longLabel"},{"localeLanguage":"de-de_de","destinationPath":"/content/hbtbt/de/de/products","byCategoryPath":"/content/hbtbt/de/de/products/by-category","categoryFragmentPath":"/content/experience-fragments/hbtbt/de/de/products","alternativeProductsTitle":"Related Products","productDocumentType":"Product","navigationTitle":"","heroTitleField":"longLabel"}],
|
|
2
3
|
"enabled:Boolean":true,
|
|
3
4
|
"error-page.system-path":"/content/404",
|
|
4
5
|
"serve-authenticated-from-cache:Boolean":true,
|
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
|
|
3
3
|
jcr:primaryType="sling:OsgiConfig"
|
|
4
|
+
localeLangSettings="[
|
|
5
|
+
{
|
|
6
|
+
localeLanguage:'us-en_us'\u002c
|
|
7
|
+
destinationPath:'/content/hbtbt/us/en/products'\u002c
|
|
8
|
+
byCategoryPath:'/content/hbtbt/us/en/products/by-category'\u002c
|
|
9
|
+
categoryFragmentPath:'/content/experience-fragments/hbtbt/us/en/products'\u002c
|
|
10
|
+
alternativeProductsTitle:'Related Products'\u002c
|
|
11
|
+
productDocumentType:'Product'\u002c
|
|
12
|
+
navigationTitle:''\u002c
|
|
13
|
+
heroTitleField:'longLabel'
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
localeLanguage:'in-en'\u002c
|
|
17
|
+
destinationPath:'/content/hbtbt/in/en/products'\u002c
|
|
18
|
+
byCategoryPath:'/content/hbtbt/in/en/products/by-category'\u002c
|
|
19
|
+
categoryFragmentPath:'/content/experience-fragments/hbtbt/in/en/products'\u002c
|
|
20
|
+
alternativeProductsTitle:'Related Products'\u002c
|
|
21
|
+
productDocumentType:'Product'\u002c
|
|
22
|
+
navigationTitle:''\u002c
|
|
23
|
+
heroTitleField:'longLabel'
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
localeLanguage:'gb-en_gb'\u002c
|
|
27
|
+
destinationPath:'/content/hbtbt/gb/en/products'\u002c
|
|
28
|
+
byCategoryPath:'/content/hbtbt/gb/en/products/by-category'\u002c
|
|
29
|
+
categoryFragmentPath:'/content/experience-fragments/hbtbt/gb/en/products'\u002c
|
|
30
|
+
alternativeProductsTitle:'Related Products'\u002c
|
|
31
|
+
productDocumentType:'Product'\u002c
|
|
32
|
+
navigationTitle:''\u002c
|
|
33
|
+
heroTitleField:'longLabel'
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
localeLanguage:'de-de_de'\u002c
|
|
37
|
+
destinationPath:'/content/hbtbt/de/de/products'\u002c
|
|
38
|
+
byCategoryPath:'/content/hbtbt/de/de/products/by-category'\u002c
|
|
39
|
+
categoryFragmentPath:'/content/experience-fragments/hbtbt/de/de/products'\u002c
|
|
40
|
+
alternativeProductsTitle:'Related Products'\u002c
|
|
41
|
+
productDocumentType:'Product'\u002c
|
|
42
|
+
navigationTitle:''\u002c
|
|
43
|
+
heroTitleField:'longLabel'
|
|
44
|
+
}
|
|
45
|
+
]"
|
|
4
46
|
enabled="{Boolean}true"
|
|
5
47
|
error-page.system-path="{String}/content/404"
|
|
6
48
|
serve-authenticated-from-cache="{Boolean}true"
|