Skip to content

Commit 6e7b369

Browse files
Benedikt Rötschaxe312ger
Benedikt Rötsch
authored andcommitted
fixup! feat(task-listing): implement listr for a proper overview of all export tasks
1 parent db721dc commit 6e7b369

File tree

3 files changed

+37
-23
lines changed

3 files changed

+37
-23
lines changed

README.md

+23-14
Original file line numberDiff line numberDiff line change
@@ -24,35 +24,44 @@ npm install -g contentful-export
2424
Usage: contentful-export [options]
2525
2626
Options:
27-
--version Show version number [boolean]
27+
--version Show version number [boolean]
2828
29-
--space-id ID of Space with source data [string] [required]
29+
--space-id ID of Space with source data [string] [required]
3030
31-
--management-token Contentful management API token for the space to be
32-
exported [string] [required]
31+
--management-token Contentful management API token for the space to be
32+
exported [string] [required]
3333
34-
--export-dir Defines the path for storing the export json file
35-
(default path is the current directory) [string]
34+
--export-dir Defines the path for storing the export json file
35+
(default path is the current directory) [string]
3636
37-
--include-drafts Include drafts in the exported entries
37+
--include-drafts Include drafts in the exported entries
3838
[boolean] [default: false]
3939
40-
--skip-content-model Skip exporting content models [boolean] [default: false]
40+
--skip-content-model Skip exporting content models
41+
[boolean] [default: false]
4142
42-
--skip-content Skip exporting assets and entries
43+
--skip-content Skip exporting assets and entries
4344
[boolean] [default: false]
4445
45-
--skip-roles Skip exporting roles and permissions
46+
--skip-roles Skip exporting roles and permissions
4647
[boolean] [default: false]
4748
48-
--skip-webhooks Skip exporting webhooks [boolean] [default: false]
49+
--skip-webhooks Skip exporting webhooks [boolean] [default: false]
4950
50-
--download-assets With this flags assets will also be downloaded [boolean]
51+
--download-assets With this flags assets will also be downloaded
52+
[boolean]
5153
52-
--max-allowed-limit How many items per page per request
54+
--max-allowed-limit How many items per page per request
5355
[number] [default: 1000]
5456
55-
--error-log-file Full path to the error log file [string]
57+
--management-host Management API host
58+
[string] [default: "api.contentful.com"]
59+
60+
--error-log-file Full path to the error log file [string]
61+
62+
--use-verbose-renderer Display progress in new lines instead of displaying a
63+
busy spinner and the status in the same line. Useful
64+
for CI. [boolean] [default: false]
5665
5766
--save-file Save the export as a json file [boolean] [default: true]
5867

lib/index.js

+13-8
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ import moment from 'moment'
1616

1717
const summary = {}
1818

19+
function createListrOptions (opts) {
20+
if (opts.useVerboseRenderer) {
21+
return {
22+
renderer: VerboseRenderer
23+
}
24+
}
25+
return {
26+
renderer: UpdateRenderer,
27+
collapse: false
28+
}
29+
}
30+
1931
export default function runContentfulExport (usageParams) {
2032
const defaultOpts = {
2133
exportDir: process.cwd(),
@@ -56,14 +68,7 @@ export default function runContentfulExport (usageParams) {
5668
opts.errorLogFile = opts.exportDir + '/contentful-export-' + Date.now() + '.log'
5769
}
5870

59-
const listrOptions = opts.useVerboseRenderer
60-
? {
61-
renderer: VerboseRenderer
62-
}
63-
: {
64-
renderer: UpdateRenderer,
65-
collapse: false
66-
}
71+
const listrOptions = createListrOptions(opts)
6772

6873
const tasks = new Listr([
6974
{

lib/usageParams.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export default yargs
6868
default: true
6969
})
7070
.option('use-verbose-renderer', {
71-
describe: 'Full path to the error log file',
71+
describe: 'Display progress in new lines instead of displaying a busy spinner and the status in the same line. Useful for CI.',
7272
type: 'boolean',
7373
default: false
7474
})

0 commit comments

Comments
 (0)