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 摘要。