File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
packages/cli/src/commands Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -75,11 +75,12 @@ export function registerInitCommand(cli) {
7575 gitignoreContent = fs . readFileSync ( gitignorePath , 'utf-8' ) ;
7676 }
7777
78- // Check if the entry already exists
79- if ( ! gitignoreContent . includes ( gitignoreEntry ) ) {
78+ // Check if the entry already exists (as a complete line)
79+ const lines = gitignoreContent . split ( '\n' ) . map ( line => line . trim ( ) ) ;
80+ if ( ! lines . includes ( gitignoreEntry ) ) {
8081 // Add the entry with a comment
8182 const separator = gitignoreContent . trim ( ) ? '\n\n' : '' ;
82- const newContent = gitignoreContent . trim ( ) + separator + ' # ObjectDocs\n' + gitignoreEntry + '\n' ;
83+ const newContent = ` ${ gitignoreContent . trim ( ) } ${ separator } # ObjectDocs\n${ gitignoreEntry } \n` ;
8384 fs . writeFileSync ( gitignorePath , newContent ) ;
8485 console . log ( '📝 Added content/.objectdocs to .gitignore\n' ) ;
8586 }
You can’t perform that action at this time.
0 commit comments