diff --git a/packages/contentstack-bulk-publish/README.md b/packages/contentstack-bulk-publish/README.md index c691c6ad7a..19f74b118e 100644 --- a/packages/contentstack-bulk-publish/README.md +++ b/packages/contentstack-bulk-publish/README.md @@ -36,7 +36,7 @@ USAGE * [`csdx cm:assets:publish [-a ] [--retry-failed ] [-e ] [--folder-uid ] [--bulk-publish ] [-c ] [-y] [--locales ] [--branch ] [--delivery-token ] [--source-env ]`](#csdx-cmassetspublish--a-value---retry-failed-value--e-value---folder-uid-value---bulk-publish-value--c-value--y---locales-value---branch-value---delivery-token-value---source-env-value-1) * [`csdx cm:bulk-publish:clear`](#csdx-cmbulk-publishclear) * [`csdx cm:bulk-publish:configure`](#csdx-cmbulk-publishconfigure) -* [`csdx cm:bulk-publish:cross-publish [-a ] [--retry-failed ] [--bulk-publish ] [--content-type ] [--locales ] [--source-env ] [--environments ] [--delivery-token ] [-c ] [-y] [--branch ] [--onlyAssets] [--onlyEntries]`](#csdx-cmbulk-publishcross-publish--a-value---retry-failed-value---bulk-publish-value---content-type-value---locales-value---source-env-value---environments-value---delivery-token-value--c-value--y---branch-value---onlyassets---onlyentries) +* [`csdx cm:bulk-publish:cross-publish [-a ] [--retry-failed ] [--bulk-publish ] [--content-type ] [--locales ] [--source-env ] [--environments ] [--delivery-token ] [-c ] [-y] [--branch ] [--onlyAssets] [--onlyEntries] [--include-variants]`](#csdx-cmbulk-publishcross-publish--a-value---retry-failed-value---bulk-publish-value---content-type-value---locales-value---source-env-value---environments-value---delivery-token-value--c-value--y---branch-value---onlyassets---onlyentries---include-variants) * [`csdx cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ] [--delivery-token ] [--source-env ] [--entry-uid ] [--include-variants]`](#csdx-cmentriespublish--a-value---retry-failed-value---bulk-publish-value---publish-all-content-types---content-types-value---locales-value--e-value--c-value--y---branch-value---delivery-token-value---source-env-value---entry-uid-value---include-variants) * [`csdx cm:entries:publish-modified [-a ] [--retry-failed ] [--bulk-publish ] [--source-env ] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ]`](#csdx-cmentriespublish-modified--a-value---retry-failed-value---bulk-publish-value---source-env-value---content-types-value---locales-value--e-value--c-value--y---branch-value) * [`csdx cm:entries:publish-non-localized-fields [-a ] [--retry-failed ] [--bulk-publish ] [--source-env ] [--content-types ] [-e ] [-c ] [-y] [--branch ]`](#csdx-cmentriespublish-non-localized-fields--a-value---retry-failed-value---bulk-publish-value---source-env-value---content-types-value--e-value--c-value--y---branch-value) @@ -422,7 +422,7 @@ EXAMPLES $ csdx cm:stacks:publish-configure --stack-api-key ``` -## `csdx cm:bulk-publish:cross-publish [-a ] [--retry-failed ] [--bulk-publish ] [--content-type ] [--locales ] [--source-env ] [--environments ] [--delivery-token ] [-c ] [-y] [--branch ] [--onlyAssets] [--onlyEntries]` +## `csdx cm:bulk-publish:cross-publish [-a ] [--retry-failed ] [--bulk-publish ] [--content-type ] [--locales ] [--source-env ] [--environments ] [--delivery-token ] [-c ] [-y] [--branch ] [--onlyAssets] [--onlyEntries] [--include-variants]` Publish entries and assets from one environment to other environments @@ -430,7 +430,7 @@ Publish entries and assets from one environment to other environments USAGE $ csdx cm:bulk-publish:cross-publish [-a ] [--retry-failed ] [--bulk-publish ] [--content-type ] [--locales ] [--source-env ] [--environments ] [--delivery-token ] [-c ] - [-y] [--branch ] [--onlyAssets] [--onlyEntries] + [-y] [--branch ] [--onlyAssets] [--onlyEntries] [--include-variants] FLAGS -B, --branch= [default: main] Specify the branch to fetch the content (by default the main branch is @@ -445,6 +445,7 @@ FLAGS --content-type=... The Contenttypes from which entries will be published --delivery-token= Delivery token for source environment --environments=... Destination Environments + --include-variants Include Variants flag will publish all associated variant entries. --locales= Source locale --onlyAssets Unpublish only assets --onlyEntries Unpublish only entries @@ -495,6 +496,12 @@ EXAMPLES Using --stack-api-key flag $ csdx cm:bulk-publish:cross-publish --content-type [CONTENT TYPE] --source-env [SOURCE ENV] --environments [DESTINATION ENVIRONMENT] --locales [LOCALE] --stack-api-key [STACK API KEY] --delivery-token [DELIVERY TOKEN] + + + + Using --include-variants flag + + $ csdx cm:bulk-publish:cross-publish --content-type [CONTENT TYPE] --source-env [SOURCE ENV] --environments [DESTINATION ENVIRONMENT] --locales [LOCALE] --stack-api-key [STACK API KEY] --delivery-token [DELIVERY TOKEN] [--include-variants] ``` _See code: [src/commands/cm/bulk-publish/cross-publish.js](https://github.com/contentstack/cli/blob/main/packages/contentstack-bulk-publish/src/commands/cm/bulk-publish/cross-publish.js)_ diff --git a/packages/contentstack-bulk-publish/src/commands/cm/bulk-publish/cross-publish.js b/packages/contentstack-bulk-publish/src/commands/cm/bulk-publish/cross-publish.js index 63638b8bfa..469f6f5056 100644 --- a/packages/contentstack-bulk-publish/src/commands/cm/bulk-publish/cross-publish.js +++ b/packages/contentstack-bulk-publish/src/commands/cm/bulk-publish/cross-publish.js @@ -46,7 +46,7 @@ class CrossPublishCommand extends Command { updatedFlags.deliveryToken = await cliux.prompt('Enter delivery token of your source environment'); } updatedFlags.bulkPublish = updatedFlags.bulkPublish === 'false' ? false : true; - + updatedFlags.includeVariants = updatedFlags.includeVariants === false ? false : true; stack = await getStack(config); } @@ -155,6 +155,10 @@ class CrossPublishCommand extends Command { _flags.deliveryToken = _flags['delivery-token']; delete _flags['delivery-token']; } + if ('include-variants' in _flags) { + _flags.includeVariants = _flags['include-variants']; + delete _flags['include-variants']; + } return _flags; } } @@ -257,6 +261,10 @@ CrossPublishCommand.flags = { }), onlyAssets: flags.boolean({ description: 'Unpublish only assets', default: false }), onlyEntries: flags.boolean({ description: 'Unpublish only entries', default: false }), + 'include-variants': flags.boolean({ + description: 'Include Variants flag will publish all associated variant entries.', + default: false, + }), }; CrossPublishCommand.examples = [ @@ -278,8 +286,11 @@ CrossPublishCommand.examples = [ 'Using --stack-api-key flag', 'csdx cm:bulk-publish:cross-publish --content-type [CONTENT TYPE] --source-env [SOURCE ENV] --environments [DESTINATION ENVIRONMENT] --locales [LOCALE] --stack-api-key [STACK API KEY] --delivery-token [DELIVERY TOKEN]', '', + 'Using --include-variants flag', + 'csdx cm:bulk-publish:cross-publish --content-type [CONTENT TYPE] --source-env [SOURCE ENV] --environments [DESTINATION ENVIRONMENT] --locales [LOCALE] --stack-api-key [STACK API KEY] --delivery-token [DELIVERY TOKEN] [--include-variants]', + '', ]; -CrossPublishCommand.usage = `cm:bulk-publish:cross-publish [-a ] [--retry-failed ] [--bulk-publish ] [--content-type ] [--locales ] [--source-env ] [--environments ] [--delivery-token ] [-c ] [-y] [--branch ] [--onlyAssets] [--onlyEntries]`; +CrossPublishCommand.usage = `cm:bulk-publish:cross-publish [-a ] [--retry-failed ] [--bulk-publish ] [--content-type ] [--locales ] [--source-env ] [--environments ] [--delivery-token ] [-c ] [-y] [--branch ] [--onlyAssets] [--onlyEntries] [--include-variants]`; module.exports = CrossPublishCommand; diff --git a/packages/contentstack-bulk-publish/src/producer/cross-publish.js b/packages/contentstack-bulk-publish/src/producer/cross-publish.js index 510de5c1d0..fe00a57c17 100644 --- a/packages/contentstack-bulk-publish/src/producer/cross-publish.js +++ b/packages/contentstack-bulk-publish/src/producer/cross-publish.js @@ -15,6 +15,7 @@ const assetQueue = getQueue(); const { Command } = require('@contentstack/cli-command'); const command = new Command(); const { isEmpty } = require('../util'); +const VARIANTS_PUBLISH_API_VERSION = '3.2'; let bulkPublishSet = []; let bulkPublishAssetSet = []; @@ -33,20 +34,27 @@ function getQueryParams(filter) { return queryString; } -async function bulkAction(stack, items, bulkPublish, filter, destEnv, apiVersion) { +async function bulkAction(stack, items, bulkPublish, filter, destEnv, apiVersion, variantsFlag = false) { return new Promise(async (resolve) => { for (let index = 0; index < items.length; index++) { changedFlag = true; if (bulkPublish) { if (bulkPublishSet.length < 10 && items[index].type === 'entry_published') { - bulkPublishSet.push({ + const entry = { uid: items[index].data.uid, content_type: items[index].content_type_uid, locale: items[index].data.locale || 'en-us', version: items[index].data._version, publish_details: [items[index].data.publish_details] || [], - }); + }; + + if (variantsFlag) { + entry.variants = items[index].data.variants || []; + entry.publish_with_base_entry = true; + } + + bulkPublishSet.push(JSON.parse(JSON.stringify(entry))); } if (bulkPublishAssetSet.length < 10 && items[index].type === 'asset_published') { @@ -143,6 +151,7 @@ async function getSyncEntries( deliveryToken, destEnv, apiVersion, + variantsFlag = false, paginationToken = null, ) { return new Promise(async (resolve, reject) => { @@ -198,8 +207,18 @@ async function getSyncEntries( ); } + if (variantsFlag) { + for (let index = 0; index < entriesResponse?.items?.length; index++) { + let variants = []; + variants = await getVariantEntries(stack, entries[index].content_type_uid, entries, index, queryParamsObj); + if (variants.length > 0) { + entriesResponse.items[index].data.variants = variants; + } + } + } + if (entriesResponse.items.length > 0) { - await bulkAction(stack, entriesResponse.items, bulkPublish, filter, destEnv, apiVersion); + await bulkAction(stack, entriesResponse.items, bulkPublish, filter, destEnv, apiVersion, variantsFlag); } if (!entriesResponse.pagination_token) { if (!changedFlag) console.log('No Entries/Assets Found published on specified environment'); @@ -241,6 +260,48 @@ function setConfig(conf, bp) { filePath = initializeLogger(logFileName); } +async function getVariantEntries(stack, contentType, entries, index, queryParams, skip = 0) { + try { + let variantQueryParams = { + locale: queryParams.locale || 'en-us', + include_count: true, + skip: skip, // Adding skip parameter for pagination + limit: 100, // Set a limit to fetch up to 100 entries per request + }; + + const variantsEntriesResponse = await stack + .contentType(contentType) + .entry(entries[index].data.uid) + .variants() + .query(variantQueryParams) + .find(); + + const variants = variantsEntriesResponse.items.map((entry) => ({ + uid: entry.variants_uid, + })); + + if (variantsEntriesResponse.items.length === variantQueryParams.limit) { + const nextVariants = await getVariantEntries( + stack, + contentType, + entries, + index, + queryParams, + skip + variantQueryParams.limit, + ); + return Array.isArray(nextVariants) ? variants.concat(nextVariants) : variants; + } + return variants; + } catch (error) { + const errorMessage = + error?.errorMessage || + error?.message || + error?.errors || + 'Falied to fetch the variant entries, Please contact the admin for support.'; + throw new Error(`Error fetching variants: ${errorMessage}`); + } +} + async function start( { retryFailed, @@ -255,6 +316,7 @@ async function start( destEnv, f_types, apiVersion, + includeVariants, }, stack, config, @@ -306,7 +368,20 @@ async function start( setConfig(config, bulkPublish); // filter.type = (f_types) ? f_types : types // types mentioned in the config file (f_types) are given preference const queryParams = getQueryParams(filter); - await getSyncEntries(stack, config, queryParams, bulkPublish, filter, deliveryToken, destEnv, apiVersion); + if (includeVariants) { + apiVersion = VARIANTS_PUBLISH_API_VERSION; + } + await getSyncEntries( + stack, + config, + queryParams, + bulkPublish, + filter, + deliveryToken, + destEnv, + apiVersion, + includeVariants, + ); } } diff --git a/packages/contentstack/README.md b/packages/contentstack/README.md index fff764503f..7431587ae4 100644 --- a/packages/contentstack/README.md +++ b/packages/contentstack/README.md @@ -50,15 +50,15 @@ USAGE * [`csdx cm:assets:publish [-a ] [--retry-failed ] [-e ] [--folder-uid ] [--bulk-publish ] [-c ] [-y] [--locales ] [--branch ] [--delivery-token ] [--source-env ]`](#csdx-cmassetspublish--a-value---retry-failed-value--e-value---folder-uid-value---bulk-publish-value--c-value--y---locales-value---branch-value---delivery-token-value---source-env-value-1) * [`csdx cm:bulk-publish:clear`](#csdx-cmbulk-publishclear) * [`csdx cm:bulk-publish:configure`](#csdx-cmbulk-publishconfigure) -* [`csdx cm:bulk-publish:cross-publish [-a ] [--retry-failed ] [--bulk-publish ] [--content-type ] [--locales ] [--source-env ] [--environments ] [--delivery-token ] [-c ] [-y] [--branch ] [--onlyAssets] [--onlyEntries]`](#csdx-cmbulk-publishcross-publish--a-value---retry-failed-value---bulk-publish-value---content-type-value---locales-value---source-env-value---environments-value---delivery-token-value--c-value--y---branch-value---onlyassets---onlyentries) -* [`csdx cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ] [--delivery-token ] [--source-env ]`](#csdx-cmentriespublish--a-value---retry-failed-value---bulk-publish-value---publish-all-content-types---content-types-value---locales-value--e-value--c-value--y---branch-value---delivery-token-value---source-env-value) +* [`csdx cm:bulk-publish:cross-publish [-a ] [--retry-failed ] [--bulk-publish ] [--content-type ] [--locales ] [--source-env ] [--environments ] [--delivery-token ] [-c ] [-y] [--branch ] [--onlyAssets] [--onlyEntries] [--include-variants]`](#csdx-cmbulk-publishcross-publish--a-value---retry-failed-value---bulk-publish-value---content-type-value---locales-value---source-env-value---environments-value---delivery-token-value--c-value--y---branch-value---onlyassets---onlyentries---include-variants) +* [`csdx cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ] [--delivery-token ] [--source-env ] [--entry-uid ] [--include-variants]`](#csdx-cmentriespublish--a-value---retry-failed-value---bulk-publish-value---publish-all-content-types---content-types-value---locales-value--e-value--c-value--y---branch-value---delivery-token-value---source-env-value---entry-uid-value---include-variants) * [`csdx cm:entries:publish-modified [-a ] [--retry-failed ] [--bulk-publish ] [--source-env ] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ]`](#csdx-cmentriespublish-modified--a-value---retry-failed-value---bulk-publish-value---source-env-value---content-types-value---locales-value--e-value--c-value--y---branch-value) * [`csdx cm:entries:publish-non-localized-fields [-a ] [--retry-failed ] [--bulk-publish ] [--source-env ] [--content-types ] [-e ] [-c ] [-y] [--branch ]`](#csdx-cmentriespublish-non-localized-fields--a-value---retry-failed-value---bulk-publish-value---source-env-value---content-types-value--e-value--c-value--y---branch-value) * [`csdx cm:bulk-publish:revert`](#csdx-cmbulk-publishrevert) * [`csdx csdx cm:stacks:unpublish [-a ] [-e ] [-c ] [-y] [--locale ] [--branch ] [--retry-failed ] [--bulk-unpublish ] [--content-type ] [--delivery-token ] [--only-assets] [--only-entries]`](#csdx-csdx-cmstacksunpublish--a-value--e-value--c-value--y---locale-value---branch-value---retry-failed-value---bulk-unpublish-value---content-type-value---delivery-token-value---only-assets---only-entries) * [`csdx cm:entries:publish-only-unpublished [-a ] [--retry-failed ] [--bulk-publish ] [--source-env ] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ]`](#csdx-cmentriespublish-only-unpublished--a-value---retry-failed-value---bulk-publish-value---source-env-value---content-types-value---locales-value--e-value--c-value--y---branch-value) * [`csdx cm:entries:migrate-html-rte`](#csdx-cmentriesmigrate-html-rte) -* [`csdx cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ] [--delivery-token ] [--source-env ]`](#csdx-cmentriespublish--a-value---retry-failed-value---bulk-publish-value---publish-all-content-types---content-types-value---locales-value--e-value--c-value--y---branch-value---delivery-token-value---source-env-value-1) +* [`csdx cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ] [--delivery-token ] [--source-env ] [--entry-uid ] [--include-variants]`](#csdx-cmentriespublish--a-value---retry-failed-value---bulk-publish-value---publish-all-content-types---content-types-value---locales-value--e-value--c-value--y---branch-value---delivery-token-value---source-env-value---entry-uid-value---include-variants-1) * [`csdx cm:entries:publish-modified [-a ] [--retry-failed ] [--bulk-publish ] [--source-env ] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ]`](#csdx-cmentriespublish-modified--a-value---retry-failed-value---bulk-publish-value---source-env-value---content-types-value---locales-value--e-value--c-value--y---branch-value-1) * [`csdx cm:entries:publish-non-localized-fields [-a ] [--retry-failed ] [--bulk-publish ] [--source-env ] [--content-types ] [-e ] [-c ] [-y] [--branch ]`](#csdx-cmentriespublish-non-localized-fields--a-value---retry-failed-value---bulk-publish-value---source-env-value---content-types-value--e-value--c-value--y---branch-value-1) * [`csdx cm:entries:publish-only-unpublished [-a ] [--retry-failed ] [--bulk-publish ] [--source-env ] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ]`](#csdx-cmentriespublish-only-unpublished--a-value---retry-failed-value---bulk-publish-value---source-env-value---content-types-value---locales-value--e-value--c-value--y---branch-value-1) @@ -960,7 +960,7 @@ EXAMPLES $ csdx cm:stacks:publish-configure --stack-api-key ``` -## `csdx cm:bulk-publish:cross-publish [-a ] [--retry-failed ] [--bulk-publish ] [--content-type ] [--locales ] [--source-env ] [--environments ] [--delivery-token ] [-c ] [-y] [--branch ] [--onlyAssets] [--onlyEntries]` +## `csdx cm:bulk-publish:cross-publish [-a ] [--retry-failed ] [--bulk-publish ] [--content-type ] [--locales ] [--source-env ] [--environments ] [--delivery-token ] [-c ] [-y] [--branch ] [--onlyAssets] [--onlyEntries] [--include-variants]` Publish entries and assets from one environment to other environments @@ -968,7 +968,7 @@ Publish entries and assets from one environment to other environments USAGE $ csdx cm:bulk-publish:cross-publish [-a ] [--retry-failed ] [--bulk-publish ] [--content-type ] [--locales ] [--source-env ] [--environments ] [--delivery-token ] [-c ] [-y] - [--branch ] [--onlyAssets] [--onlyEntries] + [--branch ] [--onlyAssets] [--onlyEntries] [--include-variants] FLAGS -B, --branch= [default: main] Specify the branch to fetch the content (by default the main branch is @@ -983,6 +983,7 @@ FLAGS --content-type=... The Contenttypes from which entries will be published --delivery-token= Delivery token for source environment --environments=... Destination Environments + --include-variants Include Variants flag will publish all associated variant entries. --locales= Source locale --onlyAssets Unpublish only assets --onlyEntries Unpublish only entries @@ -1033,11 +1034,17 @@ EXAMPLES Using --stack-api-key flag $ csdx cm:bulk-publish:cross-publish --content-type [CONTENT TYPE] --source-env [SOURCE ENV] --environments [DESTINATION ENVIRONMENT] --locales [LOCALE] --stack-api-key [STACK API KEY] --delivery-token [DELIVERY TOKEN] + + + + Using --include-variants flag + + $ csdx cm:bulk-publish:cross-publish --content-type [CONTENT TYPE] --source-env [SOURCE ENV] --environments [DESTINATION ENVIRONMENT] --locales [LOCALE] --stack-api-key [STACK API KEY] --delivery-token [DELIVERY TOKEN] [--include-variants] ``` _See code: [@contentstack/cli-cm-bulk-publish](https://github.com/contentstack/cli/blob/main/packages/contentstack-bulk-publish/src/commands/cm/bulk-publish/cross-publish.js)_ -## `csdx cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ] [--delivery-token ] [--source-env ]` +## `csdx cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ] [--delivery-token ] [--source-env ] [--entry-uid ] [--include-variants]` Publish entries from multiple contenttypes to multiple environments and locales @@ -1045,7 +1052,7 @@ Publish entries from multiple contenttypes to multiple environments and locales USAGE $ csdx cm:bulk-publish:entries cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch - ] [--delivery-token ] [--source-env ] + ] [--delivery-token ] [--source-env ] [--entry-uid ] [--include-variants] FLAGS -B, --branch= [default: main] Specify the branch to fetch the content (by default the main branch @@ -1062,6 +1069,8 @@ FLAGS bulkpublish API will be used to publish the entries --content-types=... The Contenttypes from which entries need to be published --delivery-token= Delivery token for source environment + --entry-uid= Entry Uid for publish all associated variant entries. + --include-variants Include Variants flag will publish all associated variant entries. --publish-all-content-types (optional) Publish all contenttypes (cannot be set when contentTypes flag is set) --retry-failed= (optional) Retry failed entries from the logfile (overrides all other flags) This flag is used to retry publishing entries that failed to publish in a previous @@ -1121,6 +1130,18 @@ EXAMPLES Using --stack-api-key $ csdx cm:entries:publish -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] --stack-api-key [STACK API KEY] --source-env [SOURCE ENVIRONMENT] --delivery-token [DELIVERY TOKEN] + + + + Using --include-variants + + $ csdx cm:entries:publish -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] --stack-api-key [STACK API KEY] --source-env [SOURCE ENVIRONMENT] --delivery-token [DELIVERY TOKEN] [--include-variants] + + + + Using --entry-uid and --include-variants + + $ csdx cm:entries:publish -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] --stack-api-key [STACK API KEY] --source-env [SOURCE ENVIRONMENT] --delivery-token [DELIVERY TOKEN] --entry-uid [ENTRY UID] [--include-variants] ``` ## `csdx cm:entries:publish-modified [-a ] [--retry-failed ] [--bulk-publish ] [--source-env ] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ]` @@ -1533,7 +1554,7 @@ EXAMPLES _See code: [@contentstack/cli-cm-migrate-rte](https://github.com/contentstack/cli/blob/main/packages/contentstack-migrate-rte/src/commands/cm/entries/migrate-html-rte.js)_ -## `csdx cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ] [--delivery-token ] [--source-env ]` +## `csdx cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ] [--delivery-token ] [--source-env ] [--entry-uid ] [--include-variants]` Publish entries from multiple contenttypes to multiple environments and locales @@ -1541,7 +1562,7 @@ Publish entries from multiple contenttypes to multiple environments and locales USAGE $ csdx cm:entries:publish [-a ] [--retry-failed ] [--bulk-publish ] [--publish-all-content-types] [--content-types ] [--locales ] [-e ] [-c ] [-y] [--branch ] [--delivery-token - ] [--source-env ] + ] [--source-env ] [--entry-uid ] [--include-variants] FLAGS -B, --branch= [default: main] Specify the branch to fetch the content (by default the main branch @@ -1558,6 +1579,8 @@ FLAGS bulkpublish API will be used to publish the entries --content-types=... The Contenttypes from which entries need to be published --delivery-token= Delivery token for source environment + --entry-uid= Entry Uid for publish all associated variant entries. + --include-variants Include Variants flag will publish all associated variant entries. --publish-all-content-types (optional) Publish all contenttypes (cannot be set when contentTypes flag is set) --retry-failed= (optional) Retry failed entries from the logfile (overrides all other flags) This flag is used to retry publishing entries that failed to publish in a previous @@ -1617,6 +1640,18 @@ EXAMPLES Using --stack-api-key $ csdx cm:entries:publish -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] --stack-api-key [STACK API KEY] --source-env [SOURCE ENVIRONMENT] --delivery-token [DELIVERY TOKEN] + + + + Using --include-variants + + $ csdx cm:entries:publish -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] --stack-api-key [STACK API KEY] --source-env [SOURCE ENVIRONMENT] --delivery-token [DELIVERY TOKEN] [--include-variants] + + + + Using --entry-uid and --include-variants + + $ csdx cm:entries:publish -e [ENVIRONMENT 1] [ENVIRONMENT 2] --locales [LOCALE 1] [LOCALE 2] --stack-api-key [STACK API KEY] --source-env [SOURCE ENVIRONMENT] --delivery-token [DELIVERY TOKEN] --entry-uid [ENTRY UID] [--include-variants] ``` _See code: [@contentstack/cli-cm-bulk-publish](https://github.com/contentstack/cli/blob/main/packages/contentstack-bulk-publish/src/commands/cm/entries/publish.js)_