Skip to content

Commit cbe615e

Browse files
committed
test: rename base to root
1 parent 279ad8b commit cbe615e

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ $ posthtml --help
2626
--output -o Output File or Folder
2727
--config -c Path to config file
2828
--use -u PostHTML plugin name
29-
--base -b Mirror the directory structure relative to this path in the output directory
29+
--root -r Mirror the directory structure relative to this path in the output directory
3030
--help -h CLI Help
3131
--version -v CLI Version
3232

src/cfg-resolve.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import mergeOptions from 'merge-options';
44

55
export default ({input, flags = {}}) => {
66
const explorer = cosmiconfigSync('posthtml');
7-
let {config, use, output, base} = flags;
7+
let {config, use, output, root} = flags;
88

99
if (config) {
1010
({config} = explorer.load(config));
@@ -21,6 +21,6 @@ export default ({input, flags = {}}) => {
2121
return mergeOptions({
2222
input,
2323
output,
24-
base
24+
root
2525
}, use || {}, config || {});
2626
};

src/cli.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const cli = meow(`
1616
--output -o Output File or Folder
1717
--config -c Path to config file
1818
--use -u PostHTML plugin name
19-
--base -b Mirror the directory structure relative to this path in the output directory
19+
--root -r Mirror the directory structure relative to this path in the output directory
2020
--help -h CLI Help
2121
--version -v CLI Version
2222
@@ -28,7 +28,7 @@ const cli = meow(`
2828
$ posthtml input.html -o output.html -u posthtml-bem --posthtml-bem.elemPrefix __
2929
$ posthtml inputFolder/*.html -o outputFolder
3030
$ posthtml inputFolder/**/*.html -o outputFolder
31-
$ posthtml inputFolder/**/*.html -o outputFolder -b inputFolder
31+
$ posthtml inputFolder/**/*.html -o outputFolder -r inputFolder
3232
`, {
3333
flags: {
3434
config: {
@@ -51,9 +51,9 @@ const cli = meow(`
5151
type: 'array',
5252
alias: 'u'
5353
},
54-
base: {
54+
root: {
5555
type: 'string',
56-
alias: 'b'
56+
alias: 'r'
5757
}
5858
}
5959
});
@@ -74,7 +74,7 @@ const getPlugins = config => Object.keys(config.plugins || {})
7474
const config = cfgResolve(cli);
7575

7676
const processing = async file => {
77-
const output = await outResolve(file, config.output, config.base);
77+
const output = await outResolve(file, config.output, config.root);
7878
const plugins = Array.isArray(config.plugins) ? config.plugins : getPlugins(config);
7979

8080
makeDir(path.dirname(output))

src/out-resolve.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import path from 'path';
22

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

88
if (output) {
9-
const basePath = base ? path.resolve(input).replace(path.resolve(base), '') : path.basename(input);
10-
return resolve(path.join(output, basePath));
9+
const rootPath = root ? path.resolve(input).replace(path.resolve(root), '') : path.basename(input);
10+
return resolve(path.join(output, rootPath));
1111
}
1212

1313
resolve(input);

0 commit comments

Comments
 (0)