File tree 5 files changed +41
-12
lines changed
5 files changed +41
-12
lines changed Original file line number Diff line number Diff line change @@ -68,13 +68,19 @@ To configure your project manually, follow these steps:
68
68
]
69
69
```
70
70
71
- 1 . Add the output directory to ` .gitignore `
71
+ 1 . Add the output directory to ` .gitignore ` and ` .eslintignore `
72
72
73
73
``` gitignore
74
74
# generated files by bob
75
75
lib/
76
76
```
77
77
78
+ 1 . Add the output directory to ` jest.modulePathIgnorePatterns ` if you use [ Jest] ( https://jestjs.io )
79
+
80
+ ``` json
81
+ "modulePathIgnorePatterns" : [" <rootDir>/lib/" ]
82
+ ```
83
+
78
84
And we're done 🎉
79
85
80
86
## LICENSE
Original file line number Diff line number Diff line change @@ -192,18 +192,37 @@ yargs
192
192
} ) ,
193
193
} ;
194
194
195
+ if ( pkg . jest ) {
196
+ const entry = `<rootDir>/${ output } /` ;
197
+
198
+ if ( pkg . jest . modulePathIgnorePatterns ) {
199
+ const { modulePathIgnorePatterns } = pkg . jest ;
200
+
201
+ if ( ! modulePathIgnorePatterns . includes ( entry ) ) {
202
+ modulePathIgnorePatterns . push ( entry ) ;
203
+ }
204
+ } else {
205
+ pkg . jest . modulePathIgnorePatterns = [ entry ] ;
206
+ }
207
+ }
208
+
195
209
await fs . writeFile ( pak , JSON . stringify ( pkg , null , 2 ) ) ;
196
210
197
- const gitignore = path . join ( root , '.gitignore' ) ;
211
+ const ignorefiles = [
212
+ path . join ( root , '.gitignore' ) ,
213
+ path . join ( root , '.eslintignore' ) ,
214
+ ] ;
198
215
199
- if ( await fs . pathExists ( gitignore ) ) {
200
- const content = await fs . readFile ( gitignore , 'utf-8' ) ;
216
+ for ( const ignorefile of ignorefiles ) {
217
+ if ( await fs . pathExists ( ignorefile ) ) {
218
+ const content = await fs . readFile ( ignorefile , 'utf-8' ) ;
201
219
202
- if ( ! content . split ( '\n' ) . includes ( `${ output } /` ) ) {
203
- await fs . writeFile (
204
- gitignore ,
205
- `${ content } \n# generated by bob\n${ output } /\n`
206
- ) ;
220
+ if ( ! content . split ( '\n' ) . includes ( `${ output } /` ) ) {
221
+ await fs . writeFile (
222
+ ignorefile ,
223
+ `${ content } \n# generated by bob\n${ output } /\n`
224
+ ) ;
225
+ }
207
226
}
208
227
}
209
228
Original file line number Diff line number Diff line change
1
+ import path from 'path' ;
2
+ import chalk from 'chalk' ;
1
3
import del from 'del' ;
2
4
import compile from '../utils/compile' ;
3
5
import { Input } from '../types' ;
@@ -13,7 +15,7 @@ export default async function build({
13
15
options,
14
16
report
15
17
} : Options ) {
16
- report . info ( ' Cleaning up previous build' ) ;
18
+ report . info ( ` Cleaning up previous build at ${ chalk . blue ( path . relative ( root , output ) ) } ` ) ;
17
19
18
20
await del ( [ output ] ) ;
19
21
Original file line number Diff line number Diff line change
1
+ import path from 'path' ;
2
+ import chalk from 'chalk' ;
1
3
import del from 'del' ;
2
4
import compile from '../utils/compile' ;
3
5
import { Input } from '../types' ;
@@ -13,7 +15,7 @@ export default async function build({
13
15
options,
14
16
report
15
17
} : Options ) {
16
- report . info ( ' Cleaning up previous build' ) ;
18
+ report . info ( ` Cleaning up previous build at ${ chalk . blue ( path . relative ( root , output ) ) } ` ) ;
17
19
18
20
await del ( [ output ] ) ;
19
21
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import del from 'del';
6
6
import { Input } from '../types' ;
7
7
8
8
export default async function build ( { root, output, report } : Input ) {
9
- report . info ( ' Cleaning up previous build' ) ;
9
+ report . info ( ` Cleaning up previous build at ${ chalk . blue ( path . relative ( root , output ) ) } ` ) ;
10
10
11
11
await del ( [ output ] ) ;
12
12
You can’t perform that action at this time.
0 commit comments