From f2211707f6a86476379e4139603443415ea79186 Mon Sep 17 00:00:00 2001 From: reeli Date: Mon, 15 Oct 2018 21:45:45 +0800 Subject: [PATCH] make --out-dir generate correct dir path with absolute path --- packages/cli/src/dirCommand.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/dirCommand.js b/packages/cli/src/dirCommand.js index ef0f6483..ae10f36b 100644 --- a/packages/cli/src/dirCommand.js +++ b/packages/cli/src/dirCommand.js @@ -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 @@ -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)