pocotan001 / react-styleguide-generator

Easily generate a good-looking styleguide by adding some documentation to your React project.
http://pocotan001.github.io/react-styleguide-generator
MIT License
700 stars 76 forks source link

Bugfix: Windows support #16

Closed texttechne closed 9 years ago

texttechne commented 9 years ago

On Windows machines the generator fails badly.

Main Problem

Path problems in lib/rsg.js (l. 279-284):

var data = this.input.map(function (file) {
  self.log.debug({ file: file }, 'styleguide input file')
  return "require('" + file + "')"
})

data = 'module.exports = [' + data.join(',') + ']'

Joining the array results in wrong escaping of windows path (C:\tmp\xyz becomes C:\tmp\xyz). Using slash solves this issue.

Fixing the example project

The example won't work since no styleguide components are found due to this command in package.json: rsg 'components/**/*.js'. The offending part for windows are the single quotes around components/**/*.js. Leaving them out or using double quotes solves this issue.

pocotan001 commented 9 years ago

@texttechne Thanks for the PR!