Skip to content

Commit

Permalink
Merge pull request #1356 from contentstack/bugfix/CS-44565
Browse files Browse the repository at this point in the history
CS-44565 - Resolved issue when content not overwritten in import backup folder when using audit fix with import
  • Loading branch information
cs-raj authored Mar 27, 2024
2 parents 2761d68 + f3a9a8b commit 0039ba1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/contentstack-audit/src/modules/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export default class Extensions {
this.fix &&
(this.config.flags['copy-dir'] ||
this.config.flags['external-config']?.skipConfirm ||
this.config.flags.yes ||
(await ux.confirm(commonMsg.FIX_CONFIRMATION)))
) {
writeFileSync(
Expand Down
7 changes: 4 additions & 3 deletions packages/contentstack-audit/src/modules/workflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ export default class Workflows {
return {};
}


this.workflowPath = join(this.folderPath, this.fileName);
this.workflowSchema = existsSync(this.workflowPath)
? values(JSON.parse(readFileSync(this.workflowPath, 'utf8')) as Workflow[])
Expand Down Expand Up @@ -146,8 +145,10 @@ export default class Workflows {
async writeFixContent(newWorkflowSchema: Record<string, Workflow>) {
if (
this.fix &&
!(this.config.flags['copy-dir'] || this.config.flags['external-config']?.skipConfirm) &&
(this.config.flags.yes || (await ux.confirm(commonMsg.FIX_CONFIRMATION)))
(this.config.flags['copy-dir'] ||
this.config.flags['external-config']?.skipConfirm ||
this.config.flags.yes ||
(await ux.confirm(commonMsg.FIX_CONFIRMATION)))
) {
writeFileSync(
join(this.folderPath, this.config.moduleConfig[this.moduleName].fileName),
Expand Down
9 changes: 8 additions & 1 deletion packages/contentstack-migration/src/utils/error-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,15 @@ module.exports = (errors, filePath) => {
messages.push(`${fileErrorsMessage}${errorMessages}`);
logger.log('error', errorLogs);
}
if (errors?.request) {
errors.data = errors.request?.data;
delete errors.request;
}
if (errors?.message) {
delete errors.message;
}
if (isEmpty(messages) && errors !== undefined && isEmpty(errorsByFile)) {
logger.log('error', errors);
logger.log('error', { errors: errors });
console.log(chalk`{bold.red Migration unsuccessful}`);
} else {
logger.log('error', { error: messages.join('\n') });
Expand Down

0 comments on commit 0039ba1

Please sign in to comment.