Skip to content

Commit

Permalink
Merge pull request #1308 from contentstack/fix/CS-43934
Browse files Browse the repository at this point in the history
Updated rimraf version from 3.0.2 to 5.0.5
  • Loading branch information
aman19K authored Feb 23, 2024
2 parents d1060e2 + 92ff5a2 commit 1320755
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 72 deletions.
112 changes: 88 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions packages/contentstack-clone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@
"author": "Contentstack",
"bugs": "https://github.com/rohitmishra209/cli-cm-clone/issues",
"dependencies": {
"@colors/colors": "^1.5.0",
"@contentstack/cli-cm-export": "~1.11.0",
"@contentstack/cli-cm-import": "~1.14.0",
"@contentstack/cli-command": "~1.2.16",
"@contentstack/cli-utilities": "~1.5.13",
"@colors/colors": "^1.5.0",
"async": "^3.2.4",
"chalk": "^4.1.0",
"child_process": "^1.0.2",
"fancy-test": "^1.4.10",
"inquirer": "8.2.4",
"lodash": "^4.17.20",
"merge": "^2.1.1",
"ora": "^5.1.0",
"prompt": "^1.3.0",
"rimraf": "^3.0.2",
"winston": "^3.7.2",
"merge": "^2.1.1",
"lodash": "^4.17.20"
"rimraf": "^5.0.5",
"winston": "^3.7.2"
},
"devDependencies": {
"@oclif/test": "^2.5.6",
Expand Down
45 changes: 21 additions & 24 deletions packages/contentstack-clone/src/commands/cm/stacks/clone.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ const { Command } = require('@contentstack/cli-command');
const { configHandler, flags, isAuthenticated, managementSDKClient } = require('@contentstack/cli-utilities');
const { CloneHandler } = require('../../../lib/util/clone-handler');
const path = require('path');
const rimraf = require('rimraf');
const merge = require("merge")
const { rimraf } = require('rimraf');
const merge = require('merge');
let pathdir = path.join(__dirname.split('src')[0], 'contents');
const { readdirSync, readFileSync } = require('fs');
let config = {};
Expand All @@ -24,17 +24,17 @@ class StackCloneCommand extends Command {
'source-management-token-alias': sourceManagementTokenAlias,
'destination-management-token-alias': destinationManagementTokenAlias,
'import-webhook-status': importWebhookStatus,
'config': externalConfigPath
config: externalConfigPath,
} = cloneCommandFlags;

const handleClone = async () => {
const listOfTokens = configHandler.get('tokens');

if (externalConfigPath) {
let externalConfig = readFileSync(externalConfigPath, 'utf-8')
let externalConfig = readFileSync(externalConfigPath, 'utf-8');
externalConfig = JSON.parse(externalConfig);
config = merge.recursive(config, externalConfig);
}
}
config.forceStopMarketplaceAppsPrompt = yes;
config.skipAudit = cloneCommandFlags['skip-audit'];

Expand Down Expand Up @@ -131,26 +131,23 @@ class StackCloneCommand extends Command {
}
}

cleanUp(pathDir, message) {
return new Promise((resolve) => {
rimraf(pathDir, function (err) {
if (err) {
console.log('\nCleaning up');
const skipCodeArr = ['ENOENT', 'EBUSY', 'EPERM', 'EMFILE', 'ENOTEMPTY'];

if (skipCodeArr.includes(err.code)) {
process.exit();
}
}
async cleanUp(pathDir, message) {
try {
await rimraf(pathDir);
if (message) {
// eslint-disable-next-line no-console
console.log(message);
}
} catch (err) {
if (err) {
console.log('\nCleaning up');
const skipCodeArr = ['ENOENT', 'EBUSY', 'EPERM', 'EMFILE', 'ENOTEMPTY'];

if (message) {
// eslint-disable-next-line no-console
console.log(message);
if (skipCodeArr.includes(err.code)) {
process.exit();
}

resolve();
});
});
}
}
}

registerCleanupOnInterrupt(pathDir) {
Expand Down Expand Up @@ -256,7 +253,7 @@ b) Structure with content (all modules including entries & assets)
'skip-audit': flags.boolean({
description: 'Skips the audit fix.',
}),
'config': flags.string({
config: flags.string({
char: 'c',
required: false,
description: 'Path for the external configuration',
Expand Down
Loading

0 comments on commit 1320755

Please sign in to comment.