用途:Angular CLI 是 Angular 项目的命令行工具,用于脚手架生成代码、构建应用以及管理 workspace 配置。
主要能力与用法:使用生成器创建代码,如 ng g c components/my-component、ng g s services/my-service、ng g g guards/auth、ng g interceptor timing、ng g library my-lib,并可用 --standalone 生成独立组件。迁移通过原理图完成,例如 ng g @angular/core:control-flow 迁移 @if/@for,ng g @angular/core:signal-input-migration 迁移信号输入,ng g @angular/core:route-lazy-loading 迁移路由懒加载。新增依赖可用 ng add @angular/material、ng add @angular/ssr、ng add @angular/pwa。构建与运行使用 ng build --configuration=production、ng build --stats-json,以及 ng run my-app:build、ng run my-app:serve-ssr、ng run my-app:prerender。配置管理可用 ng config defaults.style=scss、ng analytics enable;升级用 ng update 或 ng update @angular/core。
版本要点:新增 Control flow migration、Signal input migration、Route lazy loading migration、命名 workspace(单个 angular.json 配置多个应用),并默认使用 esbuild(配合 Vite 构建更快)。
限制:资料未提供安装命令、版本兼容范围、收费或许可信息,也未说明具体平台要求;上述命令与配置均按资料原文保留,使用前请自行核对。