天天看点

Angular 项目工程文件结构介绍

https://angular.io/guide/file-structure

You develop applications in the context of an Angular workspace.

Angular 应用开发人员在 Angular workspace(工作空间)的上下文里进行应用开发。

A workspace contains the files for one or more projects.

一个工作空间包含若干文件,这些文件属于一个或多个 projects.

A project is the set of files that comprise a standalone application or a shareable library.

所谓 project,就是一系列文件的集合,组成了一个能够单独运行的应用,或是一个可重用的库。

ng new 创建一个新的 workspace.

Workspace 里所有 project,共享同一个 CLI configuration context.

All projects within a workspace share a CLI configuration context.

Workspace 根目录下的 angular.json 文件,提供了 workspace 级别和 project 特定的配置信息,用于 Angular CLI build 和 development 工具使用。

A file named angular.json at the root level of an Angular workspace provides workspace-wide and project-specific configuration defaults for build and development tools provided by the Angular CLI.

Path values given in the configuration are relative to the root workspace folder.

angular.json 里的 Path value 均为基于 root workspace 的相对路径。

package-lock.json: Provides version information for all packages installed into node_modules by the npm client. See npm documentation for details. If you use the yarn client, this file will be yarn.lock instead.

包含使用 npm 客户端安装到 node_modules 里的所有包的版本信息。

node_modules/:Provides npm packages to the entire workspace. Workspace-wide node_modules dependencies are visible to all projects.

Workspace 级别的依赖包,对所有 projects 均可见。

tsconfig.json:TypeScript 相关配置信息。

Angular 项目工程文件结构介绍

For a single-application workspace, the src/ subfolder of the workspace contains the source files (application logic, data, and assets) for the root application. For a multi-project workspace, additional projects in the projects/ folder contain a project-name/src/ subfolder with the same structure.

SAP Spartacus 属于 multi-project workspace,project 文件夹下有 sub 文件夹。

Angular 项目工程文件结构介绍
Angular 项目工程文件结构介绍

继续阅读