@contentstack/cli-cm-clone 1.4.0 → 1.4.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/README.md
CHANGED
|
@@ -15,7 +15,7 @@ $ npm install -g @contentstack/cli-cm-clone
|
|
|
15
15
|
$ csdx COMMAND
|
|
16
16
|
running command...
|
|
17
17
|
$ csdx (--version)
|
|
18
|
-
@contentstack/cli-cm-clone/1.4.
|
|
18
|
+
@contentstack/cli-cm-clone/1.4.2 linux-x64 node-v16.20.0
|
|
19
19
|
$ csdx --help [COMMAND]
|
|
20
20
|
USAGE
|
|
21
21
|
$ csdx COMMAND
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-cm-clone",
|
|
3
3
|
"description": "Contentstack stack clone plugin",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.2",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/rohitmishra209/cli-cm-clone/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@contentstack/cli-cm-export": "^1.
|
|
9
|
-
"@contentstack/cli-cm-import": "^1.
|
|
10
|
-
"@contentstack/cli-command": "^1.2.
|
|
11
|
-
"@contentstack/cli-utilities": "^1.
|
|
12
|
-
"@contentstack/management": "^1.6.1",
|
|
8
|
+
"@contentstack/cli-cm-export": "^1.5.2",
|
|
9
|
+
"@contentstack/cli-cm-import": "^1.5.2",
|
|
10
|
+
"@contentstack/cli-command": "^1.2.3",
|
|
11
|
+
"@contentstack/cli-utilities": "^1.4.0",
|
|
13
12
|
"async": "^3.2.4",
|
|
14
13
|
"chalk": "^4.1.0",
|
|
15
14
|
"child_process": "^1.0.2",
|
|
@@ -28,7 +27,7 @@
|
|
|
28
27
|
"jest": "^29.4.2",
|
|
29
28
|
"mocha": "^10.0.0",
|
|
30
29
|
"nyc": "^15.1.0",
|
|
31
|
-
"oclif": "^3.1
|
|
30
|
+
"oclif": "^3.8.1",
|
|
32
31
|
"sinon": "^15.0.1"
|
|
33
32
|
},
|
|
34
33
|
"engines": {
|
|
@@ -69,4 +68,4 @@
|
|
|
69
68
|
"cm:stack-clone": "O-CLN"
|
|
70
69
|
}
|
|
71
70
|
}
|
|
72
|
-
}
|
|
71
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const { Command } = require('@contentstack/cli-command');
|
|
2
|
-
const { configHandler, flags, isAuthenticated } = require('@contentstack/cli-utilities');
|
|
2
|
+
const { configHandler, flags, isAuthenticated, managementSDKClient } = require('@contentstack/cli-utilities');
|
|
3
3
|
const { CloneHandler } = require('../../../lib/util/clone-handler');
|
|
4
4
|
let config = require('../../../lib/util/dummyConfig.json');
|
|
5
5
|
const path = require('path');
|
|
@@ -74,6 +74,8 @@ class StackCloneCommand extends Command {
|
|
|
74
74
|
config.cdn = this.cdaHost;
|
|
75
75
|
config.pathDir = pathdir;
|
|
76
76
|
const cloneHandler = new CloneHandler(config);
|
|
77
|
+
const managementAPIClient = await managementSDKClient(config);
|
|
78
|
+
cloneHandler.setClient(managementAPIClient);
|
|
77
79
|
cloneHandler.execute().catch();
|
|
78
80
|
};
|
|
79
81
|
|
|
@@ -6,7 +6,6 @@ const chalk = require('chalk');
|
|
|
6
6
|
|
|
7
7
|
let exportCmd = require('@contentstack/cli-cm-export');
|
|
8
8
|
let importCmd = require('@contentstack/cli-cm-import');
|
|
9
|
-
let sdkInstance = require('../../lib/util/contentstack-management-sdk');
|
|
10
9
|
const { CustomAbortController } = require('./abort-controller');
|
|
11
10
|
|
|
12
11
|
const {
|
|
@@ -61,11 +60,13 @@ let master_locale;
|
|
|
61
60
|
class CloneHandler {
|
|
62
61
|
constructor(opt) {
|
|
63
62
|
config = opt;
|
|
64
|
-
client = sdkInstance.Client(config);
|
|
65
63
|
cloneCommand = new Clone();
|
|
66
64
|
this.pathDir = opt.pathDir;
|
|
67
65
|
process.stdin.setMaxListeners(50);
|
|
68
66
|
}
|
|
67
|
+
setClient(managementSDKClient) {
|
|
68
|
+
client = managementSDKClient;
|
|
69
|
+
}
|
|
69
70
|
|
|
70
71
|
handleOrgSelection(options = {}) {
|
|
71
72
|
return new Promise(async (resolve, reject) => {
|
|
@@ -498,6 +499,11 @@ class CloneHandler {
|
|
|
498
499
|
async cmdExport() {
|
|
499
500
|
return new Promise((resolve, reject) => {
|
|
500
501
|
const cmd = ['-k', config.source_stack, '-d', __dirname.split('src')[0] + 'contents'];
|
|
502
|
+
if (config.cloneType === 'a') {
|
|
503
|
+
config.filteredModules = ['stack'].concat(structureList);
|
|
504
|
+
cmd.push('-c');
|
|
505
|
+
cmd.push(path.join(__dirname, 'dummyConfig.json'));
|
|
506
|
+
}
|
|
501
507
|
|
|
502
508
|
if (config.source_alias) {
|
|
503
509
|
cmd.push('-a', config.source_alias);
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const contentstacksdk = require('@contentstack/management');
|
|
2
|
-
|
|
3
|
-
exports.Client = function (config) {
|
|
4
|
-
const option = {
|
|
5
|
-
host: config.host,
|
|
6
|
-
authtoken: config.auth_token,
|
|
7
|
-
maxContentLength: 100000000,
|
|
8
|
-
maxBodyLength: 1000000000,
|
|
9
|
-
logHandler: (_level, _data) => {
|
|
10
|
-
// empty log handler
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
if (config.target_stack) {
|
|
15
|
-
option.api_key = config.target_stack;
|
|
16
|
-
}
|
|
17
|
-
if (config.source_stack) {
|
|
18
|
-
option.api_key = config.source_stack;
|
|
19
|
-
}
|
|
20
|
-
return contentstacksdk.client(option);
|
|
21
|
-
};
|