Fixed the searching on the whole disk :-P
This commit is contained in:
parent
930baeb92a
commit
e04dfff858
|
@ -10,7 +10,7 @@ const mode = process.argv[2] || 'check';
|
||||||
const shouldSave = mode === 'save' || mode === 'save-all';
|
const shouldSave = mode === 'save' || mode === 'save-all';
|
||||||
const allFiles = mode === 'check-all' || mode === 'save-all';
|
const allFiles = mode === 'check-all' || mode === 'save-all';
|
||||||
let dirPath = process.argv[3] || '';
|
let dirPath = process.argv[3] || '';
|
||||||
if (dirPath.charAt(dirPath.length-1) !== '/') dirPath += '/';
|
if (dirPath && dirPath.charAt(dirPath.length - 1) !== '/') dirPath += '/';
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
patterns: ['**/*.js', '**/*.vue', '**/*.scss'],
|
patterns: ['**/*.js', '**/*.vue', '**/*.scss'],
|
||||||
|
@ -43,7 +43,8 @@ const availableExtensions = Object.keys(config.parsers);
|
||||||
|
|
||||||
console.log(`Loading ${allFiles ? 'All' : 'Selected'} Files ...`);
|
console.log(`Loading ${allFiles ? 'All' : 'Selected'} Files ...`);
|
||||||
|
|
||||||
const stagedFiles = allFiles || dirPath ? null : getStagedFiles(availableExtensions.map(ext => `*.${ext}`));
|
const stagedFiles =
|
||||||
|
allFiles || dirPath ? null : getStagedFiles(availableExtensions.map(ext => `*.${ext}`));
|
||||||
|
|
||||||
if (stagedFiles) {
|
if (stagedFiles) {
|
||||||
if (!stagedFiles.length || (stagedFiles.length === 1 && !stagedFiles[0])) {
|
if (!stagedFiles.length || (stagedFiles.length === 1 && !stagedFiles[0])) {
|
||||||
|
@ -64,7 +65,9 @@ if (allFiles) {
|
||||||
files = glob.sync(globPattern, { ignore }).filter(f => allFiles || stagedFiles.includes(f));
|
files = glob.sync(globPattern, { ignore }).filter(f => allFiles || stagedFiles.includes(f));
|
||||||
} else if (dirPath) {
|
} else if (dirPath) {
|
||||||
const ignore = config.ignore;
|
const ignore = config.ignore;
|
||||||
const patterns = config.patterns.map((item) => {return dirPath + item;});
|
const patterns = config.patterns.map(item => {
|
||||||
|
return dirPath + item;
|
||||||
|
});
|
||||||
const globPattern = patterns.length > 1 ? `{${patterns.join(',')}}` : `${patterns.join(',')}`;
|
const globPattern = patterns.length > 1 ? `{${patterns.join(',')}}` : `${patterns.join(',')}`;
|
||||||
files = glob.sync(globPattern, { ignore });
|
files = glob.sync(globPattern, { ignore });
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue