File tree 1 file changed +13
-10
lines changed
1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -333,8 +333,6 @@ try {
333
333
// Swallow error if jsconfig.json file does not exist
334
334
}
335
335
336
- console . log ( 'Updating .gitignore...' ) ;
337
-
338
336
const gitignorePath = join ( process . cwd ( ) , '.gitignore' ) ;
339
337
340
338
/** @type {string[] } */
@@ -346,22 +344,27 @@ try {
346
344
// Swallow error in case .gitignore doesn't exist yet
347
345
}
348
346
347
+ let gitignoreChanged = false ;
348
+
349
349
for ( const ignorePath of [ '.eslintcache' , '*.tsbuildinfo' ] ) {
350
350
if ( gitignoreContentLines . includes ( ignorePath ) ) {
351
351
continue ;
352
352
}
353
353
354
354
gitignoreContentLines . push ( ignorePath ) ;
355
+ gitignoreChanged = true ;
355
356
}
356
357
357
- writeFileSync (
358
- gitignorePath ,
359
- gitignoreContentLines . join ( '\n' ) +
360
- // Add trailing newline if last line is not empty
361
- ( gitignoreContentLines . at ( - 1 ) === '' ? '' : '\n' ) ,
362
- ) ;
363
-
364
- console . log ( '✅ Done updating .gitignore' ) ;
358
+ if ( gitignoreChanged ) {
359
+ console . log ( 'Updating .gitignore...' ) ;
360
+ writeFileSync (
361
+ gitignorePath ,
362
+ gitignoreContentLines . join ( '\n' ) +
363
+ // Add trailing newline if last line is not empty
364
+ ( gitignoreContentLines . at ( - 1 ) === '' ? '' : '\n' ) ,
365
+ ) ;
366
+ console . log ( '✅ Done updating .gitignore' ) ;
367
+ }
365
368
366
369
const npmrcPath = join ( process . cwd ( ) , '.npmrc' ) ;
367
370
You can’t perform that action at this time.
0 commit comments