Skip to content

Commit 48d43c8

Browse files
author
naman-contentstack
committed
[DX-2277],Prevent marketplace apps recreation by default
1 parent a8b1a0b commit 48d43c8

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ export default class ImportCommand extends Command {
7070
module: flags.string({
7171
required: false,
7272
char: 'm',
73-
description: '[optional] Specify the module to import into the target stack. If not specified, the import command will import all the modules into the stack. The available modules are assets, content-types, entries, environments, extensions, marketplace-apps, global-fields, labels, locales, webhooks, workflows, custom-roles, and taxonomies.',
73+
description:
74+
'[optional] Specify the module to import into the target stack. If not specified, the import command will import all the modules into the stack. The available modules are assets, content-types, entries, environments, extensions, marketplace-apps, global-fields, labels, locales, webhooks, workflows, custom-roles, and taxonomies.',
7475
parse: printFlagDeprecation(['-m'], ['--module']),
7576
}),
7677
'backup-dir': flags.string({
@@ -80,11 +81,13 @@ export default class ImportCommand extends Command {
8081
}),
8182
branch: flags.string({
8283
char: 'B',
83-
description: 'The name of the branch where you want to import your content. If you don\'t mention the branch name, then by default the content will be imported to the main branch.',
84+
description:
85+
"The name of the branch where you want to import your content. If you don't mention the branch name, then by default the content will be imported to the main branch.",
8486
parse: printFlagDeprecation(['-B'], ['--branch']),
8587
}),
8688
'import-webhook-status': flags.string({
87-
description: '[default: disable] (optional) This webhook state keeps the same state of webhooks as the source stack. <options: disable|current>',
89+
description:
90+
'[default: disable] (optional) This webhook state keeps the same state of webhooks as the source stack. <options: disable|current>',
8891
options: ['disable', 'current'],
8992
required: false,
9093
default: 'disable',
@@ -96,6 +99,7 @@ export default class ImportCommand extends Command {
9699
}),
97100
'skip-app-recreation': flags.boolean({
98101
description: '(optional) Skips the recreation of private apps if they already exist.',
102+
parse: printFlagDeprecation(['--skip-app-recreation']),
99103
}),
100104
'replace-existing': flags.boolean({
101105
required: false,
@@ -156,7 +160,7 @@ export default class ImportCommand extends Command {
156160
.branch()
157161
.query()
158162
.find()
159-
.then(({ items }: any) => items)
163+
.then(({ items }: any) => items);
160164
if (branches.length) {
161165
flags.branch = 'main';
162166
}

packages/contentstack-import/src/utils/import-config-handler.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ const setupConfig = async (importCmdFlags: any): Promise<ImportConfig> => {
2020
config = merge.recursive(config, externalConfig);
2121
}
2222

23-
config.contentDir = sanitizePath(importCmdFlags['data'] || importCmdFlags['data-dir'] || config.data || (await askContentDir()));
23+
config.contentDir = sanitizePath(
24+
importCmdFlags['data'] || importCmdFlags['data-dir'] || config.data || (await askContentDir()),
25+
);
2426
const pattern = /[*$%#<>{}!&?]/g;
2527
if (pattern.test(config.contentDir)) {
2628
cliux.print(`\nPlease add a directory path without any of the special characters: (*,&,{,},[,],$,%,<,>,?,!)`, {
@@ -75,7 +77,7 @@ const setupConfig = async (importCmdFlags: any): Promise<ImportConfig> => {
7577
config.skipAudit = importCmdFlags['skip-audit'];
7678
config.forceStopMarketplaceAppsPrompt = importCmdFlags.yes;
7779
config.importWebhookStatus = importCmdFlags['import-webhook-status'];
78-
config.skipPrivateAppRecreationIfExist = importCmdFlags['skip-app-recreation'];
80+
config.skipPrivateAppRecreationIfExist = !importCmdFlags['skip-app-recreation'];
7981

8082
if (importCmdFlags['branch']) {
8183
config.branchName = importCmdFlags['branch'];
@@ -89,7 +91,7 @@ const setupConfig = async (importCmdFlags: any): Promise<ImportConfig> => {
8991
if (importCmdFlags['backup-dir']) {
9092
config.useBackedupDir = importCmdFlags['backup-dir'];
9193
}
92-
94+
9395
if (importCmdFlags['skip-assets-publish']) {
9496
config.skipAssetsPublish = importCmdFlags['skip-assets-publish'];
9597
}

0 commit comments

Comments
 (0)