Skip to content
This repository has been archived by the owner on Jan 24, 2025. It is now read-only.

Commit

Permalink
fix(docz-core): copy gatsby theme files in ensureFiles #1105
Browse files Browse the repository at this point in the history
  • Loading branch information
rakannimer committed Sep 30, 2019
1 parent f61894b commit 8f487a9
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions core/docz-core/src/bundler/machine/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,22 @@ const ensureFile = (filename: string, toDelete?: string) => {
}

export const ensureFiles = ({ args }: ServerMachineCtx) => {
const appPath = path.join(paths.docz, '..')
const themeDirs = glob.sync(path.join(args.themesDir, '/gatsby-theme-**'), {
cwd: paths.docz,
cwd: appPath,
onlyDirectories: true,
})

themeDirs.forEach(dir => {
const chunkedPath = dir.split('/')
const themeName = chunkedPath[chunkedPath.length - 1]
fs.copySync(dir, path.join(paths.docz, args.themesDir, themeName))
})
ensureFile('doczrc.js')
ensureFile('gatsby-browser.js')
ensureFile('gatsby-ssr.js')
ensureFile('gatsby-node.js')
ensureFile('gatsby-config.js', 'gatsby-config.custom.js')

themeDirs.forEach(dir => ensureFile(dir))

const publicPath = path.join(paths.docz, '..', args.public)
if (fs.existsSync(publicPath)) {
const destinationPath = path.join(paths.docz, 'static', args.public)
Expand Down

0 comments on commit 8f487a9

Please sign in to comment.