Skip to content

Commit

Permalink
chore(docz-core): check source before copying in copyDoczRc
Browse files Browse the repository at this point in the history
  • Loading branch information
rakannimer committed Nov 29, 2019
1 parent fe1e2da commit 432ea08
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions core/docz-core/src/bundler/machine/services/create-resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ export const copyDoczRc = (configPath?: string) => {
const sourceDoczRc = configPath
? path.join(paths.root, configPath)
: path.join(paths.root, 'doczrc.js')

const hasDoczRc = fs.existsSync(sourceDoczRc)
if (!hasDoczRc) return

const destinationDoczRc = path.join(paths.docz, 'doczrc.js')
try {
fs.copySync(sourceDoczRc, destinationDoczRc)
} catch (err) {
// console.error(
// `Failed to copy doczrc.js from ${sourceDoczRc} to ${destinationDoczRc} : ${err.message}`,
// err.stack
// )
}
} catch (err) {}
}

const copyAndModifyPkgJson = async (ctx: ServerMachineCtx) => {
Expand Down Expand Up @@ -130,6 +129,6 @@ export const createResources = async (ctx: ServerMachineCtx) => {
await writeGatsbyBrowser()
await writeGatsbySSR()
} catch (err) {
console.log(err)
console.error(err)
}
}

0 comments on commit 432ea08

Please sign in to comment.