Skip to content
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
10 changes: 10 additions & 0 deletions .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,14 @@ fileignoreconfig:
checksum: 449a5e3383631a6f78d1291aa3c28c91681879289398f0a933158fba5c5d5acf
- filename: packages/contentstack-import/src/commands/cm/stacks/import.ts
checksum: 0dbf0a6bc447206260b8acd41b85781d60ca50c948bb3ca62f444f97d64d1fb2
- filename: packages/contentstack-utilities/src/interfaces/index.ts
checksum: d0b0042e643ce0c0489b86f15f3b64f60a837c2ae928b6275028e5e0184b0a7a
- filename: packages/contentstack-variants/src/import/attribute.ts
checksum: 03e764ee2032c44d9493f2be194f91a2337026b7fd8037df90240327e6bcaabb
- filename: packages/contentstack-variants/src/import/audiences.ts
checksum: f24697ef86e928bb4d16f93c021b647639cc344a7f02463d79d69f9434ebed56
- filename: packages/contentstack-variants/src/import/events.ts
checksum: 6cb014b5518ffe204a9f894ad801c05e2ef91a1692049168f74dd12a224363c4
- filename: packages/contentstack-import/src/import/modules/personalize.ts
checksum: 1311a613177160637e21b3983b281b384c2cb15837d001a398b67afef30a393a
version: "1.0"
9 changes: 6 additions & 3 deletions packages/contentstack-export/src/export/module-exporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ class ModuleExporter {
// Reset progress manager for each branch (except the first one which was initialized in export command)
if (index >= 0) {
CLIProgressManager.clearGlobalSummary();
CLIProgressManager.initializeGlobalSummary(`EXPORT-${branch.uid}`, branch.uid, `EXPORTING "${branch.uid}" BRANCH CONTENT`,);

CLIProgressManager.initializeGlobalSummary(
`EXPORT-${branch.uid}`,
branch.uid,
`EXPORTING "${branch.uid}" BRANCH CONTENT`,
);
}

log.info(`Exporting content from branch ${branch.uid}`, this.exportConfig.context);
Expand Down Expand Up @@ -97,7 +100,7 @@ class ModuleExporter {
} else {
//NOTE - new modules support only ts
if (this.exportConfig.onlyTSModules.indexOf(moduleName) === -1) {
await startJSModuleExport({
await startJSModuleExport({
stackAPIClient: this.stackAPIClient,
exportConfig: this.exportConfig,
moduleName,
Expand Down
32 changes: 16 additions & 16 deletions packages/contentstack-export/src/export/modules/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,41 +64,41 @@ export default class ExportAssets extends BaseClass {

// Add sub-processes
if (typeof assetsFolderCount === 'number' && assetsFolderCount > 0) {
progress.addProcess('Asset Folders', assetsFolderCount);
progress.addProcess('Folders', assetsFolderCount);
}
if (typeof assetsCount === 'number' && assetsCount > 0) {
progress.addProcess('Asset Metadata', assetsCount);
progress.addProcess('Asset Downloads', assetsCount);
progress.addProcess('Metadata', assetsCount);
progress.addProcess('Downloads', assetsCount);
}

try {
// Process asset folders
if (typeof assetsFolderCount === 'number' && assetsFolderCount > 0) {
progress.startProcess('Asset Folders').updateStatus('Fetching folder structure...', 'Asset Folders');
progress.startProcess('Folders').updateStatus('Fetching folder structure...', 'Folders');
await this.getAssetsFolders(assetsFolderCount);
progress.completeProcess('Asset Folders', true);
progress.completeProcess('Folders', true);
}

// Process asset metadata
if (typeof assetsCount === 'number' && assetsCount > 0) {
progress.startProcess('Asset Metadata').updateStatus('Fetching asset information...', 'Asset Metadata');
progress.startProcess('Metadata').updateStatus('Fetching asset information...', 'Metadata');
await this.getAssets(assetsCount);
progress.completeProcess('Asset Metadata', true);
progress.completeProcess('Metadata', true);
}

// Get versioned assets
if (!isEmpty(this.versionedAssets) && this.assetConfig.includeVersionedAssets) {
log.debug('Fetching versioned assets metadata...', this.exportConfig.context);
progress.updateStatus('Processing versioned assets...', 'Asset Metadata');
progress.updateStatus('Processing versioned assets...', 'Metadata');
await this.getVersionedAssets();
}

// Download all assets
if (typeof assetsCount === 'number' && assetsCount > 0) {
progress.startProcess('Asset Downloads').updateStatus('Downloading asset files...', 'Asset Downloads');
progress.startProcess('Downloads').updateStatus('Downloading asset files...', 'Downloads');
log.debug('Starting download of all assets...', this.exportConfig.context);
await this.downloadAssets();
progress.completeProcess('Asset Downloads', true);
progress.completeProcess('Downloads', true);
}

this.completeProgress(true);
Expand Down Expand Up @@ -128,13 +128,13 @@ export default class ExportAssets extends BaseClass {
if (!isEmpty(items)) {
this.assetsFolder.push(...items);
items.forEach((folder: any) => {
this.progressManager?.tick(true, `folder: ${folder.name || folder.uid}`, null, 'Asset Folders');
this.progressManager?.tick(true, `folder: ${folder.name || folder.uid}`, null, 'Folders');
});
}
};

const onReject = ({ error }: any) => {
this.progressManager?.tick(false, 'asset folder', error?.message || 'Failed to fetch folder', 'Asset Folders');
this.progressManager?.tick(false, 'asset folder', error?.message || 'Failed to fetch folder', 'Folders');
handleAndLogError(error, { ...this.exportConfig.context });
};

Expand Down Expand Up @@ -197,7 +197,7 @@ export default class ExportAssets extends BaseClass {
}

const onReject = ({ error }: any) => {
this.progressManager?.tick(false, 'asset', error?.message || 'Failed to fetch asset', 'Asset Metadata');
this.progressManager?.tick(false, 'asset', error?.message || 'Failed to fetch asset', 'Metadata');
handleAndLogError(error, { ...this.exportConfig.context }, messageHandler.parse('ASSET_QUERY_FAILED'));
};

Expand All @@ -219,7 +219,7 @@ export default class ExportAssets extends BaseClass {
fs?.writeIntoFile(items, { mapKeyVal: true });
// Track progress for each asset with process name
items.forEach((asset: any) => {
this.progressManager?.tick(true, `asset: ${asset.filename || asset.uid}`, null, 'Asset Metadata');
this.progressManager?.tick(true, `asset: ${asset.filename || asset.uid}`, null, 'Metadata');
});
}
};
Expand Down Expand Up @@ -418,7 +418,7 @@ export default class ExportAssets extends BaseClass {
} else {
data.pipe(assetWriterStream);
}
this.progressManager?.tick(true, `Downloaded asset: ${asset.filename || asset.uid}`, null, 'Asset Downloads');
this.progressManager?.tick(true, `Downloaded asset: ${asset.filename || asset.uid}`, null, 'Downloads');
log.success(messageHandler.parse('ASSET_DOWNLOAD_SUCCESS', asset.filename, asset.uid), this.exportConfig.context);
};

Expand All @@ -428,7 +428,7 @@ export default class ExportAssets extends BaseClass {
false,
`Failed to download asset: ${asset.filename || asset.uid}`,
null,
'Asset Downloads',
'Downloads',
);
handleAndLogError(
error,
Expand Down
2 changes: 1 addition & 1 deletion packages/contentstack-export/src/export/modules/entries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export default class EntriesExport extends BaseClass {
}

if (this.exportVariantEntry) {
progress.addProcess('Variant Entries', totalEntriesCount);
progress.addProcess('Variant Entries', 0);
}
}

Expand Down
1 change: 1 addition & 0 deletions packages/contentstack-export/src/export/modules/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { handleAndLogError } from '@contentstack/cli-utilities';
import { ModuleClassParams } from '../../types';
import '../../utils/strategy-registrations';

export default async function startModuleExport(modulePayload: ModuleClassParams) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,19 @@ export default class ExportMarketplaceApps extends BaseClass {
const progress = this.createNestedProgress(this.currentModuleName);

// Add processes based on what we found
progress.addProcess('Apps Fetch', appsCount);
progress.addProcess('App Processing', appsCount); // Manifests and configurations
progress.addProcess('Fetch', appsCount);
progress.addProcess('Fetch config & manifest', appsCount); // Manifests and configurations

// Fetch stack specific apps
progress.startProcess('Apps Fetch').updateStatus('Fetching marketplace apps...', 'Apps Fetch');
progress.startProcess('Fetch').updateStatus('Fetching marketplace apps...', 'Fetch');
await this.exportApps();
progress.completeProcess('Apps Fetch', true);
progress.completeProcess('Fetch', true);

// Process apps (manifests and configurations)
if (this.installedApps.length > 0) {
progress.startProcess('App Processing').updateStatus('Processing app manifests and configurations...', 'App Processing');
progress.startProcess('Fetch config & manifest').updateStatus('Processing app manifests and configurations...', 'Fetch config & manifest');
await this.getAppManifestAndAppConfig();
progress.completeProcess('App Processing', true);
progress.completeProcess('Fetch config & manifest', true);
}

this.completeProgress(true);
Expand Down Expand Up @@ -196,7 +196,7 @@ export default class ExportMarketplaceApps extends BaseClass {
await this.getAppConfigurations(+index, app);

// Track progress for each app processed
this.progressManager?.tick(true, `app: ${app.manifest?.name || app.uid}`, null, 'App Processing');
this.progressManager?.tick(true, `app: ${app.manifest?.name || app.uid}`, null, 'Fetch config & manifest');
}

const marketplaceAppsFilePath = pResolve(this.marketplaceAppPath, this.marketplaceAppConfig.fileName);
Expand Down Expand Up @@ -346,7 +346,7 @@ export default class ExportMarketplaceApps extends BaseClass {

// Track progress for each app fetched
installation.forEach((app) => {
this.progressManager?.tick(true, `app: ${app.manifest?.name || app.uid}`, null, 'Apps Fetch');
this.progressManager?.tick(true, `app: ${app.manifest?.name || app.uid}`, null, 'Fetch');
});

this.installedApps = this.installedApps.concat(installation);
Expand Down
36 changes: 18 additions & 18 deletions packages/contentstack-export/src/export/modules/stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default class ExportStack extends BaseClass {
}

if (!this.exportConfig.management_token) {
progress.addProcess('Stack Settings', 1);
progress.addProcess('Settings', 1);
processCount++;
}

Expand All @@ -67,18 +67,18 @@ export default class ExportStack extends BaseClass {
!this.exportConfig.hasOwnProperty('master_locale') &&
localesCount > 0
) {
progress.addProcess('Locales', localesCount);
progress.addProcess('Locale', localesCount);
processCount++;
} else if (this.exportConfig.preserveStackVersion) {
progress.addProcess('Stack Export', 1);
progress.addProcess('Details', 1);
processCount++;
}

// Execute processes
if (!this.exportConfig.management_token) {
progress.startProcess('Stack Settings').updateStatus('Exporting stack settings...', 'Stack Settings');
progress.startProcess('Settings').updateStatus('Exporting stack settings...', 'Settings');
await this.exportStackSettings();
progress.completeProcess('Stack Settings', true);
progress.completeProcess('Settings', true);
} else {
log.info(
'Skipping stack settings export: Operation is not supported when using a management token.',
Expand All @@ -91,9 +91,9 @@ export default class ExportStack extends BaseClass {
!this.exportConfig.hasOwnProperty('master_locale') &&
localesCount > 0
) {
progress.startProcess('Locales').updateStatus('Fetching master locale...', 'Locales');
progress.startProcess('Locale').updateStatus('Fetching master locale...', 'Locale');
const masterLocale = await this.getLocales();
progress.completeProcess('Locales', true);
progress.completeProcess('Locale', true);

if (masterLocale?.code) {
this.exportConfig.master_locale = { code: masterLocale.code };
Expand All @@ -103,14 +103,14 @@ export default class ExportStack extends BaseClass {
this.completeProgress(true);
return masterLocale;
} else if (this.exportConfig.preserveStackVersion) {
progress.startProcess('Stack Export').updateStatus('Exporting stack data...', 'Stack Export');
progress.startProcess('Details').updateStatus('Exporting stack data...', 'Details');
const stackResult = await this.exportStack();
progress.completeProcess('Stack Export', true);
progress.completeProcess('Details', true);

this.completeProgress(true);
return stackResult;
} else {
log.debug('Master locale already set, skipping locale fetch', this.exportConfig.context);
log.debug('Locale locale already set, skipping locale fetch', this.exportConfig.context);
}

this.completeProgress(true);
Expand Down Expand Up @@ -185,7 +185,7 @@ export default class ExportStack extends BaseClass {

// Track progress for each locale processed
items.forEach((locale: any) => {
this.progressManager?.tick(true, `locale: ${locale.name || locale.code}`, null, 'Locales');
this.progressManager?.tick(true, `locale: ${locale.name || locale.code}`, null, 'Locale');
});

skip += this.stackConfig.limit || 100;
Expand All @@ -200,14 +200,14 @@ export default class ExportStack extends BaseClass {
return masterLocalObj;
} else if (skip >= count) {
log.error(
`Master locale not found in the stack ${this.exportConfig.source_stack}. Please ensure that the stack has a master locale.`,
`Locale locale not found in the stack ${this.exportConfig.source_stack}. Please ensure that the stack has a master locale.`,
this.exportConfig.context,
);
log.debug('Completed searching all locales without finding master locale', this.exportConfig.context);
return;
} else {
log.debug(
`Master locale not found in current batch, continuing with skip: ${skip}`,
`Locale locale not found in current batch, continuing with skip: ${skip}`,
this.exportConfig.context,
);
return await this.getLocales(skip);
Expand All @@ -221,7 +221,7 @@ export default class ExportStack extends BaseClass {
`Error occurred while fetching locales for stack: ${this.exportConfig.source_stack}`,
this.exportConfig.context,
);
this.progressManager?.tick(false, 'locale fetch', error?.message || 'Failed to fetch locales', 'Locales');
this.progressManager?.tick(false, 'locale fetch', error?.message || 'Failed to fetch locales', 'Locale');
handleAndLogError(
error,
{ ...this.exportConfig.context },
Expand All @@ -245,7 +245,7 @@ export default class ExportStack extends BaseClass {
fsUtil.writeFile(stackFilePath, resp);

// Track progress for stack export completion
this.progressManager?.tick(true, `stack: ${this.exportConfig.source_stack}`, null, 'Stack Export');
this.progressManager?.tick(true, `stack: ${this.exportConfig.source_stack}`, null, 'Details');

log.success(
`Stack details exported successfully for stack ${this.exportConfig.source_stack}`,
Expand All @@ -256,7 +256,7 @@ export default class ExportStack extends BaseClass {
})
.catch((error: any) => {
log.debug(`Error occurred while exporting stack: ${this.exportConfig.source_stack}`, this.exportConfig.context);
this.progressManager?.tick(false, 'stack export', error?.message || 'Failed to export stack', 'Stack Export');
this.progressManager?.tick(false, 'stack export', error?.message || 'Failed to export stack', 'Details');
handleAndLogError(error, { ...this.exportConfig.context });
});
}
Expand All @@ -270,7 +270,7 @@ export default class ExportStack extends BaseClass {
fsUtil.writeFile(pResolve(this.stackFolderPath, 'settings.json'), resp);

// Track progress for stack settings completion
this.progressManager?.tick(true, 'stack settings', null, 'Stack Settings');
this.progressManager?.tick(true, 'stack settings', null, 'Settings');

log.success('Exported stack settings successfully!', this.exportConfig.context);
return resp;
Expand All @@ -280,7 +280,7 @@ export default class ExportStack extends BaseClass {
false,
'stack settings',
error?.message || 'Failed to export stack settings',
'Stack Settings',
'Settings',
);
handleAndLogError(error, { ...this.exportConfig.context });
});
Expand Down
Loading