Skip to content
This repository has been archived by the owner on Apr 21, 2022. It is now read-only.

Commit

Permalink
fix(readme): windows readme generation
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Jun 21, 2018
1 parent a375dfd commit 98576ab
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/commands/readme.ts
Expand Up @@ -190,14 +190,15 @@ USAGE
let commandsDir = plugin.pjson.oclif.commands
if (!commandsDir) return
let p = path.join(plugin.root, commandsDir, ...c.id.split(':'))
const libRegex = new RegExp('^lib' + (path.sep === '\\' ? '\\\\' : path.sep))
if (fs.pathExistsSync(path.join(p, 'index.js'))) {
p = path.join(p, 'index.js')
} else if (fs.pathExistsSync(p + '.js')) {
p = p + '.js'
} else if (plugin.pjson.devDependencies.typescript) {
// check if non-compiled scripts are available
let base = p.replace(plugin.root + path.sep, '')
p = path.join(plugin.root, base.replace(new RegExp('^lib' + path.sep), 'src' + path.sep))
p = path.join(plugin.root, base.replace(libRegex, 'src' + path.sep))
if (fs.pathExistsSync(path.join(p, 'index.ts'))) {
p = path.join(p, 'index.ts')
} else if (fs.pathExistsSync(p + '.ts')) {
Expand All @@ -207,7 +208,7 @@ USAGE
} else return
p = p.replace(plugin.root + path.sep, '')
if (plugin.pjson.devDependencies.typescript) {
p = p.replace(new RegExp('^lib' + path.sep), 'src' + path.sep)
p = p.replace(libRegex, 'src' + path.sep)
p = p.replace(/\.js$/, '.ts')
}
return p
Expand Down

0 comments on commit 98576ab

Please sign in to comment.