@contentstack/cli-cm-import-setup 1.4.2 → 1.5.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 +1 -1
- package/lib/utils/backup-handler.js +6 -5
- 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-setup
|
|
|
47
47
|
$ csdx COMMAND
|
|
48
48
|
running command...
|
|
49
49
|
$ csdx (--version)
|
|
50
|
-
@contentstack/cli-cm-import-setup/1.
|
|
50
|
+
@contentstack/cli-cm-import-setup/1.5.0 linux-x64 node-v22.19.0
|
|
51
51
|
$ csdx --help [COMMAND]
|
|
52
52
|
USAGE
|
|
53
53
|
$ csdx COMMAND
|
|
@@ -9,10 +9,11 @@ async function backupHandler(importConfig) {
|
|
|
9
9
|
if (importConfig.hasOwnProperty('useBackedupDir')) {
|
|
10
10
|
return importConfig.useBackedupDir;
|
|
11
11
|
}
|
|
12
|
+
const sourceDir = importConfig.branchDir || importConfig.contentDir;
|
|
12
13
|
let backupDirPath;
|
|
13
|
-
const subDir = isSubDirectory(importConfig);
|
|
14
|
+
const subDir = isSubDirectory(importConfig, sourceDir);
|
|
14
15
|
if (subDir) {
|
|
15
|
-
backupDirPath = path.resolve((0, cli_utilities_1.sanitizePath)(
|
|
16
|
+
backupDirPath = path.resolve((0, cli_utilities_1.sanitizePath)(sourceDir), '..', '_backup_' + Math.floor(Math.random() * 1000));
|
|
16
17
|
if (importConfig.createBackupDir) {
|
|
17
18
|
cli_utilities_1.cliux.print(`Warning!!! Provided backup directory path is a sub directory of the content directory, Cannot copy to a sub directory. Hence new backup directory created - ${backupDirPath}`, {
|
|
18
19
|
color: 'yellow',
|
|
@@ -33,7 +34,7 @@ async function backupHandler(importConfig) {
|
|
|
33
34
|
if (backupDirPath) {
|
|
34
35
|
cli_utilities_1.cliux.print('Copying content to the backup directory...');
|
|
35
36
|
return new Promise((resolve, reject) => {
|
|
36
|
-
return (0, fs_extra_1.copy)(
|
|
37
|
+
return (0, fs_extra_1.copy)(sourceDir, backupDirPath, (error) => {
|
|
37
38
|
if (error) {
|
|
38
39
|
(0, index_1.trace)(error, 'error', true);
|
|
39
40
|
return reject(error);
|
|
@@ -49,8 +50,8 @@ exports.default = backupHandler;
|
|
|
49
50
|
* @param importConfig
|
|
50
51
|
* @returns
|
|
51
52
|
*/
|
|
52
|
-
function isSubDirectory(importConfig) {
|
|
53
|
-
const parent =
|
|
53
|
+
function isSubDirectory(importConfig, sourceDir) {
|
|
54
|
+
const parent = sourceDir;
|
|
54
55
|
const child = importConfig.createBackupDir ? importConfig.createBackupDir : process.cwd();
|
|
55
56
|
const relative = path.relative(parent, child);
|
|
56
57
|
if (relative) {
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-cm-import-setup",
|
|
3
3
|
"description": "Contentstack CLI plugin to setup the mappers and configurations for the import command",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.5.0",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@contentstack/cli-command": "~1.6.1",
|
|
9
|
-
"@contentstack/cli-utilities": "~1.14.
|
|
9
|
+
"@contentstack/cli-utilities": "~1.14.1",
|
|
10
10
|
"@oclif/core": "^4.3.0",
|
|
11
11
|
"big-json": "^3.2.0",
|
|
12
12
|
"chalk": "^4.1.2",
|