File tree 1 file changed +25
-0
lines changed
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -363,6 +363,31 @@ writeFileSync(
363
363
364
364
console . log ( '✅ Done updating .gitignore' ) ;
365
365
366
+ const npmrcPath = join ( process . cwd ( ) , '.npmrc' ) ;
367
+
368
+ /** @type {string[] } */
369
+ let npmrcContentLines = [ ] ;
370
+
371
+ try {
372
+ npmrcContentLines = readFileSync ( npmrcPath , 'utf-8' ) . split ( '\n' ) ;
373
+ } catch {
374
+ // Swallow error in case .npmrc doesn't exist yet
375
+ }
376
+
377
+ if ( ! npmrcContentLines . includes ( 'strict-dep-builds=true' ) ) {
378
+ console . log ( 'Updating .npmrc...' ) ;
379
+ npmrcContentLines . push ( `# Fail on pnpm ignored build scripts
380
+ # - https://github.com/pnpm/pnpm/pull/9071
381
+ strict-dep-builds=true` ) ;
382
+ writeFileSync (
383
+ npmrcPath ,
384
+ npmrcContentLines . join ( '\n' ) +
385
+ // Add trailing newline if last line is not empty
386
+ ( npmrcContentLines . at ( - 1 ) === '' ? '' : '\n' ) ,
387
+ ) ;
388
+ console . log ( '✅ Done updating .npmrc' ) ;
389
+ }
390
+
366
391
// Commented out in case we need to patch Next.js again in the
367
392
// future
368
393
// ```
You can’t perform that action at this time.
0 commit comments