Skip to content

Commit c1077d6

Browse files
message change
1 parent 5eac6ad commit c1077d6

7 files changed

Lines changed: 30 additions & 24 deletions

File tree

packages/contentstack-export/src/app.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ var util = require('./lib/util')
44
var login = require('./lib/util/login')
55
var {addlogs} = require('./lib/util/log')
66
const chalk = require('chalk')
7+
let path = require('path')
78

89
exports.initial = function (config) {
910
config = util.buildAppConfig(config)
@@ -36,10 +37,11 @@ var singleExport = (moduleName, types, config) => {
3637
var exportedModule = require('./lib/export/' + moduleName)
3738
exportedModule.start(config).then(function () {
3839
addlogs(config, moduleName + ' was exported successfully!', 'success')
40+
addlogs(config, 'The log for this is stored at ' + path.join(config.data , 'logs', 'export'), 'success')
3941
}).catch(function (error) {
4042
addlogs(config, 'Failed to migrate ' + moduleName, 'error')
4143
addlogs(config, error, 'error')
42-
addlogs(config, 'The log for this is stored at ' + config.data + '/logs', 'success')
44+
addlogs(config, 'The log for this is stored at ' + path.join(config.data , 'logs', 'export'), 'error')
4345
})
4446
} else {
4547
addlogs(config, 'Please provide valid module name.', 'error')
@@ -64,9 +66,9 @@ var allExport = async (config, types) => {
6466
concurrency: 1,
6567
}).then(function () {
6668
addlogs(config, chalk.green('Stack: ' + config.source_stack + ' has been exported succesfully!'), 'success')
67-
addlogs(config, 'The log for this is stored at ' + config.data + '/logs', 'success')
69+
addlogs(config, 'The log for this is stored at ' + path.join(config.data , 'logs', 'export'), 'success')
6870
}).catch(function () {
6971
addlogs(config, chalk.red('Failed to migrate stack: ' + config.source_stack + '. Please check error logs for more info'), 'error')
70-
addlogs(config, 'The log for this is stored at ' + config.data + '/logs', 'success')
72+
addlogs(config, 'The log for this is stored at ' + path.join(config.data , 'logs', 'export'), 'error')
7173
})
7274
}

packages/contentstack-export/src/commands/cm/export.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,24 +91,24 @@ class ExportCommand extends Command {
9191
}
9292
}
9393

94-
ExportCommand.description = `Export utils for exporting the content from stack
94+
ExportCommand.description = `Export content from a stack
9595
...
9696
Export content from one stack to another
9797
`
9898
ExportCommand.examples = [
9999
'csdx cm:export -A',
100100
'csdx cm:export -A -l \'master-language\' -s \'stack_ApiKey\' -d \'path/of/export/destination/dir\'',
101101
'csdx cm:export -A -c \'path/of/config/dir\'',
102-
'csdx cm:export -a \'alias of managment_token\'',
103-
'csdx cm:export -a "alias of managment_token" -l "master-language" -d "path/of/export/destination/dir"',
104-
'csdx cm:export -a "alias of managment_token" -c "path/of/config/file"',
102+
'csdx cm:export -a \'management_token_alias\'',
103+
'csdx cm:export -a "management_token_alias" -l "master-language" -d "path/of/export/destination/dir"',
104+
'csdx cm:export -a "management_token_alias" -c "path/of/config/file"',
105105
'csdx cm:export -A -m "single module name"',
106106
]
107107

108108
ExportCommand.flags = {
109-
config: flags.string({char: 'c', description: '[optional]path of the config'}),
110-
'master-lang': flags.string({char: 'l', description: 'code of the source stacks master Language'}),
111-
'stack-uid': flags.string({char: 's', description: 'API key of source stack'}),
109+
config: flags.string({char: 'c', description: '[optional] path of the config'}),
110+
'master-lang': flags.string({char: 'l', description: "code of the source stack's master Language"}),
111+
'stack-uid': flags.string({char: 's', description: 'API key of the source stack'}),
112112
data: flags.string({char: 'd', description: 'path or location to store the data'}),
113113
'management-token-alias': flags.string({char: 'a', description: 'alias of the management token'}),
114114
'auth-token': flags.boolean({char: 'A', description: 'to use auth token'}),

packages/contentstack-export/src/lib/export/global-fields.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ ExportGlobalFields.prototype = {
3838
start: function (credentialConfig) {
3939
const self = this
4040
config = credentialConfig
41-
addlogs(config, 'Starting Global Fields export')
41+
addlogs(config, 'Starting Global Fields export', 'success')
4242
return new Promise(function (resolve, reject) {
4343
try {
4444
return self.getGlobalFields(null, config).then(function (result) {

packages/contentstack-export/src/lib/export/labels.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function ExportLabels() {
2727
}
2828

2929
ExportLabels.prototype.start = function (credentialConfig) {
30-
addlogs(config, chalk.white('Starting labels export'))
30+
addlogs(config, 'Starting labels export', 'success')
3131
let self = this
3232
config = credentialConfig
3333
client = stack.Client(config)
@@ -40,12 +40,12 @@ ExportLabels.prototype.start = function (credentialConfig) {
4040
if (response.items.length !== 0) {
4141
response.items.forEach(function (label) {
4242
delete label['stackHeaders']
43-
addlogs(config, chalk.white(label.name + ' labels was exported successfully'))
43+
addlogs(config, chalk.white(label.name + ' labels was exported successfully'), 'success')
4444
self.labels[label.uid] = label
4545
})
46-
addlogs(config, chalk.green('All the labels have been exported successfully'))
46+
addlogs(config, chalk.green('All the labels have been exported successfully'), 'success')
4747
} else {
48-
addlogs(config, 'No labels, other than master-labels were found in the Stack')
48+
addlogs(config, 'No labels, other than master-labels were found in the Stack', 'success')
4949
}
5050
helper.writeFile(path.join(labelsFolderPath, labelConfig.fileName), self.labels)
5151
return resolve()

packages/contentstack-export/src/lib/export/webhooks.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function ExportWebhooks() {
2828
}
2929

3030
ExportWebhooks.prototype.start = function (credentialConfig) {
31-
addlogs(config, chalk.white('Starting webhooks export'))
31+
addlogs(config, 'Starting webhooks export', 'success')
3232
let self = this
3333
config = credentialConfig
3434
client = stack.Client(config)
@@ -49,11 +49,11 @@ ExportWebhooks.prototype.start = function (credentialConfig) {
4949
addlogs(config, chalk.green('All the webhooks have been exported successfully'), 'success')
5050
return resolve()
5151
}
52-
addlogs(config, 'No webhooks were found in the Stack', '')
52+
addlogs(config, 'No webhooks were found in the Stack', 'success')
5353
return resolve()
5454
}).catch(function (error) {
5555
if (error.statusCode === 401) {
56-
addlogs(config, chalk.red('You are not allowed to export webhooks, Unless you provide email and password in config'))
56+
addlogs(config, chalk.red('You are not allowed to export webhooks, Unless you provide email and password in config'), 'error')
5757
return resolve()
5858
}
5959
addlogs(config, error, 'error')

packages/contentstack-import/src/app.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,11 @@ let singleExport = (moduleName, types, config) => {
5858
let exportedModule = require('./lib/import/' + moduleName)
5959
exportedModule.start(config).then(function () {
6060
addlogs(config, moduleName + ' imported successfully!', 'success')
61+
addlogs(config, 'The log for this is stored at' + path.join(config.oldPath, 'logs', 'import'), 'success')
6162
}).catch(function (error) {
6263
addlogs(config, 'Failed to migrate ' + moduleName, 'error')
6364
addlogs(config, error, 'error')
65+
addlogs(config, 'The log for this is stored at' + path.join(config.oldPath, 'logs', 'import'), 'error')
6466
})
6567
} else {
6668
addlogs(config, 'Please provide valid module name.', 'error')
@@ -85,10 +87,12 @@ let allExport = async (config, types) => {
8587
concurrency: 1
8688
}).then(function () {
8789
addlogs(config, chalk.green('Stack: ' + config.target_stack + ' has been imported succesfully!'), 'success')
88-
addlogs(config, 'The log for this is stored at' + config.oldPath + '/logs/import', 'success')
90+
addlogs(config, 'The log for this is stored at' + path.join(config.oldPath, 'logs', 'import'), 'success')
8991
}).catch(function (error) {
9092
addlogs(config, chalk.red('Failed to migrate stack: ' + config.target_stack + '. Please check error logs for more info'), 'error')
9193
addlogs(config, error, 'error')
94+
addlogs(config, 'The log for this is stored at' + path.join(config.oldPath, 'logs', 'import'), 'error')
95+
9296
})
9397
}
9498

packages/contentstack-import/src/commands/cm/import.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,14 @@ ImportCommand.examples = [
9797
`csdx cm:import -A`,
9898
`csdx cm:import -A -l "master-language" -s "stack_ApiKey" -d "path/of/export/destination/dir"`,
9999
`csdx cm:import -A -c "path/of/config/dir"`,
100-
`csdx cm:import -a "alias of managment_token"`,
101-
`csdx cm:import -a "alias of managment_token" -l "master-language" -d "path/of/export/destination/dir"`,
102-
`csdx cm:import -a "alias of managment_token" -c "path/of/config/file"`,
100+
`csdx cm:import -a "management_token_alias"`,
101+
`csdx cm:import -a "management_token_alias" -l "master-language" -d "path/of/export/destination/dir"`,
102+
`csdx cm:import -a "management_token_alias" -c "path/of/config/file"`,
103103
`csdx cm:import -A -m "single module name"`,
104104
]
105105
ImportCommand.flags = {
106-
config: flags.string({char: 'c', description: '[optional]path of config file'}),
107-
'master-lang': flags.string({char: 'l', description: 'code of the target stacks master language'}),
106+
config: flags.string({char: 'c', description: '[optional] path of config file'}),
107+
'master-lang': flags.string({char: 'l', description: "code of the target stack's master language"}),
108108
'stack-uid': flags.string({char: 's', description: 'API key of the target stack'}),
109109
data: flags.string({char: 'd', description: 'path and location where data is stored'}),
110110
'management-token-alias': flags.string({char: 'a', description: 'alias of the management token'}),

0 commit comments

Comments
 (0)