Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CS-44565 - Resolved issue when content not overwritten in import backup folder when using audit fix with import #1356

Merged
merged 4 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading