md-hopper 1.0.0-alpha.2 → 1.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_internal/types/settings.d.ts +1 -0
- package/dist/_internal/utils/log.js +1 -1
- package/dist/_internal/utils/path.d.ts +1 -0
- package/dist/_internal/utils/path.js +1 -0
- package/dist/_internal/utils/settings.js +1 -0
- package/dist/cli/commands/generate/action.js +7 -4
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ export const warn = (...args) => {
|
|
|
6
6
|
console.log(chalk.hex('#FFA500')(...args));
|
|
7
7
|
};
|
|
8
8
|
export const info = (...args) => {
|
|
9
|
-
console.log(chalk.
|
|
9
|
+
console.log(chalk.hex('#77CFF5')(...args));
|
|
10
10
|
};
|
|
11
11
|
export const error = (...args) => {
|
|
12
12
|
console.log(chalk.red(...args));
|
|
@@ -3,7 +3,7 @@ import { join } from 'path';
|
|
|
3
3
|
import { getAllFiles } from '../../../_internal/utils/fs.js';
|
|
4
4
|
import { info, warn, success } from '../../../_internal/utils/log.js';
|
|
5
5
|
import { getParam, getTitle, replace } from '../../../_internal/utils/md.js';
|
|
6
|
-
import { getExecDir } from '../../../_internal/utils/path.js';
|
|
6
|
+
import { getExecDir, getParseDirPath } from '../../../_internal/utils/path.js';
|
|
7
7
|
import { getDir, getDepthType, DEPTH_TYPES } from '../../../_internal/utils/path.js';
|
|
8
8
|
const replacePath = (str) => str.replace(/\/{2,}/, '/');
|
|
9
9
|
const splitComma = (str, alternative) => (str ? str.split(',') : null) || alternative;
|
|
@@ -13,6 +13,7 @@ const mergeConfig = ({ options, settings }) => {
|
|
|
13
13
|
exclude: splitComma(options.exclude, settings.exclude),
|
|
14
14
|
include: splitComma(options.include, settings.include),
|
|
15
15
|
filenames: splitComma(options.filenames, settings.filenames),
|
|
16
|
+
input: getParseDirPath(options.input || '.'),
|
|
16
17
|
output: options.output || settings.output,
|
|
17
18
|
depth: Number(options.depth) || settings.depth,
|
|
18
19
|
};
|
|
@@ -80,17 +81,19 @@ export const action = async (args) => {
|
|
|
80
81
|
info('exec dir path', execDir);
|
|
81
82
|
const config = mergeConfig(args);
|
|
82
83
|
info('settings', JSON.stringify(config, null, 2));
|
|
84
|
+
const targetDir = join(execDir, config.input);
|
|
85
|
+
info('target dir', targetDir);
|
|
83
86
|
const skipHidden = config['skip-hidden'] ? ['**/.*/**/*', '**/.*'] : [];
|
|
84
87
|
const exclude = [
|
|
85
88
|
'**/node_modules/.*/*',
|
|
86
89
|
'**/node_modules/**/*',
|
|
87
90
|
...skipHidden,
|
|
88
|
-
...config.exclude.map(path => replacePath(
|
|
91
|
+
...config.exclude.map(path => replacePath(join(targetDir, path))),
|
|
89
92
|
];
|
|
90
93
|
info('exclude', JSON.stringify(exclude, null, 2));
|
|
91
|
-
const include = config.include.map(path => replacePath(
|
|
94
|
+
const include = config.include.map(path => replacePath(join(targetDir, path)));
|
|
92
95
|
info('include', JSON.stringify(include, null, 2));
|
|
93
|
-
const paths = getAllFiles(
|
|
96
|
+
const paths = getAllFiles(targetDir, {
|
|
94
97
|
include,
|
|
95
98
|
exclude,
|
|
96
99
|
...(config.depth >= 1 ? { depth: config.depth } : {}),
|