Skip to content

Commit 59cdbf1

Browse files
committed
refactor: code refactor
1 parent 13af1fc commit 59cdbf1

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ const getPlugins = config => Object.keys(config.plugins || {})
8080
const config = cfgResolve(cli);
8181

8282
const processing = async file => {
83-
const output = await outResolve(file, config.output, config.root, config.allInOutput);
83+
const output = await outResolve(file, config);
8484
const plugins = Array.isArray(config.plugins) ? config.plugins : getPlugins(config);
8585

8686
makeDir(path.dirname(output))

src/out-resolve.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
import path from 'path';
22

3-
export default (input, output, root, allInOutput) => new Promise(resolve => {
3+
export default (input, {output, root, allInOutput}) => new Promise(resolve => {
44
if (output && path.extname(output)) {
55
return resolve(output);
66
}
77

88
if (output) {
9-
const inputPath = allInOutput ? path.relative(root, input) : path.basename(input);
9+
let inputPath = path.basename(input);
10+
11+
if (allInOutput) {
12+
inputPath = path.relative(root, input);
13+
}
1014
return resolve(path.join(output, inputPath));
1115
}
1216

0 commit comments

Comments
 (0)