Skip to content

Commit

Permalink
formatting and used the previous function with changed name for publi…
Browse files Browse the repository at this point in the history
…sh_details
  • Loading branch information
cs-raj committed May 13, 2024
1 parent 65bde50 commit baf92fd
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions packages/contentstack-bulk-publish/src/consumer/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@ function initializeLogger(fileName) {
/* eslint-disable camelcase */
function removePublishDetails(elements) {
if (elements && elements.length > 0) {
elements.map((element) => {
if (element.hasOwnProperty('publish_details')) {
delete element.publish_details;
}
return element;
});
return elements.map(({ publish_details, ...rest }) => rest);
} else {
delete elements.publish_details;
}
Expand All @@ -44,7 +39,13 @@ function displayEntriesDetails(sanitizedData) {

function displayAssetsDetails(sanitizedData) {
sanitizedData.forEach((asset) => {
console.log(chalk.green(`Asset UID '${asset.uid}' ${asset.version ? `and version '${asset.version}'` : ''} ${asset.locale ? `in locale '${asset.locale}'` : ''}`));
console.log(
chalk.green(
`Asset UID '${asset.uid}' ${asset.version ? `and version '${asset.version}'` : ''} ${
asset.locale ? `in locale '${asset.locale}'` : ''
}`,
),
);
});
}
async function publishEntry(data, _config, queue) {
Expand Down Expand Up @@ -467,9 +468,7 @@ async function performBulkUnPublish(data, _config, queue) {
queue.Enqueue(data);
} else {
delete bulkUnPublishObj.stack;
console.log(
chalk.red(`Bulk assets failed to Unpublish with error ${formatError(error)}`),
);
console.log(chalk.red(`Bulk assets failed to Unpublish with error ${formatError(error)}`));
let sanitizedData = removePublishDetails(bulkUnPublishObj.assets);
displayAssetsDetails(sanitizedData);
addLogs(
Expand Down

0 comments on commit baf92fd

Please sign in to comment.