angular / angular/angular-cli

Generate projects with `engine-strict` by default

未關閉
#31,271 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
area: @schematics/angular feature
主要語言
TypeScript
星號
27k
分支
11.8k
平均合併
14 小時 23 分鐘
30 天內合併 PR
162

描述

### Command

new

### Description

It is quite easy to install a package incompatible with the current Node runtime. NPM only emits a warning by default which is easily overlooked. Once the package is installed, running it may result in unpredictable behavior, or might even work in the short term and then suddenly fail seemingly randomly in the future due to unrelated updates or changes to executed code paths which suddenly become incompatible with the currently installed Node version.

### Describe the solution you'd like

New projects should generate an `.npmrc` with `engine-strict=true` by default when using NPM as the package manager.

https://docs.npmjs.com/cli/v11/using-npm/config#engine-strict

This opts-in to a stricter environment which emits a hard error when installing a package incompatible with the current Node environment.

Yarn and pnpm already use the strict behavior by default, so this aligns with the broader direction of the package manager ecosystem.

Spin off from https://github.com/angular/angular-cli/issues/30547.

貢獻指南

開啟貢獻指南

研究方向

從 `new` 命令開始,追蹤產生的專案檔案如何因套件管理器而異,重點關注所要求的 `.npmrc` 輸出。確認使用 NPM 的新專案會產生包含 `engine-strict=true` 的 `.npmrc`,而其他套件管理器維持不變,並透過相關的產生測試驗證此行為。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
node.js, typescript
領域
cli
Issue 類型
功能
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。