@contentstack/cli-cm-import 1.19.2 → 1.19.3
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/README.md +41 -21
- package/lib/commands/cm/stacks/import.js +11 -11
- package/lib/import/modules/assets.js +13 -6
- package/oclif.manifest.json +12 -12
- package/package.json +30 -30
package/README.md
CHANGED
|
@@ -47,7 +47,7 @@ $ npm install -g @contentstack/cli-cm-import
|
|
|
47
47
|
$ csdx COMMAND
|
|
48
48
|
running command...
|
|
49
49
|
$ csdx (--version)
|
|
50
|
-
@contentstack/cli-cm-import/1.19.
|
|
50
|
+
@contentstack/cli-cm-import/1.19.3 linux-x64 node-v18.20.5
|
|
51
51
|
$ csdx --help [COMMAND]
|
|
52
52
|
USAGE
|
|
53
53
|
$ csdx COMMAND
|
|
@@ -71,21 +71,31 @@ USAGE
|
|
|
71
71
|
[--branch <value>] [--import-webhook-status disable|current]
|
|
72
72
|
|
|
73
73
|
FLAGS
|
|
74
|
-
-B, --branch=<value>
|
|
75
|
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
74
|
+
-B, --branch=<value> The name of the branch where you want to import your content. If you don't mention
|
|
75
|
+
the branch name, then by default the content will be imported to the main branch.
|
|
76
|
+
-a, --alias=<value> The management token of the destination stack where you will import the content.
|
|
77
|
+
-b, --backup-dir=<value> [optional] Backup directory name when using specific module.
|
|
78
|
+
-c, --config=<value> [optional] Path of config file.
|
|
79
|
+
-d, --data-dir=<value> The path or the location in your file system where the content, you intend to
|
|
80
|
+
import, is stored. For example, -d "C:\Users\Name\Desktop\cli\content". If the
|
|
81
|
+
export folder has branches involved, then the path should point till the
|
|
82
|
+
particular branch. For example, “-d
|
|
83
|
+
"C:\Users\Name\Desktop\cli\content\branch_name"
|
|
79
84
|
-k, --stack-api-key=<value> API key of the target stack
|
|
80
|
-
-m, --module=<value> [optional]
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
-m, --module=<value> [optional] Specify the module to import into the target stack. If not specified,
|
|
86
|
+
the import command will import all the modules into the stack. The available
|
|
87
|
+
modules are assets, content-types, entries, environments, extensions,
|
|
88
|
+
marketplace-apps, global-fields, labels, locales, webhooks, workflows,
|
|
89
|
+
custom-roles, and taxonomies.
|
|
90
|
+
-y, --yes [optional] Force override all Marketplace prompts.
|
|
91
|
+
--exclude-global-modules Excludes the branch-independent module from the import operation.
|
|
92
|
+
--import-webhook-status=<option> [default: disable] [optional] This webhook state keeps the same state of webhooks
|
|
93
|
+
as the source stack.
|
|
84
94
|
<options: disable|current>
|
|
85
95
|
--personalize-project-name=<value> Personalize project name.
|
|
86
96
|
--replace-existing Replaces the existing module in the target stack.
|
|
87
97
|
--skip-app-recreation [optional] Skip private apps recreation if already exist
|
|
88
|
-
--skip-audit Skips the audit fix.
|
|
98
|
+
--skip-audit Skips the audit fix that occurs during an import operation.
|
|
89
99
|
--skip-existing Skips the module exists warning messages.
|
|
90
100
|
|
|
91
101
|
DESCRIPTION
|
|
@@ -122,21 +132,31 @@ USAGE
|
|
|
122
132
|
[--branch <value>] [--import-webhook-status disable|current]
|
|
123
133
|
|
|
124
134
|
FLAGS
|
|
125
|
-
-B, --branch=<value>
|
|
126
|
-
|
|
127
|
-
-
|
|
128
|
-
-
|
|
129
|
-
-
|
|
135
|
+
-B, --branch=<value> The name of the branch where you want to import your content. If you don't mention
|
|
136
|
+
the branch name, then by default the content will be imported to the main branch.
|
|
137
|
+
-a, --alias=<value> The management token of the destination stack where you will import the content.
|
|
138
|
+
-b, --backup-dir=<value> [optional] Backup directory name when using specific module.
|
|
139
|
+
-c, --config=<value> [optional] Path of config file.
|
|
140
|
+
-d, --data-dir=<value> The path or the location in your file system where the content, you intend to
|
|
141
|
+
import, is stored. For example, -d "C:\Users\Name\Desktop\cli\content". If the
|
|
142
|
+
export folder has branches involved, then the path should point till the
|
|
143
|
+
particular branch. For example, “-d
|
|
144
|
+
"C:\Users\Name\Desktop\cli\content\branch_name"
|
|
130
145
|
-k, --stack-api-key=<value> API key of the target stack
|
|
131
|
-
-m, --module=<value> [optional]
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
146
|
+
-m, --module=<value> [optional] Specify the module to import into the target stack. If not specified,
|
|
147
|
+
the import command will import all the modules into the stack. The available
|
|
148
|
+
modules are assets, content-types, entries, environments, extensions,
|
|
149
|
+
marketplace-apps, global-fields, labels, locales, webhooks, workflows,
|
|
150
|
+
custom-roles, and taxonomies.
|
|
151
|
+
-y, --yes [optional] Force override all Marketplace prompts.
|
|
152
|
+
--exclude-global-modules Excludes the branch-independent module from the import operation.
|
|
153
|
+
--import-webhook-status=<option> [default: disable] [optional] This webhook state keeps the same state of webhooks
|
|
154
|
+
as the source stack.
|
|
135
155
|
<options: disable|current>
|
|
136
156
|
--personalize-project-name=<value> Personalize project name.
|
|
137
157
|
--replace-existing Replaces the existing module in the target stack.
|
|
138
158
|
--skip-app-recreation [optional] Skip private apps recreation if already exist
|
|
139
|
-
--skip-audit Skips the audit fix.
|
|
159
|
+
--skip-audit Skips the audit fix that occurs during an import operation.
|
|
140
160
|
--skip-existing Skips the module exists warning messages.
|
|
141
161
|
|
|
142
162
|
DESCRIPTION
|
|
@@ -55,11 +55,11 @@ ImportCommand.examples = [
|
|
|
55
55
|
ImportCommand.flags = {
|
|
56
56
|
config: cli_utilities_1.flags.string({
|
|
57
57
|
char: 'c',
|
|
58
|
-
description: '[optional]
|
|
58
|
+
description: '[optional] Path of config file.',
|
|
59
59
|
}),
|
|
60
60
|
'stack-uid': cli_utilities_1.flags.string({
|
|
61
61
|
char: 's',
|
|
62
|
-
description: 'API key of the target stack',
|
|
62
|
+
description: 'API key of the target stack.',
|
|
63
63
|
hidden: true,
|
|
64
64
|
parse: (0, cli_utilities_1.printFlagDeprecation)(['-s', '--stack-uid'], ['-k', '--stack-api-key']),
|
|
65
65
|
}),
|
|
@@ -74,11 +74,11 @@ ImportCommand.flags = {
|
|
|
74
74
|
}),
|
|
75
75
|
'data-dir': cli_utilities_1.flags.string({
|
|
76
76
|
char: 'd',
|
|
77
|
-
description:
|
|
77
|
+
description: `The path or the location in your file system where the content, you intend to import, is stored. For example, -d "C:\\Users\\Name\\Desktop\\cli\\content". If the export folder has branches involved, then the path should point till the particular branch. For example, “-d "C:\\Users\\Name\\Desktop\\cli\\content\\branch_name"`,
|
|
78
78
|
}),
|
|
79
79
|
alias: cli_utilities_1.flags.string({
|
|
80
80
|
char: 'a',
|
|
81
|
-
description: '
|
|
81
|
+
description: 'The management token of the destination stack where you will import the content.',
|
|
82
82
|
}),
|
|
83
83
|
'management-token-alias': cli_utilities_1.flags.string({
|
|
84
84
|
description: 'alias of the management token',
|
|
@@ -94,21 +94,21 @@ ImportCommand.flags = {
|
|
|
94
94
|
module: cli_utilities_1.flags.string({
|
|
95
95
|
required: false,
|
|
96
96
|
char: 'm',
|
|
97
|
-
description: '[optional]
|
|
97
|
+
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.',
|
|
98
98
|
parse: (0, cli_utilities_1.printFlagDeprecation)(['-m'], ['--module']),
|
|
99
99
|
}),
|
|
100
100
|
'backup-dir': cli_utilities_1.flags.string({
|
|
101
101
|
char: 'b',
|
|
102
|
-
description: '[optional]
|
|
102
|
+
description: '[optional] Backup directory name when using specific module.',
|
|
103
103
|
parse: (0, cli_utilities_1.printFlagDeprecation)(['-b'], ['--backup-dir']),
|
|
104
104
|
}),
|
|
105
105
|
branch: cli_utilities_1.flags.string({
|
|
106
106
|
char: 'B',
|
|
107
|
-
description: '
|
|
107
|
+
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.',
|
|
108
108
|
parse: (0, cli_utilities_1.printFlagDeprecation)(['-B'], ['--branch']),
|
|
109
109
|
}),
|
|
110
110
|
'import-webhook-status': cli_utilities_1.flags.string({
|
|
111
|
-
description: '[optional]
|
|
111
|
+
description: '[optional] This webhook state keeps the same state of webhooks as the source stack.',
|
|
112
112
|
options: ['disable', 'current'],
|
|
113
113
|
required: false,
|
|
114
114
|
default: 'disable',
|
|
@@ -116,7 +116,7 @@ ImportCommand.flags = {
|
|
|
116
116
|
yes: cli_utilities_1.flags.boolean({
|
|
117
117
|
char: 'y',
|
|
118
118
|
required: false,
|
|
119
|
-
description: '[optional]
|
|
119
|
+
description: '[optional] Force override all Marketplace prompts.',
|
|
120
120
|
}),
|
|
121
121
|
'skip-app-recreation': cli_utilities_1.flags.boolean({
|
|
122
122
|
description: '[optional] Skip private apps recreation if already exist',
|
|
@@ -135,10 +135,10 @@ ImportCommand.flags = {
|
|
|
135
135
|
description: 'Personalize project name.',
|
|
136
136
|
}),
|
|
137
137
|
'skip-audit': cli_utilities_1.flags.boolean({
|
|
138
|
-
description: 'Skips the audit fix.',
|
|
138
|
+
description: 'Skips the audit fix that occurs during an import operation.',
|
|
139
139
|
}),
|
|
140
140
|
'exclude-global-modules': cli_utilities_1.flags.boolean({
|
|
141
|
-
description: 'Excludes the branch-independent module from the import operation',
|
|
141
|
+
description: 'Excludes the branch-independent module from the import operation.',
|
|
142
142
|
default: false,
|
|
143
143
|
}),
|
|
144
144
|
};
|
|
@@ -217,14 +217,21 @@ class ImportAssets extends base_class_1.default {
|
|
|
217
217
|
const serializeData = (apiOptions) => {
|
|
218
218
|
const { apiData: asset } = apiOptions;
|
|
219
219
|
const publishDetails = (0, filter_1.default)(asset.publish_details, ({ environment }) => {
|
|
220
|
-
|
|
220
|
+
var _a;
|
|
221
|
+
return (_a = this.environments) === null || _a === void 0 ? void 0 : _a.hasOwnProperty(environment);
|
|
221
222
|
});
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
223
|
+
if (publishDetails.length) {
|
|
224
|
+
const environments = (0, uniq_1.default)((0, map_1.default)(publishDetails, ({ environment }) => this.environments[environment].name));
|
|
225
|
+
const locales = (0, uniq_1.default)((0, map_1.default)(publishDetails, 'locale'));
|
|
226
|
+
if (environments.length === 0 || locales.length === 0) {
|
|
227
|
+
apiOptions.entity = undefined;
|
|
228
|
+
return apiOptions;
|
|
229
|
+
}
|
|
230
|
+
asset.locales = locales;
|
|
231
|
+
asset.environments = environments;
|
|
232
|
+
apiOptions.apiData.publishDetails = { locales, environments };
|
|
233
|
+
}
|
|
226
234
|
apiOptions.uid = this.assetsUidMap[asset.uid];
|
|
227
|
-
apiOptions.apiData.publishDetails = { locales, environments };
|
|
228
235
|
if (!apiOptions.uid)
|
|
229
236
|
apiOptions.entity = undefined;
|
|
230
237
|
return apiOptions;
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.19.
|
|
2
|
+
"version": "1.19.3",
|
|
3
3
|
"commands": {
|
|
4
4
|
"cm:stacks:import": {
|
|
5
5
|
"id": "cm:stacks:import",
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
"name": "config",
|
|
29
29
|
"type": "option",
|
|
30
30
|
"char": "c",
|
|
31
|
-
"description": "[optional]
|
|
31
|
+
"description": "[optional] Path of config file.",
|
|
32
32
|
"multiple": false
|
|
33
33
|
},
|
|
34
34
|
"stack-uid": {
|
|
35
35
|
"name": "stack-uid",
|
|
36
36
|
"type": "option",
|
|
37
37
|
"char": "s",
|
|
38
|
-
"description": "API key of the target stack",
|
|
38
|
+
"description": "API key of the target stack.",
|
|
39
39
|
"hidden": true,
|
|
40
40
|
"multiple": false
|
|
41
41
|
},
|
|
@@ -57,14 +57,14 @@
|
|
|
57
57
|
"name": "data-dir",
|
|
58
58
|
"type": "option",
|
|
59
59
|
"char": "d",
|
|
60
|
-
"description": "path
|
|
60
|
+
"description": "The path or the location in your file system where the content, you intend to import, is stored. For example, -d \"C:\\Users\\Name\\Desktop\\cli\\content\". If the export folder has branches involved, then the path should point till the particular branch. For example, “-d \"C:\\Users\\Name\\Desktop\\cli\\content\\branch_name\"",
|
|
61
61
|
"multiple": false
|
|
62
62
|
},
|
|
63
63
|
"alias": {
|
|
64
64
|
"name": "alias",
|
|
65
65
|
"type": "option",
|
|
66
66
|
"char": "a",
|
|
67
|
-
"description": "
|
|
67
|
+
"description": "The management token of the destination stack where you will import the content.",
|
|
68
68
|
"multiple": false
|
|
69
69
|
},
|
|
70
70
|
"management-token-alias": {
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"name": "module",
|
|
87
87
|
"type": "option",
|
|
88
88
|
"char": "m",
|
|
89
|
-
"description": "[optional]
|
|
89
|
+
"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.",
|
|
90
90
|
"required": false,
|
|
91
91
|
"multiple": false
|
|
92
92
|
},
|
|
@@ -94,20 +94,20 @@
|
|
|
94
94
|
"name": "backup-dir",
|
|
95
95
|
"type": "option",
|
|
96
96
|
"char": "b",
|
|
97
|
-
"description": "[optional]
|
|
97
|
+
"description": "[optional] Backup directory name when using specific module.",
|
|
98
98
|
"multiple": false
|
|
99
99
|
},
|
|
100
100
|
"branch": {
|
|
101
101
|
"name": "branch",
|
|
102
102
|
"type": "option",
|
|
103
103
|
"char": "B",
|
|
104
|
-
"description": "
|
|
104
|
+
"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.",
|
|
105
105
|
"multiple": false
|
|
106
106
|
},
|
|
107
107
|
"import-webhook-status": {
|
|
108
108
|
"name": "import-webhook-status",
|
|
109
109
|
"type": "option",
|
|
110
|
-
"description": "[optional]
|
|
110
|
+
"description": "[optional] This webhook state keeps the same state of webhooks as the source stack.",
|
|
111
111
|
"required": false,
|
|
112
112
|
"multiple": false,
|
|
113
113
|
"options": [
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"name": "yes",
|
|
121
121
|
"type": "boolean",
|
|
122
122
|
"char": "y",
|
|
123
|
-
"description": "[optional]
|
|
123
|
+
"description": "[optional] Force override all Marketplace prompts.",
|
|
124
124
|
"required": false,
|
|
125
125
|
"allowNo": false
|
|
126
126
|
},
|
|
@@ -154,13 +154,13 @@
|
|
|
154
154
|
"skip-audit": {
|
|
155
155
|
"name": "skip-audit",
|
|
156
156
|
"type": "boolean",
|
|
157
|
-
"description": "Skips the audit fix.",
|
|
157
|
+
"description": "Skips the audit fix that occurs during an import operation.",
|
|
158
158
|
"allowNo": false
|
|
159
159
|
},
|
|
160
160
|
"exclude-global-modules": {
|
|
161
161
|
"name": "exclude-global-modules",
|
|
162
162
|
"type": "boolean",
|
|
163
|
-
"description": "Excludes the branch-independent module from the import operation",
|
|
163
|
+
"description": "Excludes the branch-independent module from the import operation.",
|
|
164
164
|
"allowNo": false
|
|
165
165
|
}
|
|
166
166
|
},
|
package/package.json
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-cm-import",
|
|
3
3
|
"description": "Contentstack CLI plugin to import content into stack",
|
|
4
|
-
"version": "1.19.
|
|
4
|
+
"version": "1.19.3",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@contentstack/cli-audit": "~1.7.
|
|
8
|
+
"@contentstack/cli-audit": "~1.7.3",
|
|
9
9
|
"@contentstack/cli-command": "~1.3.2",
|
|
10
10
|
"@contentstack/cli-utilities": "~1.8.0",
|
|
11
|
-
"@contentstack/management": "~1.
|
|
12
|
-
"@contentstack/cli-variants": "~1.1.
|
|
13
|
-
"@oclif/core": "^3.
|
|
11
|
+
"@contentstack/management": "~1.18.3",
|
|
12
|
+
"@contentstack/cli-variants": "~1.1.3",
|
|
13
|
+
"@oclif/core": "^3.27.0",
|
|
14
14
|
"big-json": "^3.2.0",
|
|
15
15
|
"bluebird": "^3.7.2",
|
|
16
16
|
"chalk": "^4.1.2",
|
|
17
|
-
"debug": "^4.
|
|
18
|
-
"fs-extra": "^11.
|
|
19
|
-
"lodash": "^4.17.
|
|
20
|
-
"marked": "^4.0
|
|
17
|
+
"debug": "^4.3.7",
|
|
18
|
+
"fs-extra": "^11.2.0",
|
|
19
|
+
"lodash": "^4.17.21",
|
|
20
|
+
"marked": "^4.3.0",
|
|
21
21
|
"merge": "^2.1.1",
|
|
22
22
|
"mkdirp": "^1.0.4",
|
|
23
23
|
"promise-limit": "^2.7.0",
|
|
24
|
-
"tslib": "^2.
|
|
24
|
+
"tslib": "^2.8.1",
|
|
25
25
|
"uuid": "^9.0.1",
|
|
26
|
-
"winston": "^3.
|
|
26
|
+
"winston": "^3.17.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@oclif/test": "^
|
|
30
|
-
"@types/big-json": "^3.2.
|
|
31
|
-
"@types/bluebird": "^3.5.
|
|
32
|
-
"@types/chai": "^4.
|
|
33
|
-
"@types/fs-extra": "^11.0.
|
|
29
|
+
"@oclif/test": "^4.1.0",
|
|
30
|
+
"@types/big-json": "^3.2.5",
|
|
31
|
+
"@types/bluebird": "^3.5.42",
|
|
32
|
+
"@types/chai": "^4.3.20",
|
|
33
|
+
"@types/fs-extra": "^11.0.4",
|
|
34
34
|
"@types/mkdirp": "^1.0.2",
|
|
35
|
-
"@types/mocha": "^8.2.
|
|
36
|
-
"@types/node": "^14.
|
|
37
|
-
"@types/sinon": "^10.0.
|
|
38
|
-
"@types/tar": "^6.1.
|
|
39
|
-
"@types/uuid": "^9.0.
|
|
40
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
41
|
-
"chai": "^4.
|
|
42
|
-
"eslint": "^8.
|
|
35
|
+
"@types/mocha": "^8.2.3",
|
|
36
|
+
"@types/node": "^14.18.63",
|
|
37
|
+
"@types/sinon": "^10.0.20",
|
|
38
|
+
"@types/tar": "^6.1.13",
|
|
39
|
+
"@types/uuid": "^9.0.8",
|
|
40
|
+
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
41
|
+
"chai": "^4.5.0",
|
|
42
|
+
"eslint": "^8.57.1",
|
|
43
43
|
"eslint-config-oclif": "^4.0.0",
|
|
44
44
|
"globby": "^10.0.2",
|
|
45
|
-
"mocha": "^10.
|
|
45
|
+
"mocha": "^10.8.2",
|
|
46
46
|
"nyc": "^15.1.0",
|
|
47
|
-
"oclif": "^3.
|
|
47
|
+
"oclif": "^3.17.2",
|
|
48
48
|
"rimraf": "^2.7.1",
|
|
49
|
-
"sinon": "^19.0.
|
|
50
|
-
"tmp": "^0.2.
|
|
51
|
-
"ts-node": "^10.9.
|
|
52
|
-
"typescript": "^4.9.
|
|
49
|
+
"sinon": "^19.0.2",
|
|
50
|
+
"tmp": "^0.2.3",
|
|
51
|
+
"ts-node": "^10.9.2",
|
|
52
|
+
"typescript": "^4.9.5"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"build": "npm run clean && npm run compile",
|