@contentstack/cli-cm-import-setup 1.0.0 → 1.0.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/README.md
CHANGED
|
@@ -47,7 +47,7 @@ $ npm install -g @contentstack/cli-cm-import-setup
|
|
|
47
47
|
$ csdx COMMAND
|
|
48
48
|
running command...
|
|
49
49
|
$ csdx (--version)
|
|
50
|
-
@contentstack/cli-cm-import-setup/1.0.
|
|
50
|
+
@contentstack/cli-cm-import-setup/1.0.1 linux-x64 node-v18.20.6
|
|
51
51
|
$ csdx --help [COMMAND]
|
|
52
52
|
USAGE
|
|
53
53
|
$ csdx COMMAND
|
|
@@ -41,20 +41,27 @@ class ImportSetup {
|
|
|
41
41
|
* @returns {Promise<Array<void | string>>}
|
|
42
42
|
*/
|
|
43
43
|
async generateDependencyTree() {
|
|
44
|
-
const
|
|
44
|
+
const visited = new Set();
|
|
45
|
+
const assignedDependencies = new Set(); // Track assigned dependencies
|
|
46
|
+
const getAllDependencies = (module) => {
|
|
45
47
|
var _a;
|
|
46
48
|
if (visited.has(module))
|
|
47
49
|
return [];
|
|
48
50
|
visited.add(module);
|
|
49
|
-
|
|
51
|
+
const dependencies = ((_a = this.config.modules[module]) === null || _a === void 0 ? void 0 : _a.dependencies) || [];
|
|
52
|
+
let allDeps = [...dependencies];
|
|
50
53
|
for (const dependency of dependencies) {
|
|
51
|
-
|
|
54
|
+
allDeps.push(...getAllDependencies(dependency));
|
|
52
55
|
}
|
|
53
|
-
return
|
|
56
|
+
return allDeps;
|
|
54
57
|
};
|
|
58
|
+
this.dependencyTree = {}; // Reset before building
|
|
55
59
|
for (const module of this.config.selectedModules) {
|
|
56
|
-
|
|
57
|
-
|
|
60
|
+
let allDependencies = getAllDependencies(module);
|
|
61
|
+
allDependencies = allDependencies.filter((dep) => !assignedDependencies.has(dep)); // Remove assigned ones
|
|
62
|
+
this.dependencyTree[module] = allDependencies;
|
|
63
|
+
// Mark these dependencies as assigned so they won't be included in later modules
|
|
64
|
+
allDependencies.forEach((dep) => assignedDependencies.add(dep));
|
|
58
65
|
}
|
|
59
66
|
}
|
|
60
67
|
/**
|
|
@@ -37,7 +37,7 @@ class ExtensionImportSetup {
|
|
|
37
37
|
(0, utils_1.log)(this.config, `The required setup files for extensions have been generated successfully.`, 'success');
|
|
38
38
|
}
|
|
39
39
|
else {
|
|
40
|
-
(0, utils_1.log)(this.config, 'No extensions found in the content folder.', '
|
|
40
|
+
(0, utils_1.log)(this.config, 'No extensions found in the content folder.', 'info');
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
catch (error) {
|
|
@@ -56,7 +56,12 @@ class marketplaceAppImportSetup {
|
|
|
56
56
|
createMapper(sourceMarketplaceApps, targetMarketplaceApps) {
|
|
57
57
|
sourceMarketplaceApps.forEach((sourceApp) => {
|
|
58
58
|
// Find matching target item based on manifest.name
|
|
59
|
-
|
|
59
|
+
// TBD: This logic is not foolproof, need to find a better way to match source and target apps
|
|
60
|
+
// Reason: While importing apps, if an app exist in the target with the same name, it will be a conflict and will not be imported
|
|
61
|
+
// So, import command gives an option to import the app with a different name by appending ◈ to the app name. Considering this we are matching the app name without the ◈ character
|
|
62
|
+
const getAppName = (app) => (0, lodash_1.get)(app, 'manifest.name', '').split('◈')[0];
|
|
63
|
+
const sourceAppName = getAppName(sourceApp);
|
|
64
|
+
const targetApp = targetMarketplaceApps.find((app) => getAppName(app) === sourceAppName);
|
|
60
65
|
if (targetApp) {
|
|
61
66
|
// Map app_uid from source and target
|
|
62
67
|
this.marketplaceAppMapper.app_uid[sourceApp.manifest.uid] = targetApp.manifest.uid;
|
|
@@ -75,6 +80,9 @@ class marketplaceAppImportSetup {
|
|
|
75
80
|
}
|
|
76
81
|
});
|
|
77
82
|
}
|
|
83
|
+
else {
|
|
84
|
+
(0, utils_1.log)(this.config, `No matching Marketplace app found in the target stack with name ${sourceAppName}`, 'info');
|
|
85
|
+
}
|
|
78
86
|
});
|
|
79
87
|
}
|
|
80
88
|
}
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-cm-import-setup",
|
|
3
3
|
"description": "Contentstack CLI plugin to setup the mappers and configurations for the import command",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
7
7
|
"dependencies": {
|