Skip to content

Commit

Permalink
chore(docgen|menugen): fix problems with paths on Windows (#2349)
Browse files Browse the repository at this point in the history
  • Loading branch information
layershifter authored Dec 3, 2017
1 parent e7d2d8e commit 872240c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions gulp/plugins/gulp-menugen.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import through from 'through2'
import config from '../../config'
import { parseDocExample, parseDocSection } from './util'

const examplesPath = `${config.paths.docsSrc()}/Examples/`
const examplesPath = path.join(config.paths.docsSrc(), 'Examples', path.sep)

const normalizeResult = result => JSON.stringify(_.mapValues(
result,
Expand Down Expand Up @@ -38,7 +38,7 @@ export default (filename) => {

try {
const relativePath = file.path.replace(examplesPath, '')
const [, component, section] = _.split(relativePath, '/')
const [, component, section] = _.split(relativePath, path.sep)

if (section === 'index.js') {
result[component] = parseDocExample(file.contents)
Expand Down
2 changes: 1 addition & 1 deletion gulp/plugins/gulp-react-docgen.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ export default (filename) => {
})

parsed.path = file.path
.replace(`${process.cwd()}${path.sep}`, '')
.replace(new RegExp(_.escapeRegExp(path.sep), 'g'), '/')
.replace(`${process.cwd()}/`, '')
parsed.props = _.sortBy(parsed.props, 'name')

result[componentName] = parsed
Expand Down

0 comments on commit 872240c

Please sign in to comment.