Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Commit

Permalink
fixup! fix: fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Khaledgarbaya committed Nov 22, 2016
1 parent 4754ade commit 128f22c
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions lib/run-space-sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import dumpErrorBuffer from './dump-error-buffer'
import getTransformedDestinationResponse from './get-transformed-destination-response'

export default function runSpaceSync (usageParams) {
const {opts} = usageParams
let {opts, errorLogFile, syncTokenFile} = usageParams
opts.sourceManagementToken = opts.sourceManagementToken || opts.managementToken
opts.destinationManagementToken = opts.destinationManagementToken || opts.managementToken
const tokenDir = opts.syncTokenDir || process.cwd()
opts.errorLogFile = tokenDir + '/contentful-space-sync-' + Date.now() + '.log'
opts.syncTokenFile = tokenDir + '/contentful-space-sync-token-' + opts.sourceSpace + '-to-' + opts.destinationSpace
errorLogFile = errorLogFile || tokenDir + '/contentful-space-sync-' + Date.now() + '.log'
syncTokenFile = syncTokenFile || tokenDir + '/contentful-space-sync-token-' + opts.sourceSpace + '-to-' + opts.destinationSpace

if (opts.proxyHost && opts.proxyPort) {
opts.proxy = {host: opts.proxyHost, port: opts.proxyPort}
Expand All @@ -28,7 +28,7 @@ export default function runSpaceSync (usageParams) {
deliveryClient: clients.source.delivery,
managementClient: clients.source.management,
sourceSpaceId: clients.source.spaceId,
nextSyncTokenFile: opts.syncTokenFile
nextSyncTokenFile: syncTokenFile
})

// Prepare object with both source and destination existing content
Expand Down Expand Up @@ -77,19 +77,15 @@ export default function runSpaceSync (usageParams) {
.then(() => {
const nextSyncToken = responses.source.nextSyncToken
if (!opts.contentModelOnly && nextSyncToken) {
try {
fs.writeFileSync(opts.syncTokenFile, nextSyncToken)
} catch (e) {
log.info('Cannot write synckToen to fileSystem, ', e)
}
fs.writeFileSync(syncTokenFile, nextSyncToken)
log.info('Successfully sychronized the content and saved the sync token to:\n ', opts.syncTokenFile)
} else {
log.info('Successfully sychronized the content model')
}
dumpErrorBuffer({
destinationSpace: opts.destinationSpace,
sourceSpace: opts.sourceSpace,
errorLogFile: opts.errorLogFile
errorLogFile: errorLogFile
}, 'However, additional errors were found')

return {
Expand Down

0 comments on commit 128f22c

Please sign in to comment.