Skip to content

Commit

Permalink
make --out-dir generate correct dir path with absolute path
Browse files Browse the repository at this point in the history
  • Loading branch information
reeli committed Oct 15, 2018
1 parent 514d43d commit f221170
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/cli/src/dirCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import outputFileSync from 'output-file-sync'
import readdir from 'recursive-readdir'
import camelcase from 'camelcase'
import dashify from 'dashify'
import { stat, convertFile } from './util'
import { convertFile, stat } from './util'

const CASE = {
KEBAB: 'kebab', // kebab-case
Expand Down Expand Up @@ -50,7 +50,10 @@ async function dirCommand(
if (!isCompilable(relative)) return false
relative = rename(relative, ext, filenameCase)

const dest = path.join(program.outDir, relative)
const dest = program.outDir.startsWith('/')
? path.resolve(program.outDir, relative)
: path.join(program.outDir, relative)

const code = await convertFile(src, options)

outputFileSync(dest, code)
Expand Down

0 comments on commit f221170

Please sign in to comment.