@contentstack/cli-cm-export 2.0.0-beta.3 → 2.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +10 -64
- package/lib/commands/cm/stacks/export.d.ts +0 -1
- package/lib/commands/cm/stacks/export.js +3 -33
- package/lib/export/modules/assets.js +1 -1
- package/lib/export/modules/composable-studio.js +1 -1
- package/lib/export/modules/content-types.js +1 -1
- package/lib/export/modules/custom-roles.js +1 -1
- package/lib/export/modules/entries.js +3 -3
- package/lib/export/modules/environments.js +1 -1
- package/lib/export/modules/extensions.js +1 -1
- package/lib/export/modules/global-fields.js +1 -1
- package/lib/export/modules/labels.js +1 -1
- package/lib/export/modules/locales.js +1 -1
- package/lib/export/modules/marketplace-apps.js +2 -2
- package/lib/export/modules/stack.js +12 -12
- package/lib/export/modules/taxonomies.js +2 -2
- package/lib/export/modules/webhooks.js +1 -1
- package/lib/export/modules/workflows.js +1 -1
- package/lib/types/index.d.ts +0 -1
- package/lib/utils/basic-login.d.ts +1 -1
- package/lib/utils/basic-login.js +4 -4
- package/lib/utils/common-helper.d.ts +1 -1
- package/lib/utils/common-helper.js +4 -4
- package/lib/utils/export-config-handler.js +5 -8
- package/lib/utils/logger.d.ts +1 -1
- package/lib/utils/logger.js +2 -2
- package/lib/utils/marketplace-app-helper.js +1 -1
- package/oclif.manifest.json +3 -41
- package/package.json +9 -13
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -48,7 +48,7 @@ $ npm install -g @contentstack/cli-cm-export
|
|
|
48
48
|
$ csdx COMMAND
|
|
49
49
|
running command...
|
|
50
50
|
$ csdx (--version)
|
|
51
|
-
@contentstack/cli-cm-export/2.0.0-beta.
|
|
51
|
+
@contentstack/cli-cm-export/2.0.0-beta.5 linux-x64 node-v22.22.0
|
|
52
52
|
$ csdx --help [COMMAND]
|
|
53
53
|
USAGE
|
|
54
54
|
$ csdx COMMAND
|
|
@@ -59,93 +59,39 @@ USAGE
|
|
|
59
59
|
# Commands
|
|
60
60
|
|
|
61
61
|
<!-- commands -->
|
|
62
|
-
* [`csdx cm:stacks:export [
|
|
63
|
-
* [`csdx cm:stacks:export [-c <value>] [-k <value>] [-d <value>] [-a <value>] [--module <value>] [--content-types <value>] [--branch <value>] [--secured-assets]`](#csdx-cmstacksexport--c-value--k-value--d-value--a-value---module-value---content-types-value---branch-value---secured-assets)
|
|
62
|
+
* [`csdx cm:stacks:export [--config <value>] [--stack-api-key <value>] [--data-dir <value>] [--alias <value>] [--module <value>] [--content-types <value>] [--branch <value>] [--secured-assets]`](#csdx-cmstacksexport---config-value---stack-api-key-value---data-dir-value---alias-value---module-value---content-types-value---branch-value---secured-assets)
|
|
64
63
|
|
|
65
|
-
## `csdx cm:stacks:export [
|
|
64
|
+
## `csdx cm:stacks:export [--config <value>] [--stack-api-key <value>] [--data-dir <value>] [--alias <value>] [--module <value>] [--content-types <value>] [--branch <value>] [--secured-assets]`
|
|
66
65
|
|
|
67
66
|
Export content from a stack
|
|
68
67
|
|
|
69
68
|
```
|
|
70
69
|
USAGE
|
|
71
|
-
$ csdx cm:
|
|
72
|
-
[--content-types <value>] [--branch <value>] [--secured-assets]
|
|
70
|
+
$ csdx cm:stacks:export [--config <value>] [--stack-api-key <value>] [--data-dir <value>] [--alias <value>]
|
|
71
|
+
[--module <value>] [--content-types <value>] [--branch <value>] [--secured-assets]
|
|
73
72
|
|
|
74
73
|
FLAGS
|
|
75
|
-
-B, --branch=<value> [optional] The name of the branch where you want to export your content. If you don't
|
|
76
|
-
mention the branch name, then by default the content will be exported from all the
|
|
77
|
-
branches of your stack.
|
|
78
74
|
-a, --alias=<value> The management token alias of the source stack from which you will export content.
|
|
79
75
|
-c, --config=<value> [optional] Path of the config
|
|
80
76
|
-d, --data-dir=<value> The path or the location in your file system to store the exported content. For e.g.,
|
|
81
77
|
./content
|
|
82
78
|
-k, --stack-api-key=<value> API Key of the source stack
|
|
83
|
-
-m, --module=<value> [optional] Specific module name. If not specified, the export command will export all
|
|
84
|
-
the modules to the stack. The available modules are assets, content-types, entries,
|
|
85
|
-
environments, extensions, marketplace-apps, global-fields, labels, locales, webhooks,
|
|
86
|
-
workflows, custom-roles, taxonomies, and studio.
|
|
87
|
-
-t, --content-types=<value>... [optional] The UID of the content type(s) whose content you want to export. In case
|
|
88
|
-
of multiple content types, specify the IDs separated by spaces.
|
|
89
79
|
-y, --yes [optional] Force override all Marketplace prompts.
|
|
90
|
-
--branch
|
|
91
|
-
--secured-assets [optional] Use this flag for assets that are secured.
|
|
92
|
-
|
|
93
|
-
DESCRIPTION
|
|
94
|
-
Export content from a stack
|
|
95
|
-
|
|
96
|
-
ALIASES
|
|
97
|
-
$ csdx cm:export
|
|
98
|
-
|
|
99
|
-
EXAMPLES
|
|
100
|
-
$ csdx cm:stacks:export --stack-api-key <stack_api_key> --data-dir <path/of/export/destination/dir>
|
|
101
|
-
|
|
102
|
-
$ csdx cm:stacks:export --config <path/to/config/dir>
|
|
103
|
-
|
|
104
|
-
$ csdx cm:stacks:export --alias <management_token_alias>
|
|
105
|
-
|
|
106
|
-
$ csdx cm:stacks:export --alias <management_token_alias> --data-dir <path/to/export/destination/dir>
|
|
107
|
-
|
|
108
|
-
$ csdx cm:stacks:export --alias <management_token_alias> --config <path/to/config/file>
|
|
109
|
-
|
|
110
|
-
$ csdx cm:stacks:export --module <single module name>
|
|
111
|
-
|
|
112
|
-
$ csdx cm:stacks:export --branch [optional] branch name
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
## `csdx cm:stacks:export [-c <value>] [-k <value>] [-d <value>] [-a <value>] [--module <value>] [--content-types <value>] [--branch <value>] [--secured-assets]`
|
|
116
|
-
|
|
117
|
-
Export content from a stack
|
|
118
|
-
|
|
119
|
-
```
|
|
120
|
-
USAGE
|
|
121
|
-
$ csdx cm:stacks:export [-c <value>] [-k <value>] [-d <value>] [-a <value>] [--module <value>] [--content-types
|
|
122
|
-
<value>] [--branch <value>] [--secured-assets]
|
|
123
|
-
|
|
124
|
-
FLAGS
|
|
125
|
-
-B, --branch=<value> [optional] The name of the branch where you want to export your content. If you don't
|
|
80
|
+
--branch=<value> [optional] The name of the branch where you want to export your content. If you don't
|
|
126
81
|
mention the branch name, then by default the content will be exported from all the
|
|
127
82
|
branches of your stack.
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
-k, --stack-api-key=<value> API Key of the source stack
|
|
133
|
-
-m, --module=<value> [optional] Specific module name. If not specified, the export command will export all
|
|
83
|
+
--branch-alias=<value> (Optional) The alias of the branch from which you want to export content.
|
|
84
|
+
--content-types=<value>... [optional] The UID of the content type(s) whose content you want to export. In case
|
|
85
|
+
of multiple content types, specify the IDs separated by spaces.
|
|
86
|
+
--module=<value> [optional] Specific module name. If not specified, the export command will export all
|
|
134
87
|
the modules to the stack. The available modules are assets, content-types, entries,
|
|
135
88
|
environments, extensions, marketplace-apps, global-fields, labels, locales, webhooks,
|
|
136
89
|
workflows, custom-roles, taxonomies, and studio.
|
|
137
|
-
-t, --content-types=<value>... [optional] The UID of the content type(s) whose content you want to export. In case
|
|
138
|
-
of multiple content types, specify the IDs separated by spaces.
|
|
139
|
-
-y, --yes [optional] Force override all Marketplace prompts.
|
|
140
|
-
--branch-alias=<value> (Optional) The alias of the branch from which you want to export content.
|
|
141
90
|
--secured-assets [optional] Use this flag for assets that are secured.
|
|
142
91
|
|
|
143
92
|
DESCRIPTION
|
|
144
93
|
Export content from a stack
|
|
145
94
|
|
|
146
|
-
ALIASES
|
|
147
|
-
$ csdx cm:export
|
|
148
|
-
|
|
149
95
|
EXAMPLES
|
|
150
96
|
$ csdx cm:stacks:export --stack-api-key <stack_api_key> --data-dir <path/of/export/destination/dir>
|
|
151
97
|
|
|
@@ -14,14 +14,13 @@ class ExportCommand extends cli_command_1.Command {
|
|
|
14
14
|
// Prepare the context object
|
|
15
15
|
const context = this.createExportContext(exportConfig.apiKey, exportConfig.authenticationMethod);
|
|
16
16
|
exportConfig.context = Object.assign({}, context);
|
|
17
|
-
//log.info(`Using Cli Version: ${this.context?.cliVersion}`, exportConfig.context);
|
|
18
17
|
// Assign exportConfig variables
|
|
19
18
|
this.assignExportConfig(exportConfig);
|
|
20
|
-
exportDir = (0, cli_utilities_1.sanitizePath)(exportConfig.cliLogsPath || exportConfig.
|
|
19
|
+
exportDir = (0, cli_utilities_1.sanitizePath)(exportConfig.cliLogsPath || exportConfig.exportDir);
|
|
21
20
|
const managementAPIClient = await (0, cli_utilities_1.managementSDKClient)(exportConfig);
|
|
22
21
|
const moduleExporter = new export_1.ModuleExporter(managementAPIClient, exportConfig);
|
|
23
22
|
await moduleExporter.start();
|
|
24
|
-
cli_utilities_1.log.success(`The content of the stack ${exportConfig.apiKey} has been exported successfully
|
|
23
|
+
cli_utilities_1.log.success(`The content of the stack ${exportConfig.apiKey} has been exported successfully!`);
|
|
25
24
|
cli_utilities_1.log.info(`The exported content has been stored at '${exportDir}'`, exportConfig.context);
|
|
26
25
|
cli_utilities_1.log.success(`The log has been stored at '${(0, cli_utilities_1.getLogPath)()}'`, exportConfig.context);
|
|
27
26
|
// Print comprehensive summary at the end
|
|
@@ -83,27 +82,16 @@ ExportCommand.examples = [
|
|
|
83
82
|
'csdx cm:stacks:export --module <single module name>',
|
|
84
83
|
'csdx cm:stacks:export --branch [optional] branch name',
|
|
85
84
|
];
|
|
86
|
-
ExportCommand.usage = 'cm:stacks:export [
|
|
85
|
+
ExportCommand.usage = 'cm:stacks:export [--config <value>] [--stack-api-key <value>] [--data-dir <value>] [--alias <value>] [--module <value>] [--content-types <value>] [--branch <value>] [--secured-assets]';
|
|
87
86
|
ExportCommand.flags = {
|
|
88
87
|
config: cli_utilities_1.flags.string({
|
|
89
88
|
char: 'c',
|
|
90
89
|
description: '[optional] Path of the config',
|
|
91
90
|
}),
|
|
92
|
-
'stack-uid': cli_utilities_1.flags.string({
|
|
93
|
-
char: 's',
|
|
94
|
-
description: 'API key of the source stack',
|
|
95
|
-
hidden: true,
|
|
96
|
-
parse: (0, cli_utilities_1.printFlagDeprecation)(['-s', '--stack-uid'], ['-k', '--stack-api-key']),
|
|
97
|
-
}),
|
|
98
91
|
'stack-api-key': cli_utilities_1.flags.string({
|
|
99
92
|
char: 'k',
|
|
100
93
|
description: 'API Key of the source stack',
|
|
101
94
|
}),
|
|
102
|
-
data: cli_utilities_1.flags.string({
|
|
103
|
-
description: 'path or location to store the data',
|
|
104
|
-
hidden: true,
|
|
105
|
-
parse: (0, cli_utilities_1.printFlagDeprecation)(['--data'], ['--data-dir']),
|
|
106
|
-
}),
|
|
107
95
|
'data-dir': cli_utilities_1.flags.string({
|
|
108
96
|
char: 'd',
|
|
109
97
|
description: 'The path or the location in your file system to store the exported content. For e.g., ./content',
|
|
@@ -112,33 +100,16 @@ ExportCommand.flags = {
|
|
|
112
100
|
char: 'a',
|
|
113
101
|
description: 'The management token alias of the source stack from which you will export content.',
|
|
114
102
|
}),
|
|
115
|
-
'management-token-alias': cli_utilities_1.flags.string({
|
|
116
|
-
description: 'alias of the management token',
|
|
117
|
-
hidden: true,
|
|
118
|
-
parse: (0, cli_utilities_1.printFlagDeprecation)(['--management-token-alias'], ['-a', '--alias']),
|
|
119
|
-
}),
|
|
120
|
-
'auth-token': cli_utilities_1.flags.boolean({
|
|
121
|
-
char: 'A',
|
|
122
|
-
description: 'to use auth token',
|
|
123
|
-
hidden: true,
|
|
124
|
-
parse: (0, cli_utilities_1.printFlagDeprecation)(['-A', '--auth-token']),
|
|
125
|
-
}),
|
|
126
103
|
module: cli_utilities_1.flags.string({
|
|
127
|
-
char: 'm',
|
|
128
104
|
description: '[optional] Specific module name. If not specified, the export command will export all the modules to the stack. The available modules are assets, content-types, entries, environments, extensions, marketplace-apps, global-fields, labels, locales, webhooks, workflows, custom-roles, taxonomies, and studio.',
|
|
129
|
-
parse: (0, cli_utilities_1.printFlagDeprecation)(['-m'], ['--module']),
|
|
130
105
|
}),
|
|
131
106
|
'content-types': cli_utilities_1.flags.string({
|
|
132
|
-
char: 't',
|
|
133
107
|
description: '[optional] The UID of the content type(s) whose content you want to export. In case of multiple content types, specify the IDs separated by spaces.',
|
|
134
108
|
multiple: true,
|
|
135
|
-
parse: (0, cli_utilities_1.printFlagDeprecation)(['-t'], ['--content-types']),
|
|
136
109
|
}),
|
|
137
110
|
branch: cli_utilities_1.flags.string({
|
|
138
|
-
char: 'B',
|
|
139
111
|
// default: 'main',
|
|
140
112
|
description: "[optional] The name of the branch where you want to export your content. If you don't mention the branch name, then by default the content will be exported from all the branches of your stack.",
|
|
141
|
-
parse: (0, cli_utilities_1.printFlagDeprecation)(['-B'], ['--branch']),
|
|
142
113
|
exclusive: ['branch-alias'],
|
|
143
114
|
}),
|
|
144
115
|
'branch-alias': cli_utilities_1.flags.string({
|
|
@@ -158,4 +129,3 @@ ExportCommand.flags = {
|
|
|
158
129
|
hidden: true,
|
|
159
130
|
}),
|
|
160
131
|
};
|
|
161
|
-
ExportCommand.aliases = ['cm:export'];
|
|
@@ -36,7 +36,7 @@ class ExportAssets extends base_class_1.default {
|
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
async start() {
|
|
39
|
-
this.assetsRootPath = (0, node_path_1.resolve)(this.exportConfig.
|
|
39
|
+
this.assetsRootPath = (0, node_path_1.resolve)(this.exportConfig.exportDir, this.exportConfig.branchName || '', this.assetConfig.dirName);
|
|
40
40
|
cli_utilities_1.log.debug(`Assets root path resolved to: ${this.assetsRootPath}`, this.exportConfig.context);
|
|
41
41
|
cli_utilities_1.log.debug('Fetching assets and folders count...', this.exportConfig.context);
|
|
42
42
|
// NOTE step 1: Get assets and it's folder count in parallel
|
|
@@ -19,7 +19,7 @@ class ExportComposableStudio {
|
|
|
19
19
|
cli_utilities_1.cliux.print('WARNING!!! To export Studio projects, you must be logged in. Please check csdx auth:login --help to log in', { color: 'yellow' });
|
|
20
20
|
return Promise.resolve();
|
|
21
21
|
}
|
|
22
|
-
this.composableStudioPath = (0, node_path_1.resolve)(this.exportConfig.
|
|
22
|
+
this.composableStudioPath = (0, node_path_1.resolve)(this.exportConfig.exportDir, this.exportConfig.branchName || '', this.composableStudioConfig.dirName);
|
|
23
23
|
cli_utilities_1.log.debug(`Studio folder path: ${this.composableStudioPath}`, this.exportConfig.context);
|
|
24
24
|
await utils_1.fsUtil.makeDirectory(this.composableStudioPath);
|
|
25
25
|
cli_utilities_1.log.debug('Created Studio directory', this.exportConfig.context);
|
|
@@ -22,7 +22,7 @@ class ContentTypesExport extends base_class_1.default {
|
|
|
22
22
|
}
|
|
23
23
|
// Add after existing qs setup and before contentTypesDirPath
|
|
24
24
|
this.applyQueryFilters(this.qs, 'content-types');
|
|
25
|
-
this.contentTypesDirPath = path.resolve((0, cli_utilities_1.sanitizePath)(exportConfig.
|
|
25
|
+
this.contentTypesDirPath = path.resolve((0, cli_utilities_1.sanitizePath)(exportConfig.exportDir), (0, cli_utilities_1.sanitizePath)(exportConfig.branchName || ''), (0, cli_utilities_1.sanitizePath)(this.contentTypesConfig.dirName));
|
|
26
26
|
this.contentTypes = [];
|
|
27
27
|
this.exportConfig.context.module = utils_1.MODULE_CONTEXTS.CONTENT_TYPES;
|
|
28
28
|
this.currentModuleName = utils_1.MODULE_NAMES[utils_1.MODULE_CONTEXTS.CONTENT_TYPES];
|
|
@@ -25,7 +25,7 @@ class ExportCustomRoles extends base_class_1.default {
|
|
|
25
25
|
cli_utilities_1.log.debug('Starting custom roles export process...', this.exportConfig.context);
|
|
26
26
|
const [totalRoles, totalLocales] = await this.withLoadingSpinner('CUSTOM-ROLES: Analyzing roles and locales...', async () => {
|
|
27
27
|
var _a;
|
|
28
|
-
this.rolesFolderPath = (0, node_path_1.resolve)(this.exportConfig.
|
|
28
|
+
this.rolesFolderPath = (0, node_path_1.resolve)(this.exportConfig.exportDir, this.exportConfig.branchName || '', this.customRolesConfig.dirName);
|
|
29
29
|
await utils_1.fsUtil.makeDirectory(this.rolesFolderPath);
|
|
30
30
|
this.customRolesLocalesFilepath = (0, node_path_1.resolve)(this.rolesFolderPath, this.customRolesConfig.customRolesLocalesFileName);
|
|
31
31
|
// Get counts for progress tracking
|
|
@@ -14,9 +14,9 @@ class EntriesExport extends base_class_1.default {
|
|
|
14
14
|
this.stackAPIClient = stackAPIClient;
|
|
15
15
|
this.exportConfig = exportConfig;
|
|
16
16
|
this.entriesConfig = exportConfig.modules.entries;
|
|
17
|
-
this.entriesDirPath = path.resolve((0, cli_utilities_2.sanitizePath)(exportConfig.
|
|
18
|
-
this.localesFilePath = path.resolve((0, cli_utilities_2.sanitizePath)(exportConfig.
|
|
19
|
-
this.schemaFilePath = path.resolve((0, cli_utilities_2.sanitizePath)(exportConfig.
|
|
17
|
+
this.entriesDirPath = path.resolve((0, cli_utilities_2.sanitizePath)(exportConfig.exportDir), (0, cli_utilities_2.sanitizePath)(exportConfig.branchName || ''), (0, cli_utilities_2.sanitizePath)(this.entriesConfig.dirName));
|
|
18
|
+
this.localesFilePath = path.resolve((0, cli_utilities_2.sanitizePath)(exportConfig.exportDir), (0, cli_utilities_2.sanitizePath)(exportConfig.branchName || ''), (0, cli_utilities_2.sanitizePath)(exportConfig.modules.locales.dirName), (0, cli_utilities_2.sanitizePath)(exportConfig.modules.locales.fileName));
|
|
19
|
+
this.schemaFilePath = path.resolve((0, cli_utilities_2.sanitizePath)(exportConfig.exportDir), (0, cli_utilities_2.sanitizePath)(exportConfig.branchName || ''), (0, cli_utilities_2.sanitizePath)(exportConfig.modules.content_types.dirName), 'schema.json');
|
|
20
20
|
this.projectInstance = new cli_variants_1.ExportProjects(this.exportConfig);
|
|
21
21
|
this.exportConfig.context.module = utils_1.MODULE_CONTEXTS.ENTRIES;
|
|
22
22
|
this.currentModuleName = utils_1.MODULE_NAMES[utils_1.MODULE_CONTEXTS.ENTRIES];
|
|
@@ -21,7 +21,7 @@ class ExportEnvironments extends base_class_1.default {
|
|
|
21
21
|
cli_utilities_1.log.debug('Starting environment export process...', this.exportConfig.context);
|
|
22
22
|
// Setup with loading spinner
|
|
23
23
|
const [totalCount] = await this.withLoadingSpinner('ENVIRONMENTS: Analyzing environments...', async () => {
|
|
24
|
-
this.environmentsFolderPath = (0, node_path_1.resolve)(this.exportConfig.
|
|
24
|
+
this.environmentsFolderPath = (0, node_path_1.resolve)(this.exportConfig.exportDir, this.exportConfig.branchName || '', this.environmentConfig.dirName);
|
|
25
25
|
await utils_1.fsUtil.makeDirectory(this.environmentsFolderPath);
|
|
26
26
|
cli_utilities_1.log.debug(`Environments folder path: ${this.environmentsFolderPath}`, this.exportConfig.context);
|
|
27
27
|
// Get count for progress tracking
|
|
@@ -22,7 +22,7 @@ class ExportExtensions extends base_class_1.default {
|
|
|
22
22
|
cli_utilities_1.log.debug('Starting extensions export process...', this.exportConfig.context);
|
|
23
23
|
// Setup with loading spinner
|
|
24
24
|
const [totalCount] = await this.withLoadingSpinner('EXTENSIONS: Analyzing extensions...', async () => {
|
|
25
|
-
this.extensionsFolderPath = (0, node_path_1.resolve)(this.exportConfig.
|
|
25
|
+
this.extensionsFolderPath = (0, node_path_1.resolve)(this.exportConfig.exportDir, this.exportConfig.branchName || '', this.extensionConfig.dirName);
|
|
26
26
|
await utils_1.fsUtil.makeDirectory(this.extensionsFolderPath);
|
|
27
27
|
cli_utilities_1.log.debug(`Extensions folder path: ${this.extensionsFolderPath}`, this.exportConfig.context);
|
|
28
28
|
// Get count for progress tracking
|
|
@@ -17,7 +17,7 @@ class GlobalFieldsExport extends base_class_1.default {
|
|
|
17
17
|
limit: this.globalFieldsConfig.limit,
|
|
18
18
|
include_global_field_schema: true,
|
|
19
19
|
};
|
|
20
|
-
this.globalFieldsDirPath = path.resolve((0, cli_utilities_1.sanitizePath)(exportConfig.
|
|
20
|
+
this.globalFieldsDirPath = path.resolve((0, cli_utilities_1.sanitizePath)(exportConfig.exportDir), (0, cli_utilities_1.sanitizePath)(exportConfig.branchName || ''), (0, cli_utilities_1.sanitizePath)(this.globalFieldsConfig.dirName));
|
|
21
21
|
this.globalFields = [];
|
|
22
22
|
this.applyQueryFilters(this.qs, 'global-fields');
|
|
23
23
|
this.exportConfig.context.module = utils_1.MODULE_CONTEXTS.GLOBAL_FIELDS;
|
|
@@ -21,7 +21,7 @@ class ExportLabels extends base_class_1.default {
|
|
|
21
21
|
cli_utilities_1.log.debug('Starting labels export process...', this.exportConfig.context);
|
|
22
22
|
// Setup with loading spinner
|
|
23
23
|
const [totalCount] = await this.withLoadingSpinner('LABELS: Analyzing labels...', async () => {
|
|
24
|
-
this.labelsFolderPath = (0, node_path_1.resolve)(this.exportConfig.
|
|
24
|
+
this.labelsFolderPath = (0, node_path_1.resolve)(this.exportConfig.exportDir, this.exportConfig.branchName || '', this.labelConfig.dirName);
|
|
25
25
|
await utils_1.fsUtil.makeDirectory(this.labelsFolderPath);
|
|
26
26
|
cli_utilities_1.log.debug(`Labels folder path: ${this.labelsFolderPath}`, this.exportConfig.context);
|
|
27
27
|
// Get count for progress tracking
|
|
@@ -18,7 +18,7 @@ class LocaleExport extends base_class_1.default {
|
|
|
18
18
|
BASE: this.localeConfig.requiredKeys,
|
|
19
19
|
},
|
|
20
20
|
};
|
|
21
|
-
this.localesPath = path.resolve((0, cli_utilities_1.sanitizePath)(exportConfig.
|
|
21
|
+
this.localesPath = path.resolve((0, cli_utilities_1.sanitizePath)(exportConfig.exportDir), (0, cli_utilities_1.sanitizePath)(exportConfig.branchName || ''), (0, cli_utilities_1.sanitizePath)(this.localeConfig.dirName));
|
|
22
22
|
this.locales = {};
|
|
23
23
|
this.masterLocale = {};
|
|
24
24
|
this.exportConfig.context.module = utils_1.MODULE_CONTEXTS.LOCALES;
|
|
@@ -74,14 +74,14 @@ class ExportMarketplaceApps extends base_class_1.default {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
async setupPaths() {
|
|
77
|
-
this.marketplaceAppPath = (0, node_path_1.resolve)(this.exportConfig.
|
|
77
|
+
this.marketplaceAppPath = (0, node_path_1.resolve)(this.exportConfig.exportDir, this.exportConfig.branchName || '', this.marketplaceAppConfig.dirName);
|
|
78
78
|
cli_utilities_1.log.debug(`Marketplace apps folder path: '${this.marketplaceAppPath}'`, this.exportConfig.context);
|
|
79
79
|
await utils_1.fsUtil.makeDirectory(this.marketplaceAppPath);
|
|
80
80
|
cli_utilities_1.log.debug('Created marketplace apps directory', this.exportConfig.context);
|
|
81
81
|
this.developerHubBaseUrl = this.exportConfig.developerHubBaseUrl || (await (0, utils_1.getDeveloperHubUrl)(this.exportConfig));
|
|
82
82
|
cli_utilities_1.log.debug(`Developer hub base URL: '${this.developerHubBaseUrl}'`, this.exportConfig.context);
|
|
83
83
|
this.exportConfig.org_uid = await (0, utils_1.getOrgUid)(this.exportConfig);
|
|
84
|
-
this.query = { target_uids: this.exportConfig.
|
|
84
|
+
this.query = { target_uids: this.exportConfig.apiKey };
|
|
85
85
|
cli_utilities_1.log.debug(`Organization UID: '${this.exportConfig.org_uid}'.`, this.exportConfig.context);
|
|
86
86
|
// NOTE init marketplace app sdk
|
|
87
87
|
const host = this.developerHubBaseUrl.split('://').pop();
|
|
@@ -11,7 +11,7 @@ class ExportStack extends base_class_1.default {
|
|
|
11
11
|
super({ exportConfig, stackAPIClient });
|
|
12
12
|
this.stackConfig = exportConfig.modules.stack;
|
|
13
13
|
this.qs = { include_count: true };
|
|
14
|
-
this.stackFolderPath = (0, node_path_1.resolve)(this.exportConfig.
|
|
14
|
+
this.stackFolderPath = (0, node_path_1.resolve)(this.exportConfig.exportDir, this.exportConfig.branchName || '', this.stackConfig.dirName);
|
|
15
15
|
this.exportConfig.context.module = utils_1.MODULE_CONTEXTS.STACK;
|
|
16
16
|
this.currentModuleName = utils_1.MODULE_NAMES[utils_1.MODULE_CONTEXTS.STACK];
|
|
17
17
|
}
|
|
@@ -92,18 +92,18 @@ class ExportStack extends base_class_1.default {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
async getStack() {
|
|
95
|
-
cli_utilities_1.log.debug(`Fetching stack data for: '${this.exportConfig.
|
|
95
|
+
cli_utilities_1.log.debug(`Fetching stack data for: '${this.exportConfig.apiKey}'...`, this.exportConfig.context);
|
|
96
96
|
const tempAPIClient = await (0, cli_utilities_1.managementSDKClient)({ host: this.exportConfig.host });
|
|
97
97
|
cli_utilities_1.log.debug(`Created Management SDK client with host: '${this.exportConfig.host}'.`, this.exportConfig.context);
|
|
98
98
|
return await tempAPIClient
|
|
99
|
-
.stack({ api_key: this.exportConfig.
|
|
99
|
+
.stack({ api_key: this.exportConfig.apiKey })
|
|
100
100
|
.fetch()
|
|
101
101
|
.then((data) => {
|
|
102
|
-
cli_utilities_1.log.debug(`Successfully fetched stack data for: '${this.exportConfig.
|
|
102
|
+
cli_utilities_1.log.debug(`Successfully fetched stack data for: '${this.exportConfig.apiKey}'.`, this.exportConfig.context);
|
|
103
103
|
return data;
|
|
104
104
|
})
|
|
105
105
|
.catch((error) => {
|
|
106
|
-
cli_utilities_1.log.debug(`Failed to fetch stack data for: '${this.exportConfig.
|
|
106
|
+
cli_utilities_1.log.debug(`Failed to fetch stack data for: '${this.exportConfig.apiKey}'.`, this.exportConfig.context);
|
|
107
107
|
return {};
|
|
108
108
|
});
|
|
109
109
|
}
|
|
@@ -140,7 +140,7 @@ class ExportStack extends base_class_1.default {
|
|
|
140
140
|
return masterLocalObj;
|
|
141
141
|
}
|
|
142
142
|
else if (skip >= count) {
|
|
143
|
-
cli_utilities_1.log.error(`Locale locale not found in the stack ${this.exportConfig.
|
|
143
|
+
cli_utilities_1.log.error(`Locale locale not found in the stack ${this.exportConfig.apiKey}. Please ensure that the stack has a master locale.`, this.exportConfig.context);
|
|
144
144
|
cli_utilities_1.log.debug('Completed search. Master locale not found.', this.exportConfig.context);
|
|
145
145
|
return;
|
|
146
146
|
}
|
|
@@ -155,14 +155,14 @@ class ExportStack extends base_class_1.default {
|
|
|
155
155
|
})
|
|
156
156
|
.catch((error) => {
|
|
157
157
|
var _a;
|
|
158
|
-
cli_utilities_1.log.debug(`Error occurred while fetching locales for stack: ${this.exportConfig.
|
|
158
|
+
cli_utilities_1.log.debug(`Error occurred while fetching locales for stack: ${this.exportConfig.apiKey}`, this.exportConfig.context);
|
|
159
159
|
(_a = this.progressManager) === null || _a === void 0 ? void 0 : _a.tick(false, 'locale fetch', (error === null || error === void 0 ? void 0 : error.message) || utils_1.PROCESS_STATUS[utils_1.PROCESS_NAMES.STACK_LOCALE].FAILED, utils_1.PROCESS_NAMES.STACK_LOCALE);
|
|
160
|
-
(0, cli_utilities_1.handleAndLogError)(error, Object.assign({}, this.exportConfig.context), `Failed to fetch locales for stack ${this.exportConfig.
|
|
160
|
+
(0, cli_utilities_1.handleAndLogError)(error, Object.assign({}, this.exportConfig.context), `Failed to fetch locales for stack ${this.exportConfig.apiKey}`);
|
|
161
161
|
throw error;
|
|
162
162
|
});
|
|
163
163
|
}
|
|
164
164
|
async exportStack() {
|
|
165
|
-
cli_utilities_1.log.debug(`Starting stack export for: '${this.exportConfig.
|
|
165
|
+
cli_utilities_1.log.debug(`Starting stack export for: '${this.exportConfig.apiKey}'...`, this.exportConfig.context);
|
|
166
166
|
await utils_1.fsUtil.makeDirectory(this.stackFolderPath);
|
|
167
167
|
cli_utilities_1.log.debug(`Created stack directory at: '${this.stackFolderPath}'`, this.exportConfig.context);
|
|
168
168
|
return this.stack
|
|
@@ -173,14 +173,14 @@ class ExportStack extends base_class_1.default {
|
|
|
173
173
|
cli_utilities_1.log.debug(`Writing stack data to: '${stackFilePath}'`, this.exportConfig.context);
|
|
174
174
|
utils_1.fsUtil.writeFile(stackFilePath, resp);
|
|
175
175
|
// Track progress for stack export completion
|
|
176
|
-
(_a = this.progressManager) === null || _a === void 0 ? void 0 : _a.tick(true, `stack: ${this.exportConfig.
|
|
177
|
-
cli_utilities_1.log.success(`Stack details exported successfully for stack ${this.exportConfig.
|
|
176
|
+
(_a = this.progressManager) === null || _a === void 0 ? void 0 : _a.tick(true, `stack: ${this.exportConfig.apiKey}`, null, utils_1.PROCESS_NAMES.STACK_DETAILS);
|
|
177
|
+
cli_utilities_1.log.success(`Stack details exported successfully for stack ${this.exportConfig.apiKey}`, this.exportConfig.context);
|
|
178
178
|
cli_utilities_1.log.debug('Stack export completed successfully.', this.exportConfig.context);
|
|
179
179
|
return resp;
|
|
180
180
|
})
|
|
181
181
|
.catch((error) => {
|
|
182
182
|
var _a;
|
|
183
|
-
cli_utilities_1.log.debug(`Error occurred while exporting stack: ${this.exportConfig.
|
|
183
|
+
cli_utilities_1.log.debug(`Error occurred while exporting stack: ${this.exportConfig.apiKey}`, this.exportConfig.context);
|
|
184
184
|
(_a = this.progressManager) === null || _a === void 0 ? void 0 : _a.tick(false, 'stack export', (error === null || error === void 0 ? void 0 : error.message) || utils_1.PROCESS_STATUS[utils_1.PROCESS_NAMES.STACK_DETAILS].FAILED, utils_1.PROCESS_NAMES.STACK_DETAILS);
|
|
185
185
|
(0, cli_utilities_1.handleAndLogError)(error, Object.assign({}, this.exportConfig.context));
|
|
186
186
|
});
|
|
@@ -18,13 +18,13 @@ class ExportTaxonomies extends base_class_1.default {
|
|
|
18
18
|
this.qs = { include_count: true, limit: this.taxonomiesConfig.limit || 100, skip: 0 };
|
|
19
19
|
this.applyQueryFilters(this.qs, 'taxonomies');
|
|
20
20
|
this.exportConfig.context.module = 'taxonomies';
|
|
21
|
-
this.localesFilePath = (0, node_path_1.resolve)((0, cli_utilities_1.sanitizePath)(exportConfig.
|
|
21
|
+
this.localesFilePath = (0, node_path_1.resolve)((0, cli_utilities_1.sanitizePath)(exportConfig.exportDir), (0, cli_utilities_1.sanitizePath)(exportConfig.branchName || ''), (0, cli_utilities_1.sanitizePath)(exportConfig.modules.locales.dirName), (0, cli_utilities_1.sanitizePath)(exportConfig.modules.locales.fileName));
|
|
22
22
|
}
|
|
23
23
|
async start() {
|
|
24
24
|
var _a;
|
|
25
25
|
cli_utilities_1.log.debug('Starting export process for taxonomies...', this.exportConfig.context);
|
|
26
26
|
//create taxonomies folder
|
|
27
|
-
this.taxonomiesFolderPath = (0, node_path_1.resolve)(this.exportConfig.
|
|
27
|
+
this.taxonomiesFolderPath = (0, node_path_1.resolve)(this.exportConfig.exportDir, this.exportConfig.branchName || '', this.taxonomiesConfig.dirName);
|
|
28
28
|
cli_utilities_1.log.debug(`Taxonomies folder path: '${this.taxonomiesFolderPath}'`, this.exportConfig.context);
|
|
29
29
|
await utils_1.fsUtil.makeDirectory(this.taxonomiesFolderPath);
|
|
30
30
|
cli_utilities_1.log.debug('Created taxonomies directory.', this.exportConfig.context);
|
|
@@ -21,7 +21,7 @@ class ExportWebhooks extends base_class_1.default {
|
|
|
21
21
|
cli_utilities_1.log.debug('Starting webhooks export process...', this.exportConfig.context);
|
|
22
22
|
// Setup with loading spinner
|
|
23
23
|
const [totalCount] = await this.withLoadingSpinner('WEBHOOKS: Analyzing webhooks...', async () => {
|
|
24
|
-
this.webhooksFolderPath = (0, node_path_1.resolve)(this.exportConfig.
|
|
24
|
+
this.webhooksFolderPath = (0, node_path_1.resolve)(this.exportConfig.exportDir, this.exportConfig.branchName || '', this.webhookConfig.dirName);
|
|
25
25
|
await utils_1.fsUtil.makeDirectory(this.webhooksFolderPath);
|
|
26
26
|
// Get count for progress tracking
|
|
27
27
|
const countResponse = await this.stack.webhook().fetchAll(Object.assign(Object.assign({}, this.qs), { limit: 1 }));
|
|
@@ -22,7 +22,7 @@ class ExportWorkFlows extends base_class_1.default {
|
|
|
22
22
|
// Setup with loading spinner
|
|
23
23
|
const [totalCount] = await this.withLoadingSpinner('WORKFLOWS: Analyzing workflows...', async () => {
|
|
24
24
|
var _a;
|
|
25
|
-
this.webhooksFolderPath = (0, node_path_1.resolve)(this.exportConfig.
|
|
25
|
+
this.webhooksFolderPath = (0, node_path_1.resolve)(this.exportConfig.exportDir, this.exportConfig.branchName || '', this.workflowConfig.dirName);
|
|
26
26
|
await utils_1.fsUtil.makeDirectory(this.webhooksFolderPath);
|
|
27
27
|
// Get count for progress tracking
|
|
28
28
|
const countResponse = await this.stack.workflow().fetchAll(Object.assign(Object.assign({}, this.qs), { limit: 1 }));
|
package/lib/types/index.d.ts
CHANGED
package/lib/utils/basic-login.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
/* eslint-disable no-empty */
|
|
5
5
|
/*!
|
|
6
6
|
* Contentstack Import
|
|
7
|
-
* Copyright (c)
|
|
7
|
+
* Copyright (c) 2026 Contentstack LLC
|
|
8
8
|
* MIT Licensed
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -16,7 +16,7 @@ const login = async (config) => {
|
|
|
16
16
|
const response = await client.login({ email: config.email, password: config.password }).catch(Promise.reject);
|
|
17
17
|
if ((_a = response === null || response === void 0 ? void 0 : response.user) === null || _a === void 0 ? void 0 : _a.authtoken) {
|
|
18
18
|
config.headers = {
|
|
19
|
-
api_key: config.
|
|
19
|
+
api_key: config.apiKey,
|
|
20
20
|
access_token: config.access_token,
|
|
21
21
|
authtoken: response.user.authtoken,
|
|
22
22
|
'X-User-Agent': 'contentstack-export/v',
|
|
@@ -30,11 +30,11 @@ const login = async (config) => {
|
|
|
30
30
|
process.exit(1);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
else if (!config.email && !config.password && config.
|
|
33
|
+
else if (!config.email && !config.password && config.apiKey && config.access_token) {
|
|
34
34
|
cli_utilities_1.log.info(`Content types, entries, assets, labels, global fields, extensions modules will be exported`, config.context);
|
|
35
35
|
cli_utilities_1.log.info(`Email, password, or management token is not set in the config, cannot export Webhook and label modules`, config.context);
|
|
36
36
|
config.headers = {
|
|
37
|
-
api_key: config.
|
|
37
|
+
api_key: config.apiKey,
|
|
38
38
|
access_token: config.access_token,
|
|
39
39
|
'X-User-Agent': 'contentstack-export/v',
|
|
40
40
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*!
|
|
3
3
|
* Contentstack Export
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) 2026 Contentstack LLC
|
|
5
5
|
* MIT Licensed
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -13,13 +13,13 @@ const validateConfig = function (config) {
|
|
|
13
13
|
if (!config.host || !config.cdn) {
|
|
14
14
|
throw new Error('Host/CDN end point is missing from config');
|
|
15
15
|
}
|
|
16
|
-
if (config.email && config.password && !config.access_token && !config.
|
|
16
|
+
if (config.email && config.password && !config.access_token && !config.apiKey) {
|
|
17
17
|
throw new Error('Kindly provide access_token or api_token');
|
|
18
18
|
}
|
|
19
19
|
else if (!config.email &&
|
|
20
20
|
!config.password &&
|
|
21
21
|
!config.management_token &&
|
|
22
|
-
config.
|
|
22
|
+
config.apiKey &&
|
|
23
23
|
!config.access_token &&
|
|
24
24
|
!(0, cli_utilities_1.isAuthenticated)()) {
|
|
25
25
|
throw new Error('Kindly provide management_token or email and password');
|
|
@@ -27,7 +27,7 @@ const validateConfig = function (config) {
|
|
|
27
27
|
else if (config.email &&
|
|
28
28
|
config.password &&
|
|
29
29
|
!config.access_token &&
|
|
30
|
-
config.
|
|
30
|
+
config.apiKey &&
|
|
31
31
|
!config.management_token &&
|
|
32
32
|
!(0, cli_utilities_1.isAuthenticated)()) {
|
|
33
33
|
throw new Error('Kindly provide access_token or management_token');
|
|
@@ -10,6 +10,9 @@ const interactive_1 = require("./interactive");
|
|
|
10
10
|
const basic_login_1 = tslib_1.__importDefault(require("./basic-login"));
|
|
11
11
|
const lodash_1 = require("lodash");
|
|
12
12
|
const setupConfig = async (exportCmdFlags) => {
|
|
13
|
+
// Set progress supported module FIRST, before any log calls
|
|
14
|
+
// This ensures the logger respects the showConsoleLogs setting correctly
|
|
15
|
+
cli_utilities_1.configHandler.set('log.progressSupportedModule', 'export');
|
|
13
16
|
let config = (0, merge_1.default)({}, config_1.default);
|
|
14
17
|
// Track authentication method
|
|
15
18
|
let authenticationMethod = 'unknown';
|
|
@@ -20,7 +23,7 @@ const setupConfig = async (exportCmdFlags) => {
|
|
|
20
23
|
const externalConfig = await (0, file_helper_1.readFile)(exportCmdFlags['config']);
|
|
21
24
|
config = merge_1.default.recursive(config, externalConfig);
|
|
22
25
|
}
|
|
23
|
-
config.exportDir = (0, cli_utilities_1.sanitizePath)(exportCmdFlags['data'] || exportCmdFlags['data-dir'] || config.
|
|
26
|
+
config.exportDir = (0, cli_utilities_1.sanitizePath)(exportCmdFlags['data'] || exportCmdFlags['data-dir'] || config.exportDir || (await (0, interactive_1.askExportDir)()));
|
|
24
27
|
const pattern = /[*$%#<>{}!&?]/g;
|
|
25
28
|
if (pattern.test(config.exportDir)) {
|
|
26
29
|
cli_utilities_1.cliux.print(`\nPlease enter a directory path without any special characters: (*,&,{,},[,],$,%,<,>,?,!)`, {
|
|
@@ -30,8 +33,6 @@ const setupConfig = async (exportCmdFlags) => {
|
|
|
30
33
|
}
|
|
31
34
|
config.exportDir = config.exportDir.replace(/['"]/g, '');
|
|
32
35
|
config.exportDir = path.resolve(config.exportDir);
|
|
33
|
-
//Note to support the old key
|
|
34
|
-
config.data = config.exportDir;
|
|
35
36
|
const managementTokenAlias = exportCmdFlags['management-token-alias'] || exportCmdFlags['alias'];
|
|
36
37
|
if (managementTokenAlias) {
|
|
37
38
|
cli_utilities_1.log.debug('Using management token alias', { alias: managementTokenAlias });
|
|
@@ -71,15 +72,13 @@ const setupConfig = async (exportCmdFlags) => {
|
|
|
71
72
|
cli_utilities_1.log.debug('User authenticated via auth token');
|
|
72
73
|
}
|
|
73
74
|
config.apiKey =
|
|
74
|
-
exportCmdFlags['stack-uid'] || exportCmdFlags['stack-api-key'] || config.
|
|
75
|
+
exportCmdFlags['stack-uid'] || exportCmdFlags['stack-api-key'] || config.apiKey || (await (0, interactive_1.askAPIKey)());
|
|
75
76
|
if (typeof config.apiKey !== 'string') {
|
|
76
77
|
cli_utilities_1.log.debug('Invalid API key received!', { apiKey: config.apiKey });
|
|
77
78
|
throw new Error('Invalid API key received');
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
|
-
// Note support old config
|
|
82
|
-
config.source_stack = config.apiKey;
|
|
83
82
|
config.forceStopMarketplaceAppsPrompt = exportCmdFlags.yes;
|
|
84
83
|
config.auth_token = cli_utilities_1.configHandler.get('authtoken'); // TBD handle auth token in httpClient & sdk
|
|
85
84
|
config.isAuthenticated = (0, cli_utilities_1.isAuthenticated)();
|
|
@@ -119,8 +118,6 @@ const setupConfig = async (exportCmdFlags) => {
|
|
|
119
118
|
throw new Error(`Invalid query format: ${error.message}`);
|
|
120
119
|
}
|
|
121
120
|
}
|
|
122
|
-
// Set progress supported module to check and display console logs
|
|
123
|
-
cli_utilities_1.configHandler.set('log.progressSupportedModule', 'export');
|
|
124
121
|
// Add authentication details to config for context tracking
|
|
125
122
|
config.authenticationMethod = authenticationMethod;
|
|
126
123
|
cli_utilities_1.log.debug('Export configuration setup completed.', Object.assign({}, config));
|
package/lib/utils/logger.d.ts
CHANGED
package/lib/utils/logger.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*!
|
|
3
3
|
* Contentstack Export
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) 2026 Contentstack LLC
|
|
5
5
|
* MIT Licensed
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -126,7 +126,7 @@ function init(_logPath) {
|
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
128
|
const log = async (config, message, type) => {
|
|
129
|
-
const logsPath = (0, cli_utilities_1.sanitizePath)(config.cliLogsPath || config.
|
|
129
|
+
const logsPath = (0, cli_utilities_1.sanitizePath)(config.cliLogsPath || config.exportDir);
|
|
130
130
|
// ignoring the type argument, as we are not using it to create a logfile anymore
|
|
131
131
|
if (type !== 'error') {
|
|
132
132
|
// removed type argument from init method
|
|
@@ -9,7 +9,7 @@ exports.getDeveloperHubUrl = getDeveloperHubUrl;
|
|
|
9
9
|
async function getOrgUid(config) {
|
|
10
10
|
const tempAPIClient = await (0, cli_utilities_1.managementSDKClient)({ host: config.host });
|
|
11
11
|
const tempStackData = await tempAPIClient
|
|
12
|
-
.stack({ api_key: config.
|
|
12
|
+
.stack({ api_key: config.apiKey })
|
|
13
13
|
.fetch()
|
|
14
14
|
.catch((error) => {
|
|
15
15
|
(0, cli_utilities_1.handleAndLogError)(error, Object.assign({}, config.context));
|
package/oclif.manifest.json
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"commands": {
|
|
3
3
|
"cm:stacks:export": {
|
|
4
|
-
"aliases": [
|
|
5
|
-
"cm:export"
|
|
6
|
-
],
|
|
4
|
+
"aliases": [],
|
|
7
5
|
"args": {},
|
|
8
6
|
"description": "Export content from a stack",
|
|
9
7
|
"examples": [
|
|
@@ -24,15 +22,6 @@
|
|
|
24
22
|
"multiple": false,
|
|
25
23
|
"type": "option"
|
|
26
24
|
},
|
|
27
|
-
"stack-uid": {
|
|
28
|
-
"char": "s",
|
|
29
|
-
"description": "API key of the source stack",
|
|
30
|
-
"hidden": true,
|
|
31
|
-
"name": "stack-uid",
|
|
32
|
-
"hasDynamicHelp": false,
|
|
33
|
-
"multiple": false,
|
|
34
|
-
"type": "option"
|
|
35
|
-
},
|
|
36
25
|
"stack-api-key": {
|
|
37
26
|
"char": "k",
|
|
38
27
|
"description": "API Key of the source stack",
|
|
@@ -41,14 +30,6 @@
|
|
|
41
30
|
"multiple": false,
|
|
42
31
|
"type": "option"
|
|
43
32
|
},
|
|
44
|
-
"data": {
|
|
45
|
-
"description": "path or location to store the data",
|
|
46
|
-
"hidden": true,
|
|
47
|
-
"name": "data",
|
|
48
|
-
"hasDynamicHelp": false,
|
|
49
|
-
"multiple": false,
|
|
50
|
-
"type": "option"
|
|
51
|
-
},
|
|
52
33
|
"data-dir": {
|
|
53
34
|
"char": "d",
|
|
54
35
|
"description": "The path or the location in your file system to store the exported content. For e.g., ./content",
|
|
@@ -65,24 +46,7 @@
|
|
|
65
46
|
"multiple": false,
|
|
66
47
|
"type": "option"
|
|
67
48
|
},
|
|
68
|
-
"management-token-alias": {
|
|
69
|
-
"description": "alias of the management token",
|
|
70
|
-
"hidden": true,
|
|
71
|
-
"name": "management-token-alias",
|
|
72
|
-
"hasDynamicHelp": false,
|
|
73
|
-
"multiple": false,
|
|
74
|
-
"type": "option"
|
|
75
|
-
},
|
|
76
|
-
"auth-token": {
|
|
77
|
-
"char": "A",
|
|
78
|
-
"description": "to use auth token",
|
|
79
|
-
"hidden": true,
|
|
80
|
-
"name": "auth-token",
|
|
81
|
-
"allowNo": false,
|
|
82
|
-
"type": "boolean"
|
|
83
|
-
},
|
|
84
49
|
"module": {
|
|
85
|
-
"char": "m",
|
|
86
50
|
"description": "[optional] Specific module name. If not specified, the export command will export all the modules to the stack. The available modules are assets, content-types, entries, environments, extensions, marketplace-apps, global-fields, labels, locales, webhooks, workflows, custom-roles, taxonomies, and studio.",
|
|
87
51
|
"name": "module",
|
|
88
52
|
"hasDynamicHelp": false,
|
|
@@ -90,7 +54,6 @@
|
|
|
90
54
|
"type": "option"
|
|
91
55
|
},
|
|
92
56
|
"content-types": {
|
|
93
|
-
"char": "t",
|
|
94
57
|
"description": "[optional] The UID of the content type(s) whose content you want to export. In case of multiple content types, specify the IDs separated by spaces.",
|
|
95
58
|
"name": "content-types",
|
|
96
59
|
"hasDynamicHelp": false,
|
|
@@ -98,7 +61,6 @@
|
|
|
98
61
|
"type": "option"
|
|
99
62
|
},
|
|
100
63
|
"branch": {
|
|
101
|
-
"char": "B",
|
|
102
64
|
"description": "[optional] The name of the branch where you want to export your content. If you don't mention the branch name, then by default the content will be exported from all the branches of your stack.",
|
|
103
65
|
"exclusive": [
|
|
104
66
|
"branch-alias"
|
|
@@ -148,7 +110,7 @@
|
|
|
148
110
|
"pluginName": "@contentstack/cli-cm-export",
|
|
149
111
|
"pluginType": "core",
|
|
150
112
|
"strict": true,
|
|
151
|
-
"usage": "cm:stacks:export [
|
|
113
|
+
"usage": "cm:stacks:export [--config <value>] [--stack-api-key <value>] [--data-dir <value>] [--alias <value>] [--module <value>] [--content-types <value>] [--branch <value>] [--secured-assets]",
|
|
152
114
|
"isESM": false,
|
|
153
115
|
"relativePath": [
|
|
154
116
|
"lib",
|
|
@@ -159,5 +121,5 @@
|
|
|
159
121
|
]
|
|
160
122
|
}
|
|
161
123
|
},
|
|
162
|
-
"version": "2.0.0-beta.
|
|
124
|
+
"version": "2.0.0-beta.5"
|
|
163
125
|
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-cm-export",
|
|
3
3
|
"description": "Contentstack CLI plugin to export content from stack",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.5",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@contentstack/cli-command": "~1.7.
|
|
9
|
-
"@
|
|
10
|
-
"@contentstack/cli-variants": "~2.0.0-beta.
|
|
11
|
-
"@
|
|
8
|
+
"@contentstack/cli-command": "~1.7.2",
|
|
9
|
+
"@contentstack/cli-utilities": "~1.17.0",
|
|
10
|
+
"@contentstack/cli-variants": "~2.0.0-beta.4",
|
|
11
|
+
"@oclif/core": "^4.8.0",
|
|
12
12
|
"async": "^3.2.6",
|
|
13
13
|
"big-json": "^3.2.0",
|
|
14
14
|
"bluebird": "^3.7.2",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"winston": "^3.17.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@contentstack/cli-auth": "~
|
|
25
|
-
"@contentstack/cli-config": "~1.
|
|
24
|
+
"@contentstack/cli-auth": "~2.0.0-beta.1",
|
|
25
|
+
"@contentstack/cli-config": "~1.18.0",
|
|
26
26
|
"@contentstack/cli-dev-dependencies": "~1.3.1",
|
|
27
27
|
"@oclif/plugin-help": "^6.2.28",
|
|
28
28
|
"@oclif/test": "^4.1.13",
|
|
@@ -89,13 +89,9 @@
|
|
|
89
89
|
"repositoryPrefix": "<%- repo %>/blob/main/packages/contentstack-export/<%- commandPath %>"
|
|
90
90
|
},
|
|
91
91
|
"csdxConfig": {
|
|
92
|
-
"expiredCommands": {
|
|
93
|
-
"cm:export": "csdx cm:stacks:export"
|
|
94
|
-
},
|
|
95
92
|
"shortCommandName": {
|
|
96
|
-
"cm:stacks:export": "EXPRT"
|
|
97
|
-
"cm:export": "O-EXPRT"
|
|
93
|
+
"cm:stacks:export": "EXPRT"
|
|
98
94
|
}
|
|
99
95
|
},
|
|
100
96
|
"repository": "https://github.com/contentstack/cli"
|
|
101
|
-
}
|
|
97
|
+
}
|