contentful-import
Advanced tools
Comparing version 4.1.1 to 4.2.0
@@ -43,4 +43,16 @@ 'use strict'; | ||
var _lodash = require('lodash'); | ||
var _cliTable = require('cli-table2'); | ||
var _cliTable2 = _interopRequireDefault(_cliTable); | ||
var _moment = require('moment'); | ||
var _moment2 = _interopRequireDefault(_moment); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var summary = {}; | ||
function runContentfulImport(usageParams) { | ||
@@ -53,2 +65,4 @@ var defaultOpts = { | ||
summary.startTime = (0, _moment2.default)(); | ||
var configFile = usageParams.config ? require((0, _path.resolve)(process.cwd(), usageParams.config)) : {}; | ||
@@ -121,8 +135,36 @@ | ||
skipContentPublishing: opts.skipContentPublishing | ||
}).then(function (responses) { | ||
_npmlog2.default.info('Successfully Imported all data'); | ||
return true; | ||
}); | ||
}).then(function (response) { | ||
_npmlog2.default.info('import', 'Finished importing all data'); | ||
var infoTable = new _cliTable2.default(); | ||
infoTable.push([{ colSpan: 2, content: 'The following entities were imported' }]); | ||
Object.keys(opts.content).forEach(function (type) { | ||
if (opts.skipLocales && type === 'locales') { | ||
return; | ||
} | ||
if (opts.skipContentModel && type === 'contentTypes') { | ||
return; | ||
} | ||
if (opts.contentModelOnly && !['contentTypes', 'locales'].includes(type)) { | ||
return; | ||
} | ||
infoTable.push([(0, _lodash.startCase)(type), opts.content[type].length]); | ||
}); | ||
console.log(infoTable.toString()); | ||
var durationHuman = summary.startTime.fromNow(true); | ||
var durationSeconds = (0, _moment2.default)().diff(summary.startTime, 'seconds'); | ||
_npmlog2.default.info('import', `The import took ${durationHuman} (${durationSeconds}s)`); | ||
return response; | ||
}).catch(function (err) { | ||
_npmlog2.default.error(err); | ||
_npmlog2.default.error('import', err); | ||
throw err; | ||
@@ -129,0 +171,0 @@ }); |
{ | ||
"name": "contentful-import", | ||
"version": "4.1.1", | ||
"version": "4.2.0", | ||
"description": "this tool allows you to import JSON dump exported by contentful-export", | ||
@@ -52,5 +52,7 @@ "bin": { | ||
"bluebird": "^3.3.3", | ||
"cli-table2": "^0.2.0", | ||
"contentful-batch-libs": "^5.3.0", | ||
"json-stringify-safe": "^5.0.1", | ||
"lodash": "^4.0.0", | ||
"moment": "^2.18.1", | ||
"npmlog": "^4.0.0", | ||
@@ -57,0 +59,0 @@ "yargs": "^7.0.2" |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19681
224
8
+ Addedcli-table2@^0.2.0
+ Addedmoment@^2.18.1
+ Addedcli-table2@0.2.0(transitive)
+ Addedcolors@1.4.0(transitive)
+ Addedlodash@3.10.1(transitive)
+ Addedmoment@2.30.1(transitive)