contentful-export 7.15.1 → 7.16.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/bin/contentful-export +4 -1
- package/dist/index.js +2 -2
- package/dist/tasks/get-space-data.js +11 -11
- package/dist/usageParams.js +6 -3
- package/package.json +3 -3
- package/types.d.ts +3 -4
package/bin/contentful-export
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
|
+
|
3
|
+
// eslint-disable-next-line
|
2
4
|
const runContentfulExport = require('../dist/index')
|
5
|
+
// eslint-disable-next-line
|
3
6
|
const usageParams = require('../dist/usageParams')
|
4
7
|
|
5
8
|
console.log('We moved the CLI version of this tool into our Contentful CLI.\nThis allows our users to use and install only one single CLI tool to get the full Contentful experience.\nFor more info please visit https://github.com/contentful/contentful-cli/tree/master/docs/space/export')
|
6
9
|
|
7
10
|
runContentfulExport(usageParams)
|
8
|
-
.then((
|
11
|
+
.then(() => {
|
9
12
|
process.exit(0)
|
10
13
|
})
|
11
14
|
.catch((err) => {
|
package/dist/index.js
CHANGED
@@ -104,7 +104,7 @@ function runContentfulExport(params) {
|
|
104
104
|
skip: ctx => !options.downloadAssets || !Object.prototype.hasOwnProperty.call(ctx.data, 'assets')
|
105
105
|
}, {
|
106
106
|
title: 'Write export log file',
|
107
|
-
task:
|
107
|
+
task: () => {
|
108
108
|
return new _listr.default([{
|
109
109
|
title: 'Lookup directory to store the logs',
|
110
110
|
task: ctx => {
|
@@ -116,7 +116,7 @@ function runContentfulExport(params) {
|
|
116
116
|
}
|
117
117
|
}, {
|
118
118
|
title: 'Create log directory',
|
119
|
-
task:
|
119
|
+
task: () => {
|
120
120
|
return (0, _mkdirp.default)(options.exportDir);
|
121
121
|
},
|
122
122
|
skip: ctx => !ctx.logDirectoryExists
|
@@ -47,7 +47,7 @@ function getFullSourceSpace({
|
|
47
47
|
};
|
48
48
|
return new _listr.default([{
|
49
49
|
title: 'Connecting to space',
|
50
|
-
task: (0, _listr2.wrapTask)(
|
50
|
+
task: (0, _listr2.wrapTask)(ctx => {
|
51
51
|
return client.getSpace(spaceId).then(space => {
|
52
52
|
ctx.space = space;
|
53
53
|
return space.getEnvironment(environmentId);
|
@@ -57,7 +57,7 @@ function getFullSourceSpace({
|
|
57
57
|
})
|
58
58
|
}, {
|
59
59
|
title: 'Fetching content types data',
|
60
|
-
task: (0, _listr2.wrapTask)(
|
60
|
+
task: (0, _listr2.wrapTask)(ctx => {
|
61
61
|
return pagedGet({
|
62
62
|
source: ctx.environment,
|
63
63
|
method: 'getContentTypes'
|
@@ -68,20 +68,20 @@ function getFullSourceSpace({
|
|
68
68
|
skip: () => skipContentModel
|
69
69
|
}, {
|
70
70
|
title: 'Fetching tags data',
|
71
|
-
task: (0, _listr2.wrapTask)(
|
71
|
+
task: (0, _listr2.wrapTask)(ctx => {
|
72
72
|
return pagedGet({
|
73
73
|
source: ctx.environment,
|
74
74
|
method: 'getTags'
|
75
75
|
}).then(extractItems).then(items => {
|
76
76
|
ctx.data.tags = items;
|
77
|
-
}).catch(
|
77
|
+
}).catch(() => {
|
78
78
|
ctx.data.tags = [];
|
79
79
|
});
|
80
80
|
}),
|
81
81
|
skip: () => cdaClient
|
82
82
|
}, {
|
83
83
|
title: 'Fetching editor interfaces data',
|
84
|
-
task: (0, _listr2.wrapTask)(
|
84
|
+
task: (0, _listr2.wrapTask)(ctx => {
|
85
85
|
return getEditorInterfaces(ctx.data.contentTypes).then(editorInterfaces => {
|
86
86
|
ctx.data.editorInterfaces = editorInterfaces.filter(editorInterface => {
|
87
87
|
return editorInterface !== null;
|
@@ -91,7 +91,7 @@ function getFullSourceSpace({
|
|
91
91
|
skip: ctx => skipContentModel || skipEditorInterfaces || ctx.data.contentTypes.length === 0 && 'Skipped since no content types downloaded'
|
92
92
|
}, {
|
93
93
|
title: 'Fetching content entries data',
|
94
|
-
task: (0, _listr2.wrapTask)(
|
94
|
+
task: (0, _listr2.wrapTask)(ctx => {
|
95
95
|
const source = cdaClient || ctx.environment;
|
96
96
|
|
97
97
|
if (cdaClient) {
|
@@ -112,7 +112,7 @@ function getFullSourceSpace({
|
|
112
112
|
skip: () => skipContent
|
113
113
|
}, {
|
114
114
|
title: 'Fetching assets data',
|
115
|
-
task: (0, _listr2.wrapTask)(
|
115
|
+
task: (0, _listr2.wrapTask)(ctx => {
|
116
116
|
const source = cdaClient || ctx.environment;
|
117
117
|
queryAssets = queryAssets || {};
|
118
118
|
queryAssets.locale = '*';
|
@@ -127,7 +127,7 @@ function getFullSourceSpace({
|
|
127
127
|
skip: () => skipContent
|
128
128
|
}, {
|
129
129
|
title: 'Fetching locales data',
|
130
|
-
task: (0, _listr2.wrapTask)(
|
130
|
+
task: (0, _listr2.wrapTask)(ctx => {
|
131
131
|
return pagedGet({
|
132
132
|
source: ctx.environment,
|
133
133
|
method: 'getLocales'
|
@@ -138,7 +138,7 @@ function getFullSourceSpace({
|
|
138
138
|
skip: () => skipContentModel
|
139
139
|
}, {
|
140
140
|
title: 'Fetching webhooks data',
|
141
|
-
task: (0, _listr2.wrapTask)(
|
141
|
+
task: (0, _listr2.wrapTask)(ctx => {
|
142
142
|
return pagedGet({
|
143
143
|
source: ctx.space,
|
144
144
|
method: 'getWebhooks'
|
@@ -149,7 +149,7 @@ function getFullSourceSpace({
|
|
149
149
|
skip: () => skipWebhooks || environmentId !== 'master' && 'Webhooks can only be exported from master environment'
|
150
150
|
}, {
|
151
151
|
title: 'Fetching roles data',
|
152
|
-
task: (0, _listr2.wrapTask)(
|
152
|
+
task: (0, _listr2.wrapTask)(ctx => {
|
153
153
|
return pagedGet({
|
154
154
|
source: ctx.space,
|
155
155
|
method: 'getRoles'
|
@@ -162,7 +162,7 @@ function getFullSourceSpace({
|
|
162
162
|
}
|
163
163
|
|
164
164
|
function getEditorInterfaces(contentTypes) {
|
165
|
-
return _bluebird.default.map(contentTypes,
|
165
|
+
return _bluebird.default.map(contentTypes, contentType => {
|
166
166
|
return contentType.getEditorInterface().then(editorInterface => {
|
167
167
|
_logging.logEmitter.emit('info', `Fetched editor interface for ${contentType.name}`);
|
168
168
|
|
package/dist/usageParams.js
CHANGED
@@ -5,11 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
7
|
|
8
|
-
|
8
|
+
var _yargs = _interopRequireDefault(require("yargs"));
|
9
9
|
|
10
|
-
|
10
|
+
var _package = _interopRequireDefault(require("../package"));
|
11
11
|
|
12
|
-
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13
|
+
|
14
|
+
var _default = _yargs.default.version(_package.default.version || 'Version only available on installed package').usage('Usage: $0 [options]').option('space-id', {
|
13
15
|
describe: 'ID of Space with source data',
|
14
16
|
type: 'string',
|
15
17
|
demand: true
|
@@ -98,5 +100,6 @@ var _default = yargs.version(packageFile.version || 'Version only available on i
|
|
98
100
|
type: 'string',
|
99
101
|
describe: 'Pass an additional HTTP Header'
|
100
102
|
}).config('config', 'An optional configuration JSON file containing all the options for a single run').argv;
|
103
|
+
|
101
104
|
exports.default = _default;
|
102
105
|
module.exports = exports.default;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "contentful-export",
|
3
|
-
"version": "7.
|
3
|
+
"version": "7.16.0",
|
4
4
|
"description": "this tool allows you to export a space to a JSON dump",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"types": "types.d.ts",
|
@@ -14,7 +14,7 @@
|
|
14
14
|
"build": "npm run clean && babel lib --out-dir dist",
|
15
15
|
"build:watch": "babel lib --out-dir dist --watch",
|
16
16
|
"clean": "rimraf dist && rimraf coverage",
|
17
|
-
"lint": "eslint lib bin/*",
|
17
|
+
"lint": "eslint lib bin/* types.d.ts",
|
18
18
|
"pretest": "npm run lint && npm run build && rimraf ./test/integration/tmp",
|
19
19
|
"test": "npm run test:unit && npm run test:integration",
|
20
20
|
"test:unit": "jest --testPathPattern=test/unit --coverage",
|
@@ -68,7 +68,7 @@
|
|
68
68
|
"@babel/template": "^7.0.0",
|
69
69
|
"@babel/types": "^7.0.0",
|
70
70
|
"@types/jest": "^27.0.2",
|
71
|
-
"
|
71
|
+
"@typescript-eslint/eslint-plugin": "^5.22.0",
|
72
72
|
"babel-jest": "^28.0.0",
|
73
73
|
"babel-plugin-add-module-exports": "^1.0.2",
|
74
74
|
"cz-conventional-changelog": "^3.3.0",
|
package/types.d.ts
CHANGED
@@ -28,10 +28,9 @@ export interface Options {
|
|
28
28
|
skipRoles?: boolean;
|
29
29
|
skipWebhooks?: boolean;
|
30
30
|
useVerboseRenderer?: boolean;
|
31
|
-
}
|
32
|
-
|
31
|
+
}
|
33
32
|
|
34
33
|
type ContentfulExportField = 'contentTypes' | 'entries' | 'assets' | 'locales' | 'tags' | 'webhooks' | 'roles' | 'editorInterfaces';
|
35
34
|
|
36
|
-
declare const runContentfulExport: (params: Options) => Promise<Record<ContentfulExportField, unknown[]
|
37
|
-
export default runContentfulExport
|
35
|
+
declare const runContentfulExport: (params: Options) => Promise<Record<ContentfulExportField, unknown[]>>
|
36
|
+
export default runContentfulExport
|