@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 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.0 darwin-arm64 node-v20.8.0
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.0",
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": "^3.0.2",
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("merge")
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
- 'config': externalConfigPath
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
- return new Promise((resolve) => {
136
- rimraf(pathDir, function (err) {
137
- if (err) {
138
- console.log('\nCleaning up');
139
- const skipCodeArr = ['ENOENT', 'EBUSY', 'EPERM', 'EMFILE', 'ENOTEMPTY'];
140
-
141
- if (skipCodeArr.includes(err.code)) {
142
- process.exit();
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 (message) {
147
- // eslint-disable-next-line no-console
148
- console.log(message);
146
+ if (skipCodeArr.includes(err.code)) {
147
+ process.exit();
149
148
  }
150
-
151
- resolve();
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
- 'config': flags.string({
256
+ config: flags.string({
260
257
  char: 'c',
261
258
  required: false,
262
259
  description: 'Path for the external configuration',