File tree Expand file tree Collapse file tree 3 files changed +10
-71
lines changed Expand file tree Collapse file tree 3 files changed +10
-71
lines changed Original file line number Diff line number Diff line change @@ -15,20 +15,17 @@ import parseCmdArgs from 'parse-cmd-args';
15
15
import doxdox , {
16
16
findFileInPath ,
17
17
findParentNodeModules ,
18
- getIgnoreConfigInPath ,
18
+ getProjectPackage ,
19
19
getRootDirPath ,
20
- parseIgnoreConfig ,
21
20
loadPlugin ,
22
- sanitizePath ,
23
- getProjectPackage
21
+ parseIgnoreConfig ,
22
+ sanitizePath
24
23
} from 'doxdox-core' ;
25
24
26
25
import { Doc , File } from 'doxdox-core' ;
27
26
28
27
const defaultPaths = [ '**/*.js' ] ;
29
28
30
- const defaultIgnorePatterns = [ '!node_modules/' ] ;
31
-
32
29
const helpDocs = `Usage: doxdox <path> ... [options]
33
30
34
31
Options:
@@ -92,13 +89,13 @@ const overridePackage = args.flags['-p'] || args.flags['--package'];
92
89
}
93
90
94
91
const paths = await globby (
95
- ( args . input ? [ args . input ] : defaultPaths ) . concat ( [
96
- ...defaultIgnorePatterns ,
97
- ...parseIgnoreConfig ( overrideIgnore . split ( ',' ) . join ( EOL ) ) ,
98
- ...( await getIgnoreConfigInPath ( cwd ) )
99
- ] ) ,
92
+ ( args . input ? [ args . input ] : defaultPaths ) . concat (
93
+ parseIgnoreConfig ( overrideIgnore . split ( ',' ) . join ( EOL ) )
94
+ ) ,
100
95
{
101
- cwd
96
+ cwd,
97
+ ignoreFiles : [ '.doxdoxignore' ] ,
98
+ gitignore : true
102
99
}
103
100
) ;
104
101
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ import { join } from 'path';
7
7
import {
8
8
findFileInPath ,
9
9
findParentNodeModules ,
10
- getIgnoreConfigInPath ,
11
10
getProjectPackage ,
12
11
getRootDirPath ,
13
12
isDirectory ,
@@ -57,35 +56,6 @@ describe('utils', () => {
57
56
} ) ;
58
57
} ) ;
59
58
60
- describe ( 'getIgnoreConfigInPath' , ( ) => {
61
- it ( 'find ignore config with input directory' , async ( ) => {
62
- assert . deepEqual ( await getIgnoreConfigInPath ( './' ) , [
63
- '!**/*.test.*' ,
64
- '!./coverage/' ,
65
- '!./dist/'
66
- ] ) ;
67
- } ) ;
68
-
69
- it ( 'find ignore config with input file' , async ( ) => {
70
- assert . deepEqual ( await getIgnoreConfigInPath ( './.doxdoxignore' ) , [
71
- '!**/*.test.*' ,
72
- '!./coverage/' ,
73
- '!./dist/'
74
- ] ) ;
75
- } ) ;
76
-
77
- it ( 'fail to find ignore config with input non .doxdoxignore file' , async ( ) => {
78
- assert . deepEqual (
79
- await getIgnoreConfigInPath ( './jest.config.js' ) ,
80
- [ ]
81
- ) ;
82
- } ) ;
83
-
84
- it ( 'fail to find ignore config with invalid directory' , async ( ) => {
85
- assert . deepEqual ( await getIgnoreConfigInPath ( '../testing' ) , [ ] ) ;
86
- } ) ;
87
- } ) ;
88
-
89
59
describe ( 'getProjectPackage' , ( ) => {
90
60
it ( 'gets contents from project package' , async ( ) => {
91
61
const { name, description, version, exports } = JSON . parse (
Original file line number Diff line number Diff line change @@ -76,32 +76,6 @@ export const findParentNodeModules = async (
76
76
return null ;
77
77
} ;
78
78
79
- /**
80
- * Return list of ignored paths and files.
81
- *
82
- * console.log(await getIgnoreConfigInPath('./'));
83
- * console.log(await getIgnoreConfigInPath('./.doxdoxignore'));
84
- * console.log(await getIgnoreConfigInPath('~/git/github/doxdox/'));
85
- *
86
- * @param {string } [input] Directory to check for ignore config file.
87
- * @return {Promise<string[]> } List of ignored paths and files.
88
- * @public
89
- */
90
-
91
- export const getIgnoreConfigInPath = async (
92
- input : string
93
- ) : Promise < string [ ] > => {
94
- const ignorePath = await findFileInPath ( input , '.doxdoxignore' ) ;
95
-
96
- if ( ignorePath ) {
97
- const ignoreContents = await fs . readFile ( ignorePath , 'utf8' ) ;
98
-
99
- return parseIgnoreConfig ( ignoreContents ) ;
100
- }
101
-
102
- return [ ] ;
103
- } ;
104
-
105
79
/**
106
80
* Returns basic information from a projects package file.
107
81
*
@@ -169,9 +143,7 @@ export const isFile = async (path: string): Promise<boolean> => {
169
143
/**
170
144
* Parse contents of ignore file.
171
145
*
172
- * console.log(await parseIgnoreConfig('./'));
173
- * console.log(await getIgnoreConfigInPath('./.doxdoxignore'));
174
- * console.log(await getIgnoreConfigInPath('~/git/github/doxdox/'));
146
+ * console.log(await parseIgnoreConfig('node_modules/'));
175
147
*
176
148
* @param {string } [contents] Contents of ignore file.
177
149
* @return {string[] } List of ignored paths and files.
You can’t perform that action at this time.
0 commit comments