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
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class ModuleImporter {
this.importConfig.masterLocale = { code: masterLocalResponse.code };
}

await sanitizeStack(this.stackAPIClient);
await sanitizeStack(this.importConfig);

return this.import();
}
Expand Down
6 changes: 6 additions & 0 deletions packages/contentstack-import/src/import/modules/stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ export default class ImportStack extends BaseClass { // classname
throw new Error('Please run the environments migration first.');
}

if (this.importConfig.management_token) {
log(this.importConfig, 'Skipping stack settings import: Operation is not supported when using a management token.', 'info');
log(this.importConfig, 'Successfully imported stack', 'success');
return;
}

if (fileHelper.fileExistsSync(this.stackSettingsPath)) {
this.stackSettings = fsUtil.readFile(this.stackSettingsPath, true) as Record<string, any>;
} else {
Expand Down
6 changes: 6 additions & 0 deletions packages/contentstack-import/src/utils/common-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ export const sanitizeStack = (importConfig: ImportConfig) => {
if (typeof importConfig.preserveStackVersion !== 'boolean' || !importConfig.preserveStackVersion) {
return Promise.resolve();
}

if (importConfig.management_token) {
log(importConfig, 'Skipping stack version sanitization: Operation is not supported when using a management token.', 'info');
return Promise.resolve();
}

log(importConfig, 'Running script to maintain stack version.', 'success');
try {
const httpClient = HttpClient.create();
Expand Down
Loading