Last active
February 10, 2019 21:13
-
-
Save hhff/5811a06a253ef87b9707ad01b0f2f2f1 to your computer and use it in GitHub Desktop.
webhook2contentful: generator.js modifications
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports.generator = function (config, options, logger, fileParser) { | |
/* ...Snip */ | |
/* Paste this right at the end of the file */ | |
let oldGetBucket; | |
[getBucket, oldGetBucket] = | |
require(`${__dirname}/contentful/decorators/getBucket`)(getBucket); | |
let oldGetDnsChild; | |
[getDnsChild, oldGetDnsChild] = | |
require(`${__dirname}/contentful/decorators/getDnsChild`)(getDnsChild); | |
this.migrateToContentful = function(done, cb) { | |
oldGetBucket().once('value', function(data) { | |
data = data.val() || {}; | |
let typeInfo = data['contentType'] || {}; | |
let settings = data['settings'] || {}; | |
data = data['data'] || {}; | |
require(`${__dirname}/contentful`)(data, typeInfo, settings, done, cb); | |
}); | |
} | |
return this; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment