File tree Expand file tree Collapse file tree 5 files changed +41
-12
lines changed Expand file tree Collapse file tree 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:
6868 ]
6969 ```
7070
71- 1 . Add the output directory to ` .gitignore `
71+ 1 . Add the output directory to ` .gitignore ` and ` .eslintignore `
7272
7373 ``` gitignore
7474 # generated files by bob
7575 lib/
7676 ```
7777
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+
7884And we're done 🎉
7985
8086## LICENSE
Original file line number Diff line number Diff line change @@ -192,18 +192,37 @@ yargs
192192 } ) ,
193193 } ;
194194
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+
195209 await fs . writeFile ( pak , JSON . stringify ( pkg , null , 2 ) ) ;
196210
197- const gitignore = path . join ( root , '.gitignore' ) ;
211+ const ignorefiles = [
212+ path . join ( root , '.gitignore' ) ,
213+ path . join ( root , '.eslintignore' ) ,
214+ ] ;
198215
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' ) ;
201219
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+ }
207226 }
208227 }
209228
Original file line number Diff line number Diff line change 1+ import path from 'path' ;
2+ import chalk from 'chalk' ;
13import del from 'del' ;
24import compile from '../utils/compile' ;
35import { Input } from '../types' ;
@@ -13,7 +15,7 @@ export default async function build({
1315 options,
1416 report
1517} : Options ) {
16- report . info ( ' Cleaning up previous build' ) ;
18+ report . info ( ` Cleaning up previous build at ${ chalk . blue ( path . relative ( root , output ) ) } ` ) ;
1719
1820 await del ( [ output ] ) ;
1921
Original file line number Diff line number Diff line change 1+ import path from 'path' ;
2+ import chalk from 'chalk' ;
13import del from 'del' ;
24import compile from '../utils/compile' ;
35import { Input } from '../types' ;
@@ -13,7 +15,7 @@ export default async function build({
1315 options,
1416 report
1517} : Options ) {
16- report . info ( ' Cleaning up previous build' ) ;
18+ report . info ( ` Cleaning up previous build at ${ chalk . blue ( path . relative ( root , output ) ) } ` ) ;
1719
1820 await del ( [ output ] ) ;
1921
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import del from 'del';
66import { Input } from '../types' ;
77
88export 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 ) ) } ` ) ;
1010
1111 await del ( [ output ] ) ;
1212
You can’t perform that action at this time.
0 commit comments