From ec6827f034feaba5d1cb0c2b3f7fc6ce244ab990 Mon Sep 17 00:00:00 2001 From: Alexander Fedyashov Date: Sun, 3 Dec 2017 09:43:49 +0200 Subject: [PATCH] chore(docgen|menugen): fix problems with paths on Windows --- gulp/plugins/gulp-menugen.js | 4 ++-- gulp/plugins/gulp-react-docgen.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gulp/plugins/gulp-menugen.js b/gulp/plugins/gulp-menugen.js index 4c9047a48e..ffce18d86d 100644 --- a/gulp/plugins/gulp-menugen.js +++ b/gulp/plugins/gulp-menugen.js @@ -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, @@ -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) diff --git a/gulp/plugins/gulp-react-docgen.js b/gulp/plugins/gulp-react-docgen.js index 68f2202eb2..6f96e94721 100644 --- a/gulp/plugins/gulp-react-docgen.js +++ b/gulp/plugins/gulp-react-docgen.js @@ -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