@contentstack/cli-cm-export 0.1.1-beta.7 → 1.0.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/LICENSE +21 -0
- package/README.md +44 -24
- package/oclif.manifest.json +1 -1
- package/package.json +72 -68
- package/src/app.js +120 -66
- package/src/commands/cm/stacks/export.js +177 -0
- package/src/config/default.js +18 -58
- package/src/lib/export/assets.js +325 -223
- package/src/lib/export/content-types.js +76 -66
- package/src/lib/export/entries.js +190 -135
- package/src/lib/export/environments.js +52 -45
- package/src/lib/export/extensions.js +50 -43
- package/src/lib/export/global-fields.js +92 -80
- package/src/lib/export/labels.js +52 -44
- package/src/lib/export/locales.js +74 -41
- package/src/lib/export/stack.js +72 -47
- package/src/lib/export/webhooks.js +58 -48
- package/src/lib/export/workflows.js +55 -44
- package/src/lib/util/contentstack-management-sdk.js +30 -4
- package/src/lib/util/export-flags.js +158 -87
- package/src/lib/util/helper.js +20 -20
- package/src/lib/util/index.js +32 -19
- package/src/lib/util/log.js +109 -53
- package/src/lib/util/login.js +56 -41
- package/src/lib/util/setup-branches.js +53 -0
- package/src/commands/cm/export.js +0 -123
- package/src/lib/util/request.js +0 -83
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Contentstack Export
|
|
3
|
-
* Copyright (c) 2019 Contentstack LLC
|
|
4
|
-
* MIT Licensed
|
|
5
|
-
*/
|
|
2
|
+
* Contentstack Export
|
|
3
|
+
* Copyright (c) 2019 Contentstack LLC
|
|
4
|
+
* MIT Licensed
|
|
5
|
+
*/
|
|
6
6
|
|
|
7
|
-
const mkdirp = require('mkdirp')
|
|
8
|
-
const path = require('path')
|
|
9
|
-
const chalk = require('chalk')
|
|
7
|
+
const mkdirp = require('mkdirp');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const chalk = require('chalk');
|
|
10
10
|
|
|
11
|
-
const helper = require('../util/helper')
|
|
12
|
-
let stack = require('../util/contentstack-management-sdk')
|
|
13
|
-
const {addlogs} = require('../util/log')
|
|
14
|
-
let config
|
|
11
|
+
const helper = require('../util/helper');
|
|
12
|
+
let stack = require('../util/contentstack-management-sdk');
|
|
13
|
+
const { addlogs } = require('../util/log');
|
|
14
|
+
let config;
|
|
15
15
|
|
|
16
16
|
function ExportEnvironments() {
|
|
17
17
|
this.requestOptions = {
|
|
@@ -20,44 +20,51 @@ function ExportEnvironments() {
|
|
|
20
20
|
asc: 'updated_at',
|
|
21
21
|
},
|
|
22
22
|
json: true,
|
|
23
|
-
}
|
|
24
|
-
this.master = {}
|
|
25
|
-
this.environments = {}
|
|
23
|
+
};
|
|
24
|
+
this.master = {};
|
|
25
|
+
this.environments = {};
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
ExportEnvironments.prototype.start = function (mergConfig) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
this.master = {};
|
|
30
|
+
this.environments = {};
|
|
31
|
+
let self = this;
|
|
32
|
+
config = mergConfig;
|
|
33
|
+
addlogs(config, 'Starting environment export', 'success');
|
|
34
|
+
const environmentConfig = config.modules.environments;
|
|
35
|
+
const environmentsFolderPath = path.resolve(config.data, config.branchName || '', environmentConfig.dirName);
|
|
34
36
|
// Create folder for environments
|
|
35
|
-
mkdirp.sync(environmentsFolderPath)
|
|
36
|
-
let client = stack.Client(config)
|
|
37
|
+
mkdirp.sync(environmentsFolderPath);
|
|
38
|
+
let client = stack.Client(config);
|
|
37
39
|
return new Promise(function (resolve, reject) {
|
|
38
|
-
client
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
client
|
|
41
|
+
.stack({ api_key: config.source_stack, management_token: config.management_token })
|
|
42
|
+
.environment()
|
|
43
|
+
.query(self.requestOptions.qs)
|
|
44
|
+
.find()
|
|
45
|
+
.then((environmentResponse) => {
|
|
46
|
+
if (environmentResponse.items.length !== 0) {
|
|
47
|
+
for (let i = 0, total = environmentResponse.count; i < total; i++) {
|
|
48
|
+
let envUid = environmentResponse.items[i].uid;
|
|
49
|
+
self.master[envUid] = '';
|
|
50
|
+
self.environments[envUid] = environmentResponse.items[i];
|
|
51
|
+
delete self.environments[envUid].uid;
|
|
52
|
+
delete self.environments[envUid]['ACL'];
|
|
53
|
+
}
|
|
54
|
+
helper.writeFile(path.join(environmentsFolderPath, environmentConfig.fileName), self.environments);
|
|
55
|
+
addlogs(config, chalk.green('All the environments have been exported successfully'), 'success');
|
|
56
|
+
return resolve();
|
|
47
57
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
})
|
|
60
|
-
})
|
|
61
|
-
}
|
|
58
|
+
if (environmentResponse.items.length === 0) {
|
|
59
|
+
addlogs(config, 'No environments found', 'success');
|
|
60
|
+
return resolve();
|
|
61
|
+
}
|
|
62
|
+
})
|
|
63
|
+
.catch((error) => {
|
|
64
|
+
addlogs(config, error, 'error');
|
|
65
|
+
reject(error);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
};
|
|
62
69
|
|
|
63
|
-
module.exports = new ExportEnvironments()
|
|
70
|
+
module.exports = new ExportEnvironments();
|
|
@@ -1,59 +1,66 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Contentstack Export
|
|
3
|
-
* Copyright (c) 2019 Contentstack LLC
|
|
4
|
-
* MIT Licensed
|
|
5
|
-
*/
|
|
2
|
+
* Contentstack Export
|
|
3
|
+
* Copyright (c) 2019 Contentstack LLC
|
|
4
|
+
* MIT Licensed
|
|
5
|
+
*/
|
|
6
6
|
|
|
7
|
-
const mkdirp = require('mkdirp')
|
|
8
|
-
const path = require('path')
|
|
9
|
-
const chalk = require('chalk')
|
|
7
|
+
const mkdirp = require('mkdirp');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const chalk = require('chalk');
|
|
10
10
|
|
|
11
|
-
const helper = require('../util/helper')
|
|
12
|
-
const {addlogs} = require('../util/log')
|
|
11
|
+
const helper = require('../util/helper');
|
|
12
|
+
const { addlogs } = require('../util/log');
|
|
13
13
|
|
|
14
|
-
let config = require('../../config/default')
|
|
15
|
-
const extensionConfig = config.modules.extensions
|
|
16
|
-
const stack = require('../util/contentstack-management-sdk')
|
|
14
|
+
let config = require('../../config/default');
|
|
15
|
+
const extensionConfig = config.modules.extensions;
|
|
16
|
+
const stack = require('../util/contentstack-management-sdk');
|
|
17
17
|
|
|
18
18
|
function ExportExtensions() {
|
|
19
19
|
this.queryRequestOptions = {
|
|
20
20
|
include_count: true,
|
|
21
21
|
asc: 'updated_at',
|
|
22
|
-
}
|
|
23
|
-
this.master = {}
|
|
24
|
-
this.extensions = {}
|
|
22
|
+
};
|
|
23
|
+
this.master = {};
|
|
24
|
+
this.extensions = {};
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
ExportExtensions.prototype.start = function (mergeConfig) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
config
|
|
31
|
-
let
|
|
28
|
+
this.master = {};
|
|
29
|
+
this.extensions = {};
|
|
30
|
+
addlogs(config, 'Starting extension export', 'success');
|
|
31
|
+
let self = this;
|
|
32
|
+
config = mergeConfig;
|
|
33
|
+
let extensionsFolderPath = path.resolve(config.data, config.branchName || '', extensionConfig.dirName);
|
|
32
34
|
// Create folder for extensions
|
|
33
|
-
mkdirp.sync(extensionsFolderPath)
|
|
34
|
-
let client = stack.Client(config)
|
|
35
|
+
mkdirp.sync(extensionsFolderPath);
|
|
36
|
+
let client = stack.Client(config);
|
|
35
37
|
return new Promise(function (resolve, reject) {
|
|
36
|
-
client
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
client
|
|
39
|
+
.stack({ api_key: config.source_stack, management_token: config.management_token })
|
|
40
|
+
.extension()
|
|
41
|
+
.query(self.queryRequestOptions)
|
|
42
|
+
.find()
|
|
43
|
+
.then((extension) => {
|
|
44
|
+
if (extension.items.length !== 0) {
|
|
45
|
+
for (let i = 0, total = extension.count; i < total; i++) {
|
|
46
|
+
let extUid = extension.items[i].uid;
|
|
47
|
+
self.master[extUid] = '';
|
|
48
|
+
self.extensions[extUid] = extension.items[i];
|
|
49
|
+
delete self.extensions[extUid].uid;
|
|
50
|
+
delete self.extensions[extUid].SYS_ACL;
|
|
51
|
+
}
|
|
52
|
+
helper.writeFile(path.join(extensionsFolderPath, extensionConfig.fileName), self.extensions);
|
|
53
|
+
addlogs(config, chalk.green('All the extensions have been exported successfully'), 'success');
|
|
54
|
+
return resolve();
|
|
45
55
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
})
|
|
56
|
-
})
|
|
57
|
-
}
|
|
56
|
+
addlogs(config, 'No extensions found', 'success');
|
|
57
|
+
return resolve();
|
|
58
|
+
})
|
|
59
|
+
.catch((error) => {
|
|
60
|
+
addlogs(config, error, 'error');
|
|
61
|
+
return reject();
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
};
|
|
58
65
|
|
|
59
|
-
module.exports = new ExportExtensions()
|
|
66
|
+
module.exports = new ExportExtensions();
|
|
@@ -1,113 +1,125 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Contentstack Export
|
|
3
|
-
* Copyright (c) 2019 Contentstack LLC
|
|
4
|
-
* MIT Licensed
|
|
5
|
-
*/
|
|
2
|
+
* Contentstack Export
|
|
3
|
+
* Copyright (c) 2019 Contentstack LLC
|
|
4
|
+
* MIT Licensed
|
|
5
|
+
*/
|
|
6
6
|
|
|
7
|
-
const mkdirp = require('mkdirp')
|
|
8
|
-
const path = require('path')
|
|
9
|
-
const chalk = require('chalk')
|
|
7
|
+
const mkdirp = require('mkdirp');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const chalk = require('chalk');
|
|
10
10
|
|
|
11
|
-
const stack = require('../util/contentstack-management-sdk')
|
|
12
|
-
const helper = require('../util/helper')
|
|
13
|
-
const {addlogs} = require('../util/log')
|
|
14
|
-
|
|
15
|
-
let config = require('../../config/default')
|
|
16
|
-
const globalfieldsConfig = config.modules.globalfields
|
|
17
|
-
const globalfieldsFolderPath = path.resolve(config.data, globalfieldsConfig.dirName)
|
|
18
|
-
const validKeys = globalfieldsConfig.validKeys
|
|
19
|
-
const limit = 100
|
|
20
|
-
|
|
21
|
-
// Create folder for Global Fields
|
|
22
|
-
mkdirp.sync(globalfieldsFolderPath)
|
|
11
|
+
const stack = require('../util/contentstack-management-sdk');
|
|
12
|
+
const helper = require('../util/helper');
|
|
13
|
+
const { addlogs } = require('../util/log');
|
|
23
14
|
|
|
15
|
+
let config = require('../../config/default');
|
|
16
|
+
const limit = 100;
|
|
17
|
+
const validKeys = config.modules.globalfields.validKeys;
|
|
18
|
+
let globalfieldsFolderPath;
|
|
19
|
+
const globalfieldsConfig = config.modules.globalfields;
|
|
24
20
|
function ExportGlobalFields() {
|
|
25
|
-
this.global_fields = []
|
|
21
|
+
this.global_fields = [];
|
|
26
22
|
this.requestOptions = {
|
|
27
23
|
qs: {
|
|
28
24
|
include_count: true,
|
|
29
25
|
asc: 'updated_at',
|
|
30
26
|
limit: limit,
|
|
31
27
|
},
|
|
32
|
-
}
|
|
33
|
-
this.master = {}
|
|
34
|
-
this.globalfields = {}
|
|
28
|
+
};
|
|
29
|
+
this.master = {};
|
|
30
|
+
this.globalfields = {};
|
|
35
31
|
}
|
|
36
32
|
|
|
37
33
|
ExportGlobalFields.prototype = {
|
|
38
34
|
start: function (credentialConfig) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
this.master = {};
|
|
36
|
+
this.globalfields = {};
|
|
37
|
+
config = { ...config, ...credentialConfig };
|
|
38
|
+
globalfieldsFolderPath = path.resolve(config.data, config.branchName || '', globalfieldsConfig.dirName);
|
|
39
|
+
// Create folder for Global Fields
|
|
40
|
+
mkdirp.sync(globalfieldsFolderPath);
|
|
41
|
+
const self = this;
|
|
42
|
+
addlogs(config, 'Starting Global Fields export', 'success');
|
|
42
43
|
return new Promise(function (resolve, reject) {
|
|
43
44
|
try {
|
|
44
|
-
return self
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
45
|
+
return self
|
|
46
|
+
.getGlobalFields(null, config)
|
|
47
|
+
.then(function (result) {
|
|
48
|
+
if (!result) {
|
|
49
|
+
return self
|
|
50
|
+
.writeGlobalFields()
|
|
51
|
+
.then(() => {
|
|
52
|
+
return resolve();
|
|
53
|
+
})
|
|
54
|
+
.catch((error) => {
|
|
55
|
+
return reject(error);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return resolve();
|
|
59
|
+
})
|
|
60
|
+
.catch((error) => {
|
|
61
|
+
return reject(error);
|
|
62
|
+
});
|
|
56
63
|
} catch (error) {
|
|
57
|
-
return reject(error)
|
|
64
|
+
return reject(error);
|
|
58
65
|
}
|
|
59
|
-
})
|
|
66
|
+
});
|
|
60
67
|
},
|
|
61
|
-
getGlobalFields: function (skip,
|
|
62
|
-
const self = this
|
|
68
|
+
getGlobalFields: function (skip, globalFieldConfig) {
|
|
69
|
+
const self = this;
|
|
63
70
|
if (typeof skip !== 'number') {
|
|
64
|
-
skip = 0
|
|
65
|
-
self.requestOptions.qs.skip = skip
|
|
71
|
+
skip = 0;
|
|
72
|
+
self.requestOptions.qs.skip = skip;
|
|
66
73
|
} else {
|
|
67
|
-
self.requestOptions.qs.skip = skip
|
|
74
|
+
self.requestOptions.qs.skip = skip;
|
|
68
75
|
}
|
|
69
|
-
|
|
70
|
-
let client = stack.Client(
|
|
76
|
+
|
|
77
|
+
let client = stack.Client(globalFieldConfig);
|
|
71
78
|
return new Promise(function (resolve, reject) {
|
|
72
|
-
client
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
client
|
|
80
|
+
.stack({
|
|
81
|
+
api_key: globalFieldConfig.source_stack,
|
|
82
|
+
management_token: globalFieldConfig.management_token,
|
|
83
|
+
})
|
|
84
|
+
.globalField()
|
|
85
|
+
.query(self.requestOptions.qs)
|
|
86
|
+
.find()
|
|
87
|
+
.then((globalFieldResponse) => {
|
|
88
|
+
try {
|
|
89
|
+
if (globalFieldResponse.items.length === 0) {
|
|
90
|
+
addlogs(globalFieldConfig, 'No global fields found', 'success');
|
|
91
|
+
return resolve('No Global Fields');
|
|
84
92
|
}
|
|
85
|
-
|
|
86
|
-
|
|
93
|
+
globalFieldResponse.items.forEach(function (globalField) {
|
|
94
|
+
for (const key in globalField) {
|
|
95
|
+
if (validKeys.indexOf(key) === -1) {
|
|
96
|
+
delete globalField[key];
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
self.global_fields.push(globalField);
|
|
100
|
+
});
|
|
87
101
|
|
|
88
|
-
|
|
102
|
+
skip += limit;
|
|
89
103
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
104
|
+
if (skip > globalFieldResponse.count) {
|
|
105
|
+
return resolve();
|
|
106
|
+
}
|
|
93
107
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
})
|
|
101
|
-
})
|
|
108
|
+
return self.getGlobalFields(skip, globalFieldConfig).then(resolve).catch(reject);
|
|
109
|
+
} catch (error) {
|
|
110
|
+
return reject(error);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
});
|
|
102
114
|
},
|
|
103
115
|
writeGlobalFields: function () {
|
|
104
|
-
const self = this
|
|
116
|
+
const self = this;
|
|
105
117
|
return new Promise(function (resolve) {
|
|
106
|
-
helper.writeFile(path.join(globalfieldsFolderPath, globalfieldsConfig.fileName), self.global_fields)
|
|
107
|
-
addlogs(config, chalk.green('Global Fields export completed successfully'), 'success')
|
|
108
|
-
return resolve()
|
|
109
|
-
})
|
|
118
|
+
helper.writeFile(path.join(globalfieldsFolderPath, globalfieldsConfig.fileName), self.global_fields);
|
|
119
|
+
addlogs(config, chalk.green('Global Fields export completed successfully'), 'success');
|
|
120
|
+
return resolve();
|
|
121
|
+
});
|
|
110
122
|
},
|
|
111
|
-
}
|
|
123
|
+
};
|
|
112
124
|
|
|
113
|
-
module.exports = new ExportGlobalFields()
|
|
125
|
+
module.exports = new ExportGlobalFields();
|
package/src/lib/export/labels.js
CHANGED
|
@@ -4,61 +4,69 @@
|
|
|
4
4
|
* MIT Licensed
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
const mkdirp = require('mkdirp')
|
|
8
|
-
const path = require('path')
|
|
9
|
-
const chalk = require('chalk')
|
|
7
|
+
const mkdirp = require('mkdirp');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const chalk = require('chalk');
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
let
|
|
13
|
-
let {addlogs} = require('../util/log')
|
|
11
|
+
let helper = require('../util/helper');
|
|
12
|
+
let { addlogs } = require('../util/log');
|
|
14
13
|
|
|
15
|
-
const stack = require('../util/contentstack-management-sdk')
|
|
16
|
-
let config = require('../../config/default')
|
|
17
|
-
let labelConfig = config.modules.labels
|
|
18
|
-
let client
|
|
14
|
+
const stack = require('../util/contentstack-management-sdk');
|
|
15
|
+
let config = require('../../config/default');
|
|
16
|
+
let labelConfig = config.modules.labels;
|
|
17
|
+
let client;
|
|
19
18
|
|
|
20
19
|
function ExportLabels() {
|
|
21
20
|
this.requestOptions = {
|
|
22
21
|
url: config.host + config.apis.labels,
|
|
23
22
|
headers: config.headers,
|
|
24
23
|
json: true,
|
|
25
|
-
}
|
|
26
|
-
this.labels = {}
|
|
24
|
+
};
|
|
25
|
+
this.labels = {};
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
ExportLabels.prototype.start = function (credentialConfig) {
|
|
30
|
-
addlogs(config, 'Starting labels export', 'success')
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
addlogs(config, 'Starting labels export', 'success');
|
|
30
|
+
this.labels = {};
|
|
31
|
+
let self = this;
|
|
32
|
+
config = credentialConfig;
|
|
33
|
+
client = stack.Client(config);
|
|
34
|
+
let labelsFolderPath = path.resolve(config.data, config.branchName || '', labelConfig.dirName);
|
|
35
35
|
// Create locale folder
|
|
36
|
-
mkdirp.sync(labelsFolderPath)
|
|
36
|
+
mkdirp.sync(labelsFolderPath);
|
|
37
37
|
return new Promise(function (resolve, reject) {
|
|
38
|
-
return client
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return resolve()
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
38
|
+
return client
|
|
39
|
+
.stack({ api_key: config.source_stack, management_token: config.management_token })
|
|
40
|
+
.label()
|
|
41
|
+
.query()
|
|
42
|
+
.find()
|
|
43
|
+
.then((response) => {
|
|
44
|
+
if (response.items.length !== 0) {
|
|
45
|
+
response.items.forEach(function (label) {
|
|
46
|
+
addlogs(config, label.name + ' labels was exported successfully', 'success');
|
|
47
|
+
self.labels[label.uid] = label;
|
|
48
|
+
let deleteItems = config.modules.labels.invalidKeys;
|
|
49
|
+
deleteItems.forEach((e) => delete label[e]);
|
|
50
|
+
});
|
|
51
|
+
addlogs(config, chalk.green('All the labels have been exported successfully'), 'success');
|
|
52
|
+
} else {
|
|
53
|
+
addlogs(config, 'No labels found', 'success');
|
|
54
|
+
}
|
|
55
|
+
helper.writeFile(path.join(labelsFolderPath, labelConfig.fileName), self.labels);
|
|
56
|
+
return resolve();
|
|
57
|
+
})
|
|
58
|
+
.catch(function (error) {
|
|
59
|
+
if (error.statusCode === 401) {
|
|
60
|
+
addlogs(
|
|
61
|
+
config,
|
|
62
|
+
chalk.red('You are not allowed to export label, Unless you provide email and password in config', 'error'),
|
|
63
|
+
);
|
|
64
|
+
return resolve();
|
|
65
|
+
}
|
|
66
|
+
addlogs(config, error, 'error');
|
|
67
|
+
return reject();
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
};
|
|
63
71
|
|
|
64
|
-
module.exports = new ExportLabels()
|
|
72
|
+
module.exports = new ExportLabels();
|