@contentstack/cli-cm-import 1.15.1 → 1.15.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 +1 -1
- package/lib/commands/cm/stacks/import.js +5 -3
- package/lib/import/module-importer.js +1 -1
- package/lib/import/modules/assets.js +1 -1
- package/lib/types/import-config.d.ts +1 -0
- package/lib/utils/log.js +1 -1
- package/lib/utils/logger.js +4 -4
- package/lib/utils/marketplace-app-helper.js +3 -0
- package/oclif.manifest.json +1 -1
- package/package.json +2 -2
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.15.
|
|
50
|
+
@contentstack/cli-cm-import/1.15.3 linux-x64 node-v18.20.2
|
|
51
51
|
$ csdx --help [COMMAND]
|
|
52
52
|
USAGE
|
|
53
53
|
$ csdx COMMAND
|
|
@@ -17,7 +17,7 @@ class ImportCommand extends cli_command_1.Command {
|
|
|
17
17
|
let importConfig = await (0, utils_1.setupImportConfig)(flags);
|
|
18
18
|
// Note setting host to create cma client
|
|
19
19
|
importConfig.host = this.cmaHost;
|
|
20
|
-
backupDir = importConfig.backupDir;
|
|
20
|
+
backupDir = importConfig.cliLogsPath || importConfig.backupDir;
|
|
21
21
|
const managementAPIClient = await (0, cli_utilities_1.managementSDKClient)(importConfig);
|
|
22
22
|
const moduleImporter = new import_1.ModuleImporter(managementAPIClient, importConfig);
|
|
23
23
|
const result = await moduleImporter.start();
|
|
@@ -26,11 +26,13 @@ class ImportCommand extends cli_command_1.Command {
|
|
|
26
26
|
? `Successfully imported the content to the stack named ${importConfig.stackName} with the API key ${importConfig.apiKey} .`
|
|
27
27
|
: `The content has been imported to the stack ${importConfig.apiKey} successfully!`, 'success');
|
|
28
28
|
}
|
|
29
|
-
(0, utils_1.log)(importConfig, `The log has been stored at '${(0, cli_utilities_1.pathValidator)(node_path_1.default.join(importConfig.backupDir, 'logs', 'import'))}'`, 'success');
|
|
29
|
+
(0, utils_1.log)(importConfig, `The log has been stored at '${(0, cli_utilities_1.pathValidator)(node_path_1.default.join(importConfig.cliLogsPath || importConfig.backupDir, 'logs', 'import'))}'`, 'success');
|
|
30
30
|
}
|
|
31
31
|
catch (error) {
|
|
32
32
|
(0, utils_1.log)({ data: backupDir !== null && backupDir !== void 0 ? backupDir : (0, cli_utilities_1.pathValidator)(node_path_1.default.join(backupDir || __dirname, 'logs', 'import')) }, `Failed to import stack content - ${(0, utils_1.formatError)(error)}`, 'error');
|
|
33
|
-
(0, utils_1.log)({ data: backupDir }, `The log has been stored at ${{ data: backupDir }
|
|
33
|
+
(0, utils_1.log)({ data: backupDir }, `The log has been stored at ${{ data: backupDir }
|
|
34
|
+
? (0, cli_utilities_1.pathValidator)(node_path_1.default.join(backupDir || __dirname, 'logs', 'import'))
|
|
35
|
+
: (0, cli_utilities_1.pathValidator)(node_path_1.default.join(__dirname, 'logs'))}`, 'info');
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
38
|
}
|
|
@@ -96,7 +96,7 @@ class ModuleImporter {
|
|
|
96
96
|
* fix available and the user confirms to proceed with the fix, otherwise it returns `false`.
|
|
97
97
|
*/
|
|
98
98
|
async auditImportData(logger) {
|
|
99
|
-
const basePath = (0, path_1.resolve)(this.importConfig.backupDir, 'logs', 'audit');
|
|
99
|
+
const basePath = (0, path_1.resolve)(this.importConfig.cliLogsPath || this.importConfig.backupDir, 'logs', 'audit');
|
|
100
100
|
const auditConfig = this.importConfig.auditConfig;
|
|
101
101
|
auditConfig.config.basePath = basePath;
|
|
102
102
|
auditConfig.config.branch = this.importConfig.branchName;
|
|
@@ -220,7 +220,7 @@ class ImportAssets extends base_class_1.default {
|
|
|
220
220
|
return this.environments.hasOwnProperty(environment);
|
|
221
221
|
});
|
|
222
222
|
const environments = (0, uniq_1.default)((0, map_1.default)(publishDetails, ({ environment }) => this.environments[environment].name));
|
|
223
|
-
const locales = (0, map_1.default)(publishDetails, 'locale');
|
|
223
|
+
const locales = (0, uniq_1.default)((0, map_1.default)(publishDetails, 'locale'));
|
|
224
224
|
asset.locales = locales;
|
|
225
225
|
asset.environments = environments;
|
|
226
226
|
apiOptions.uid = this.assetsUidMap[asset.uid];
|
package/lib/utils/log.js
CHANGED
|
@@ -22,7 +22,7 @@ exports.log = log;
|
|
|
22
22
|
function initLogger(config) {
|
|
23
23
|
var _a;
|
|
24
24
|
if (!logger) {
|
|
25
|
-
const basePath = (0, cli_utilities_1.pathValidator)((0, path_1.join)((_a = config === null || config === void 0 ? void 0 : config.
|
|
25
|
+
const basePath = (0, cli_utilities_1.pathValidator)((0, path_1.join)((_a = config === null || config === void 0 ? void 0 : config.cliLogsPath) !== null && _a !== void 0 ? _a : process.cwd(), 'logs', 'import'));
|
|
26
26
|
exports.logger = logger = new cli_utilities_1.Logger(Object.assign(config !== null && config !== void 0 ? config : {}, { basePath }));
|
|
27
27
|
}
|
|
28
28
|
return logger;
|
package/lib/utils/logger.js
CHANGED
|
@@ -121,17 +121,17 @@ function init(_logPath) {
|
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
123
|
const log = async (config, message, type) => {
|
|
124
|
-
config.
|
|
124
|
+
config.cliLogsPath = config.cliLogsPath || config.data || path.join(__dirname, 'logs');
|
|
125
125
|
// ignoring the type argument, as we are not using it to create a logfile anymore
|
|
126
126
|
if (type !== 'error') {
|
|
127
127
|
// removed type argument from init method
|
|
128
128
|
if (type === 'warn')
|
|
129
|
-
init(config.
|
|
129
|
+
init(config.cliLogsPath).warn(message); //logged warning message in log file
|
|
130
130
|
else
|
|
131
|
-
init(config.
|
|
131
|
+
init(config.cliLogsPath).log(message);
|
|
132
132
|
}
|
|
133
133
|
else {
|
|
134
|
-
init(config.
|
|
134
|
+
init(config.cliLogsPath).error(message);
|
|
135
135
|
}
|
|
136
136
|
};
|
|
137
137
|
exports.log = log;
|
|
@@ -72,6 +72,9 @@ const getConfirmationToCreateApps = async (privateApps, config) => {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
+
else {
|
|
76
|
+
return Promise.resolve(true);
|
|
77
|
+
}
|
|
75
78
|
};
|
|
76
79
|
exports.getConfirmationToCreateApps = getConfirmationToCreateApps;
|
|
77
80
|
const handleNameConflict = async (app, appSuffix, config) => {
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-cm-import",
|
|
3
3
|
"description": "Contentstack CLI plugin to import content into stack",
|
|
4
|
-
"version": "1.15.
|
|
4
|
+
"version": "1.15.3",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@contentstack/cli-audit": "~1.5.
|
|
8
|
+
"@contentstack/cli-audit": "~1.5.4",
|
|
9
9
|
"@contentstack/cli-command": "~1.2.16",
|
|
10
10
|
"@contentstack/cli-utilities": "~1.6.0",
|
|
11
11
|
"@contentstack/management": "~1.15.3",
|