@contentstack/cli-cm-import 1.19.5 → 1.20.0
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 +5 -1
- package/lib/commands/cm/stacks/import.js +8 -0
- package/lib/config/index.js +3 -2
- package/lib/import/modules/assets.d.ts +0 -1
- package/lib/import/modules/assets.js +1 -1
- package/lib/import/modules/entries.js +1 -1
- package/lib/types/default-config.d.ts +2 -2
- package/lib/types/import-config.d.ts +2 -0
- package/lib/utils/asset-helper.js +1 -1
- package/lib/utils/import-config-handler.js +6 -0
- package/oclif.manifest.json +13 -1
- package/package.json +3 -3
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.
|
|
50
|
+
@contentstack/cli-cm-import/1.20.0 linux-x64 node-v22.14.0
|
|
51
51
|
$ csdx --help [COMMAND]
|
|
52
52
|
USAGE
|
|
53
53
|
$ csdx COMMAND
|
|
@@ -96,7 +96,9 @@ FLAGS
|
|
|
96
96
|
--personalize-project-name=<value> (optional) Provide a unique name for the Personalize project.
|
|
97
97
|
--replace-existing Replaces the existing module in the target stack.
|
|
98
98
|
--skip-app-recreation (optional) Skips the recreation of private apps if they already exist.
|
|
99
|
+
--skip-assets-publish Skips asset publishing during the import process.
|
|
99
100
|
--skip-audit Skips the audit fix that occurs during an import operation.
|
|
101
|
+
--skip-entries-publish Skips entry publishing during the import process
|
|
100
102
|
--skip-existing Skips the module exists warning messages.
|
|
101
103
|
|
|
102
104
|
DESCRIPTION
|
|
@@ -158,7 +160,9 @@ FLAGS
|
|
|
158
160
|
--personalize-project-name=<value> (optional) Provide a unique name for the Personalize project.
|
|
159
161
|
--replace-existing Replaces the existing module in the target stack.
|
|
160
162
|
--skip-app-recreation (optional) Skips the recreation of private apps if they already exist.
|
|
163
|
+
--skip-assets-publish Skips asset publishing during the import process.
|
|
161
164
|
--skip-audit Skips the audit fix that occurs during an import operation.
|
|
165
|
+
--skip-entries-publish Skips entry publishing during the import process
|
|
162
166
|
--skip-existing Skips the module exists warning messages.
|
|
163
167
|
|
|
164
168
|
DESCRIPTION
|
|
@@ -141,6 +141,14 @@ ImportCommand.flags = {
|
|
|
141
141
|
description: 'Excludes the branch-independent module from the import operation.',
|
|
142
142
|
default: false,
|
|
143
143
|
}),
|
|
144
|
+
'skip-assets-publish': cli_utilities_1.flags.boolean({
|
|
145
|
+
description: 'Skips asset publishing during the import process.',
|
|
146
|
+
default: false,
|
|
147
|
+
}),
|
|
148
|
+
'skip-entries-publish': cli_utilities_1.flags.boolean({
|
|
149
|
+
description: 'Skips entry publishing during the import process',
|
|
150
|
+
default: false,
|
|
151
|
+
}),
|
|
144
152
|
};
|
|
145
153
|
ImportCommand.aliases = ['cm:import'];
|
|
146
154
|
ImportCommand.usage = 'cm:stacks:import [-c <value>] [-k <value>] [-d <value>] [-a <value>] [--module <value>] [--backup-dir <value>] [--branch <value>] [--import-webhook-status disable|current]';
|
package/lib/config/index.js
CHANGED
|
@@ -10,6 +10,8 @@ const config = {
|
|
|
10
10
|
// host:'https://azure-eu-api.contentstack.com/v3',
|
|
11
11
|
// use below hosts for gcp-na region
|
|
12
12
|
// host:'https://gcp-na-api.contentstack.com',
|
|
13
|
+
// use below hosts for gcp-eu region
|
|
14
|
+
// host:'https://gcp-eu-api.contentstack.com',
|
|
13
15
|
// pass locale, only to migrate entries from that locale
|
|
14
16
|
// not passing `locale` will migrate all the locales present
|
|
15
17
|
// locales: ['fr-fr'],
|
|
@@ -21,6 +23,7 @@ const config = {
|
|
|
21
23
|
'https://azure-na-api.contentstack.com': 'https://azure-na-developerhub-api.contentstack.com',
|
|
22
24
|
'https://azure-eu-api.contentstack.com': 'https://azure-eu-developerhub-api.contentstack.com',
|
|
23
25
|
'https://gcp-na-api.contentstack.com': 'https://gcp-na-developerhub-api.contentstack.com',
|
|
26
|
+
'https://gcp-eu-api.contentstack.com': 'https://gcp-eu-developerhub-api.contentstack.com',
|
|
24
27
|
},
|
|
25
28
|
modules: {
|
|
26
29
|
apiConcurrency: 5,
|
|
@@ -86,7 +89,6 @@ const config = {
|
|
|
86
89
|
assets: {
|
|
87
90
|
dirName: 'assets',
|
|
88
91
|
assetBatchLimit: 1,
|
|
89
|
-
publishAssets: true,
|
|
90
92
|
fileName: 'assets.json',
|
|
91
93
|
importSameStructure: true,
|
|
92
94
|
uploadAssetsConcurrency: 2,
|
|
@@ -418,7 +420,6 @@ const config = {
|
|
|
418
420
|
overwriteSupportedModules: ['extensions', 'global-fields', 'content-types'],
|
|
419
421
|
rateLimit: 5,
|
|
420
422
|
preserveStackVersion: false,
|
|
421
|
-
entriesPublish: true,
|
|
422
423
|
concurrency: 1,
|
|
423
424
|
importConcurrency: 5,
|
|
424
425
|
fetchConcurrency: 5,
|
|
@@ -50,7 +50,7 @@ class ImportAssets extends base_class_1.default {
|
|
|
50
50
|
// NOTE Step 3: Import Assets and create it mapping files (uid, url)
|
|
51
51
|
await this.importAssets();
|
|
52
52
|
// NOTE Step 4: Publish assets
|
|
53
|
-
if (this.
|
|
53
|
+
if (!this.importConfig.skipAssetsPublish)
|
|
54
54
|
await this.publish();
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
@@ -99,7 +99,7 @@ class EntriesImport extends base_class_1.default {
|
|
|
99
99
|
});
|
|
100
100
|
(0, utils_1.log)(this.importConfig, 'Entries imported successfully', 'success');
|
|
101
101
|
// Publishing entries
|
|
102
|
-
if (this.importConfig.
|
|
102
|
+
if (!this.importConfig.skipEntriesPublish) {
|
|
103
103
|
(0, utils_1.log)(this.importConfig, 'Publishing entries', 'info');
|
|
104
104
|
this.envs = utils_1.fileHelper.readFileSync(this.envPath);
|
|
105
105
|
for (let entryRequestOption of entryRequestOptions) {
|
|
@@ -50,7 +50,6 @@ export default interface DefaultConfig {
|
|
|
50
50
|
assets: {
|
|
51
51
|
dirName: string;
|
|
52
52
|
assetBatchLimit: number;
|
|
53
|
-
publishAssets: boolean;
|
|
54
53
|
fileName: string;
|
|
55
54
|
importSameStructure: boolean;
|
|
56
55
|
uploadAssetsConcurrency: number;
|
|
@@ -175,7 +174,6 @@ export default interface DefaultConfig {
|
|
|
175
174
|
};
|
|
176
175
|
rateLimit: number;
|
|
177
176
|
preserveStackVersion: boolean;
|
|
178
|
-
entriesPublish: boolean;
|
|
179
177
|
concurrency: number;
|
|
180
178
|
importConcurrency: number;
|
|
181
179
|
fetchConcurrency: number;
|
|
@@ -197,4 +195,6 @@ export default interface DefaultConfig {
|
|
|
197
195
|
} & Record<string, any>;
|
|
198
196
|
};
|
|
199
197
|
globalModules: string[];
|
|
198
|
+
skipAssetsPublish?: boolean;
|
|
199
|
+
skipEntriesPublish?: boolean;
|
|
200
200
|
}
|
|
@@ -9,6 +9,8 @@ export interface ExternalConfig {
|
|
|
9
9
|
password?: string;
|
|
10
10
|
}
|
|
11
11
|
export default interface ImportConfig extends DefaultConfig, ExternalConfig {
|
|
12
|
+
skipAssetsPublish?: boolean;
|
|
13
|
+
skipEntriesPublish?: boolean;
|
|
12
14
|
cliLogsPath: string;
|
|
13
15
|
canCreatePrivateApp: boolean;
|
|
14
16
|
contentDir: string;
|
|
@@ -340,7 +340,7 @@ function findFileUrls(schema, _entry, assetUrls) {
|
|
|
340
340
|
else {
|
|
341
341
|
text = JSON.stringify(_entry);
|
|
342
342
|
}
|
|
343
|
-
markdownRegEx = new RegExp('(https://(assets|(eu-|azure-na-|azure-eu-|gcp-na-)?images).contentstack.(io|com)/v3/assets/(.*?)/(.*?)/(.*?)/(.*?)(?="))', 'g');
|
|
343
|
+
markdownRegEx = new RegExp('(https://(assets|(eu-|azure-na-|azure-eu-|gcp-na-|gcp-eu-)?images).contentstack.(io|com)/v3/assets/(.*?)/(.*?)/(.*?)/(.*?)(?="))', 'g');
|
|
344
344
|
while ((markdownMatch = markdownRegEx.exec(text)) !== null) {
|
|
345
345
|
if (markdownMatch && typeof markdownMatch[0] === 'string') {
|
|
346
346
|
let assetUrl = markdownMatch[0].replace(/\\/g, '');
|
|
@@ -85,6 +85,12 @@ const setupConfig = async (importCmdFlags) => {
|
|
|
85
85
|
if (importCmdFlags['backup-dir']) {
|
|
86
86
|
config.useBackedupDir = importCmdFlags['backup-dir'];
|
|
87
87
|
}
|
|
88
|
+
if (importCmdFlags['skip-assets-publish']) {
|
|
89
|
+
config.skipAssetsPublish = importCmdFlags['skip-assets-publish'];
|
|
90
|
+
}
|
|
91
|
+
if (importCmdFlags['skip-entries-publish']) {
|
|
92
|
+
config.skipEntriesPublish = importCmdFlags['skip-entries-publish'];
|
|
93
|
+
}
|
|
88
94
|
// Note to support old modules
|
|
89
95
|
config.target_stack = config.apiKey;
|
|
90
96
|
config.replaceExisting = importCmdFlags['replace-existing'];
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.20.0",
|
|
3
3
|
"commands": {
|
|
4
4
|
"cm:stacks:import": {
|
|
5
5
|
"id": "cm:stacks:import",
|
|
@@ -162,6 +162,18 @@
|
|
|
162
162
|
"type": "boolean",
|
|
163
163
|
"description": "Excludes the branch-independent module from the import operation.",
|
|
164
164
|
"allowNo": false
|
|
165
|
+
},
|
|
166
|
+
"skip-assets-publish": {
|
|
167
|
+
"name": "skip-assets-publish",
|
|
168
|
+
"type": "boolean",
|
|
169
|
+
"description": "Skips asset publishing during the import process.",
|
|
170
|
+
"allowNo": false
|
|
171
|
+
},
|
|
172
|
+
"skip-entries-publish": {
|
|
173
|
+
"name": "skip-entries-publish",
|
|
174
|
+
"type": "boolean",
|
|
175
|
+
"description": "Skips entry publishing during the import process",
|
|
176
|
+
"allowNo": false
|
|
165
177
|
}
|
|
166
178
|
},
|
|
167
179
|
"args": {}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-cm-import",
|
|
3
3
|
"description": "Contentstack CLI plugin to import content into stack",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.20.0",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@contentstack/cli-audit": "~1.
|
|
8
|
+
"@contentstack/cli-audit": "~1.8.0",
|
|
9
9
|
"@contentstack/cli-command": "~1.3.3",
|
|
10
|
-
"@contentstack/cli-utilities": "~1.8.
|
|
10
|
+
"@contentstack/cli-utilities": "~1.8.4",
|
|
11
11
|
"@contentstack/management": "~1.18.4",
|
|
12
12
|
"@contentstack/cli-variants": "~1.1.5",
|
|
13
13
|
"@oclif/core": "^3.27.0",
|