@@ -15,6 +15,11 @@ export class AppUtils implements AppUtilsInterface {
1515 '.env' ,
1616 ) ;
1717
18+ public readonly ignoreFilePath = path . resolve (
19+ this . projectConfigDirectory ,
20+ '.commitfyignore' ,
21+ ) ;
22+
1823 public readonly logger : AppUtilsInterface [ 'logger' ] = {
1924 error : ( message , ...params ) =>
2025 console . error ( `${ this . name } :` , message , ...params ) ,
@@ -29,6 +34,14 @@ export class AppUtils implements AppUtilsInterface {
2934 if ( ! fs . existsSync ( this . projectConfigDirectory ) ) {
3035 fs . mkdirSync ( this . projectConfigDirectory ) ;
3136 }
37+
38+ if ( ! fs . existsSync ( this . ignoreFilePath ) ) {
39+ fs . writeFileSync (
40+ this . ignoreFilePath ,
41+ [ 'package-lock.json' , 'yarn.lock' , 'node_modules' ] . join ( '\n' ) ,
42+ 'utf-8' ,
43+ ) ;
44+ }
3245 }
3346
3447 public get name ( ) {
@@ -39,6 +52,20 @@ export class AppUtils implements AppUtilsInterface {
3952 return this . packageJson . version ;
4053 }
4154
55+ public get ignoreFiles ( ) : string [ ] {
56+ if ( fs . existsSync ( '.commitfyignore' ) ) {
57+ return fs
58+ . readFileSync ( '.commitfyignore' , 'utf-8' )
59+ . split ( '\n' )
60+ . filter ( ( line ) => line . trim ( ) !== '' ) ;
61+ }
62+
63+ return fs
64+ . readFileSync ( this . ignoreFilePath , 'utf-8' )
65+ . split ( '\n' )
66+ . filter ( ( line ) => line . trim ( ) !== '' ) ;
67+ }
68+
4269 private get packageJson ( ) : { version : string ; name : string } {
4370 return JSON . parse ( fs . readFileSync ( PACKAGE_JSON_PATH , 'utf-8' ) ) ;
4471 }
0 commit comments