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
4 changes: 4 additions & 0 deletions packages/contentstack-import/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ FLAGS
--personalize-project-name=<value> (optional) Provide a unique name for the Personalize project.
--replace-existing Replaces the existing module in the target stack.
--skip-app-recreation (optional) Skips the recreation of private apps if they already exist.
--skip-assets-publish Skips the assets from being published during an import process.
--skip-audit Skips the audit fix that occurs during an import operation.
--skip-entries-publish Skips the entries from being published during an import process.
--skip-existing Skips the module exists warning messages.

DESCRIPTION
Expand Down Expand Up @@ -158,7 +160,9 @@ FLAGS
--personalize-project-name=<value> (optional) Provide a unique name for the Personalize project.
--replace-existing Replaces the existing module in the target stack.
--skip-app-recreation (optional) Skips the recreation of private apps if they already exist.
--skip-assets-publish Skips the assets from being published during an import process.
--skip-audit Skips the audit fix that occurs during an import operation.
--skip-entries-publish Skips the entries from being published during an import process.
--skip-existing Skips the module exists warning messages.

DESCRIPTION
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ export default class ImportCommand extends Command {
description: 'Excludes the branch-independent module from the import operation.',
default: false,
}),
'skip-assets-publish': flags.boolean({
description: 'Skips asset publishing during the import process.',
default: false,
}),
'skip-entries-publish': flags.boolean({
description: 'Skips entry publishing during the import process',
default: false,
}),
};

static aliases: string[] = ['cm:import'];
Expand Down
2 changes: 0 additions & 2 deletions packages/contentstack-import/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ const config: DefaultConfig = {
assets: {
dirName: 'assets',
assetBatchLimit: 1,
publishAssets: true,
fileName: 'assets.json',
importSameStructure: true,
uploadAssetsConcurrency: 2,
Expand Down Expand Up @@ -421,7 +420,6 @@ const config: DefaultConfig = {
overwriteSupportedModules: ['extensions', 'global-fields', 'content-types'],
rateLimit: 5,
preserveStackVersion: false,
entriesPublish: true,
concurrency: 1,
importConcurrency: 5,
fetchConcurrency: 5,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default class ImportAssets extends BaseClass {
await this.importAssets();

// NOTE Step 4: Publish assets
if (this.assetConfig.publishAssets) await this.publish();
if (!this.importConfig.skipAssetsPublish) await this.publish();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export default class EntriesImport extends BaseClass {
log(this.importConfig, 'Entries imported successfully', 'success');

// Publishing entries
if (this.importConfig.entriesPublish) {
if (!this.importConfig.skipEntriesPublish) {
log(this.importConfig, 'Publishing entries', 'info');
this.envs = fileHelper.readFileSync(this.envPath);
for (let entryRequestOption of entryRequestOptions) {
Expand Down
4 changes: 2 additions & 2 deletions packages/contentstack-import/src/types/default-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export default interface DefaultConfig {
assets: {
dirName: string;
assetBatchLimit: number;
publishAssets: boolean;
fileName: string;
importSameStructure: boolean;
uploadAssetsConcurrency: number;
Expand Down Expand Up @@ -177,7 +176,6 @@ export default interface DefaultConfig {
};
rateLimit: number;
preserveStackVersion: boolean;
entriesPublish: boolean;
concurrency: number;
importConcurrency: number;
fetchConcurrency: number;
Expand All @@ -199,4 +197,6 @@ export default interface DefaultConfig {
} & Record<string, any>; // To overwrite any build-in config. And this config is equal to --config flag.
};
globalModules: string[];
skipAssetsPublish?: boolean;
skipEntriesPublish?: boolean;
}
2 changes: 2 additions & 0 deletions packages/contentstack-import/src/types/import-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export interface ExternalConfig {
}

export default interface ImportConfig extends DefaultConfig, ExternalConfig {
skipAssetsPublish?: boolean;
skipEntriesPublish?: boolean;
cliLogsPath: string;
canCreatePrivateApp: boolean;
contentDir: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@ const setupConfig = async (importCmdFlags: any): Promise<ImportConfig> => {
if (importCmdFlags['backup-dir']) {
config.useBackedupDir = importCmdFlags['backup-dir'];
}

if (importCmdFlags['skip-assets-publish']) {
config.skipAssetsPublish = importCmdFlags['skip-assets-publish'];
}

if (importCmdFlags['skip-entries-publish']) {
config.skipEntriesPublish = importCmdFlags['skip-entries-publish'];
}

// Note to support old modules
config.target_stack = config.apiKey;
Expand Down
Loading