Skip to content

Commit e5260b7

Browse files
author
naman-contentstack
committed
fix: Update flags in AssetsPublishCommand and add user reminder in ImportCommand for asset publishing
1 parent 0ca69b8 commit e5260b7

3 files changed

Lines changed: 20 additions & 1 deletion

File tree

.talismanrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,6 @@ fileignoreconfig:
6767
checksum: 653a7e0443f6b9712ed91ad45aa4189864bee710ea4bd3ac40031225da4da5a5
6868
- filename: pnpm-lock.yaml
6969
checksum: 07642e8dd04d580185a459e5b088d8a1bb4e91be4e04f4842bf4fe4775205bf6
70+
- filename: packages/contentstack-import/src/commands/cm/stacks/import.ts
71+
checksum: 5ae9bf66f5b5b4ef2c5ec337f8f1a30b379ce984b1087508d368548fa6adbb0e
7072
version: '1.0'

packages/contentstack-bulk-publish/src/commands/cm/assets/publish.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ AssetsPublishCommand.flags = {
192192
'data-dir': flags.string({
193193
description:
194194
'(optional) Path to the import backup directory. When set, each imported asset is published only to the environments and locales it was published to in the source stack (read from the backup’s publish details and asset UID mapping), with asset-scan gating applied. Intended for the post-import publish flow.',
195-
exclusive: ['source-env', 'folder-uid'],
195+
exclusive: ['source-env', 'folder-uid', 'environments', 'locales'],
196196
}),
197197
'bulk-publish': flags.string({
198198
description: 'Set this flag to use Contentstack’s Bulk Publish APIs. It is true, by default.',

packages/contentstack-import/src/commands/cm/stacks/import.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,23 @@ export default class ImportCommand extends Command {
187187

188188
log.success(`The log has been stored at: ${getLogPath()}`, importConfig.context);
189189
log.info(`The backup content has been stored at: ${backupDir}`, importConfig.context);
190+
191+
// Closing reminder: when assets were imported but not published inline
192+
// (asset scanning enabled, or --skip-assets-publish), point the user to
193+
// cm:assets:publish with the backup dir and stack pre-filled so the note
194+
// isn't lost in the per-module logs above.
195+
const assetsImported = importConfig.moduleName
196+
? importConfig.moduleName === 'assets'
197+
: importConfig.modules?.types?.includes('assets');
198+
// Mirror the publish gate in assets.ts (`!skipAssetsPublish`): assets are
199+
// left unpublished exactly when skipAssetsPublish is set — which also
200+
// covers the scanning case, since detecting scanning sets skipAssetsPublish.
201+
if (!result?.noSuccessMsg && assetsImported && importConfig.skipAssetsPublish) {
202+
log.info(
203+
`Note: assets were imported but not published asset scanning is enabled and must complete first. To publish them, run:\n csdx cm:assets:publish --data-dir ${backupDir} --stack-api-key ${importConfig.apiKey}`,
204+
importConfig.context,
205+
);
206+
}
190207
} catch (error) {
191208
handleAndLogError(error);
192209
log.info(`The log has been stored at '${getLogPath()}'`);

0 commit comments

Comments
 (0)