@contentstack/cli-cm-clone 1.10.0 → 1.10.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 +1 -1
- package/package.json +9 -9
- package/src/commands/cm/stacks/clone.js +21 -24
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ $ npm install -g @contentstack/cli-cm-clone
|
|
|
16
16
|
$ csdx COMMAND
|
|
17
17
|
running command...
|
|
18
18
|
$ csdx (--version)
|
|
19
|
-
@contentstack/cli-cm-clone/1.10.
|
|
19
|
+
@contentstack/cli-cm-clone/1.10.1 darwin-arm64 node-v20.8.0
|
|
20
20
|
$ csdx --help [COMMAND]
|
|
21
21
|
USAGE
|
|
22
22
|
$ csdx COMMAND
|
package/package.json
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-cm-clone",
|
|
3
3
|
"description": "Contentstack stack clone plugin",
|
|
4
|
-
"version": "1.10.
|
|
4
|
+
"version": "1.10.1",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/rohitmishra209/cli-cm-clone/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@contentstack/cli-cm-export": "~1.10.4",
|
|
9
|
-
"@contentstack/cli-cm-import": "~1.13.3",
|
|
10
|
-
"@contentstack/cli-command": "~1.2.16",
|
|
11
|
-
"@contentstack/cli-utilities": "~1.5.11",
|
|
12
8
|
"@colors/colors": "^1.5.0",
|
|
9
|
+
"@contentstack/cli-cm-export": "~1.11.0",
|
|
10
|
+
"@contentstack/cli-cm-import": "~1.14.0",
|
|
11
|
+
"@contentstack/cli-command": "~1.2.16",
|
|
12
|
+
"@contentstack/cli-utilities": "~1.5.12",
|
|
13
13
|
"async": "^3.2.4",
|
|
14
14
|
"chalk": "^4.1.0",
|
|
15
15
|
"child_process": "^1.0.2",
|
|
16
16
|
"fancy-test": "^1.4.10",
|
|
17
17
|
"inquirer": "8.2.4",
|
|
18
|
+
"lodash": "^4.17.20",
|
|
19
|
+
"merge": "^2.1.1",
|
|
18
20
|
"ora": "^5.1.0",
|
|
19
21
|
"prompt": "^1.3.0",
|
|
20
|
-
"rimraf": "^
|
|
21
|
-
"winston": "^3.7.2"
|
|
22
|
-
"merge": "^2.1.1",
|
|
23
|
-
"lodash": "^4.17.20"
|
|
22
|
+
"rimraf": "^5.0.5",
|
|
23
|
+
"winston": "^3.7.2"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@oclif/test": "^2.5.6",
|
|
@@ -2,8 +2,8 @@ const { Command } = require('@contentstack/cli-command');
|
|
|
2
2
|
const { configHandler, flags, isAuthenticated, managementSDKClient } = require('@contentstack/cli-utilities');
|
|
3
3
|
const { CloneHandler } = require('../../../lib/util/clone-handler');
|
|
4
4
|
const path = require('path');
|
|
5
|
-
const rimraf = require('rimraf');
|
|
6
|
-
const merge = require(
|
|
5
|
+
const { rimraf } = require('rimraf');
|
|
6
|
+
const merge = require('merge');
|
|
7
7
|
let pathdir = path.join(__dirname.split('src')[0], 'contents');
|
|
8
8
|
const { readdirSync, readFileSync } = require('fs');
|
|
9
9
|
let config = {};
|
|
@@ -24,17 +24,17 @@ class StackCloneCommand extends Command {
|
|
|
24
24
|
'source-management-token-alias': sourceManagementTokenAlias,
|
|
25
25
|
'destination-management-token-alias': destinationManagementTokenAlias,
|
|
26
26
|
'import-webhook-status': importWebhookStatus,
|
|
27
|
-
|
|
27
|
+
config: externalConfigPath,
|
|
28
28
|
} = cloneCommandFlags;
|
|
29
29
|
|
|
30
30
|
const handleClone = async () => {
|
|
31
31
|
const listOfTokens = configHandler.get('tokens');
|
|
32
32
|
|
|
33
33
|
if (externalConfigPath) {
|
|
34
|
-
let externalConfig = readFileSync(externalConfigPath, 'utf-8')
|
|
34
|
+
let externalConfig = readFileSync(externalConfigPath, 'utf-8');
|
|
35
35
|
externalConfig = JSON.parse(externalConfig);
|
|
36
36
|
config = merge.recursive(config, externalConfig);
|
|
37
|
-
}
|
|
37
|
+
}
|
|
38
38
|
config.forceStopMarketplaceAppsPrompt = yes;
|
|
39
39
|
config.skipAudit = cloneCommandFlags['skip-audit'];
|
|
40
40
|
|
|
@@ -131,26 +131,23 @@ class StackCloneCommand extends Command {
|
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
cleanUp(pathDir, message) {
|
|
135
|
-
|
|
136
|
-
rimraf(pathDir
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
134
|
+
async cleanUp(pathDir, message) {
|
|
135
|
+
try {
|
|
136
|
+
await rimraf(pathDir);
|
|
137
|
+
if (message) {
|
|
138
|
+
// eslint-disable-next-line no-console
|
|
139
|
+
console.log(message);
|
|
140
|
+
}
|
|
141
|
+
} catch (err) {
|
|
142
|
+
if (err) {
|
|
143
|
+
console.log('\nCleaning up');
|
|
144
|
+
const skipCodeArr = ['ENOENT', 'EBUSY', 'EPERM', 'EMFILE', 'ENOTEMPTY'];
|
|
145
145
|
|
|
146
|
-
if (
|
|
147
|
-
|
|
148
|
-
console.log(message);
|
|
146
|
+
if (skipCodeArr.includes(err.code)) {
|
|
147
|
+
process.exit();
|
|
149
148
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
});
|
|
153
|
-
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
154
151
|
}
|
|
155
152
|
|
|
156
153
|
registerCleanupOnInterrupt(pathDir) {
|
|
@@ -256,7 +253,7 @@ b) Structure with content (all modules including entries & assets)
|
|
|
256
253
|
'skip-audit': flags.boolean({
|
|
257
254
|
description: 'Skips the audit fix.',
|
|
258
255
|
}),
|
|
259
|
-
|
|
256
|
+
config: flags.string({
|
|
260
257
|
char: 'c',
|
|
261
258
|
required: false,
|
|
262
259
|
description: 'Path for the external configuration',
|