From d38bdab721457e76f98a994846b2fe3a102cc0bb Mon Sep 17 00:00:00 2001 From: Zhicheng Wang Date: Fri, 26 Oct 2018 21:55:07 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E7=BF=BB=E8=AF=91=E5=AE=8C=E4=BA=86?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aio/content/guide/file-structure.md | 113 ++++++++++++++++++++-------- 1 file changed, 81 insertions(+), 32 deletions(-) diff --git a/aio/content/guide/file-structure.md b/aio/content/guide/file-structure.md index 8398ca491b..945f650dbc 100644 --- a/aio/content/guide/file-structure.md +++ b/aio/content/guide/file-structure.md @@ -10,70 +10,108 @@ The Angular CLI command `ng new ` gets you started. When you run this command, the CLI installs the necessary Angular npm packages and other dependencies in a new workspace, with a root folder named *project_name*. It also creates the following workspace and starter project files: +Angular CLI 命令 `ng new ` 可以帮你开始项目。 +当你运行该命令时,CLI 会在新建的工作空间(以 *project_name* 为根目录)中,安装必要的 Angular npm 包和其它依赖。 +它还会创建如下的工作空间和最初的项目文件: + * An initial skeleton app project, also called *project_name* (in the `src/` subfolder). + + 一个初始的骨架应用项目,也叫 *project_name*(位于 `src/` 子目录下)。 + * An end-to-end test project (in the `e2e/` subfolder). + + 一个端到端测试项目(位于 `e2e/` 子目录下)。 + * Related configuration files. + 相关配置文件。 + The initial app project contains a simple Welcome app, ready to run. +初始的应用项目包含一个简单的 Welcome 应用,随时可以运行。 + ## Workspace files +## 工作空间文件 + The top level of the workspace contains a number of workspace-wide configuration files. -| WORKSPACE CONFIG FILES | PURPOSE | +工作空间的顶级包含一系列工作空间级的配置文件。 + +| WORKSPACE CONFIG FILES工作空间配置文件 | PURPOSE用途 | | :--------------------- | :------------------------------------------| -| `.editorconfig` | Configuration for code editors. See [EditorConfig](https://editorconfig.org/). | -| `.gitignore` | Specifies intentionally untracked files that [Git](https://git-scm.com/) should ignore. | -| `angular.json` | CLI configuration for all projects in the workspace, including configuration options for build, serve, and test tools that the CLI uses, such as [Karma](https://karma-runner.github.io/) and [Protractor](http://www.protractortest.org/). | -| `node_modules` | Provides [npm packages](guide/npm-packages) to the entire workspace. | -| `package.json` | Lists package dependencies. See [npm documentation](https://docs.npmjs.com/files/package.json) for the specific format and contents of this file.| -| `tsconfig.app.json` | Default [TypeScript](https://www.typescriptlang.org/) configuration for apps in the workspace. | -| `tsconfig.spec.json` | Default TypeScript configuration for e2e test apps in the workspace. | -| `tslint.json` | Default [TSLint](https://palantir.github.io/tslint/) configuration for apps in the workspace. | -| `README.md` | Introductory documentation. | -| `package-lock.json` | Provides version information for all packages installed into `node_modules` by the npm client. See [npm documentation](https://docs.npmjs.com/files/package-lock.json) for details. If you use the yarn client, this file will be [yarn.lock](https://yarnpkg.com/lang/en/docs/yarn-lock/) instead. | +| `.editorconfig` | Configuration for code editors. See [EditorConfig](https://editorconfig.org/). 代码编辑器配置。参见 [EditorConfig](https://editorconfig.org/) | +| `.gitignore` | Specifies intentionally untracked files that [Git](https://git-scm.com/) should ignore. 指定 [Git](https://git-scm.com/) 要忽略的非跟踪的文件。 | +| `angular.json` | CLI configuration for all projects in the workspace, including configuration options for build, serve, and test tools that the CLI uses, such as [Karma](https://karma-runner.github.io/) and [Protractor](http://www.protractortest.org/). 工作区中所有项目的 CLI 配置,包括 CLI 使用的构建选项、运行选项、测试工具选项(比如 [Karma](https://karma-runner.github.io/)、[Protractor](http://www.protractortest.org/))等 | +| `node_modules` | Provides [npm packages](guide/npm-packages) to the entire workspace. 提供给整个工作空间的 [npm 包](guide/npm-packages)。 | +| `package.json` | Lists package dependencies. See [npm documentation](https://docs.npmjs.com/files/package.json) for the specific format and contents of this file.列出包依赖项。有关此文件的特有格式和内容,参见 [npm 文档](https://docs.npmjs.com/files/package.json)。 | +| `tsconfig.app.json` | Default [TypeScript](https://www.typescriptlang.org/) configuration for apps in the workspace. 工作空间中所有应用的默认 [TypeScript](https://www.typescriptlang.org/) 配置。 | +| `tsconfig.spec.json` | Default TypeScript configuration for e2e test apps in the workspace. 工作空间中所有端到端测试类应用的默认 TypeScript 配置。 | +| `tslint.json` | Default [TSLint](https://palantir.github.io/tslint/) configuration for apps in the workspace. 工作空间中所有应用的默认 [TSLint](https://palantir.github.io/tslint/) 配置。 | +| `README.md` | Introductory documentation. 介绍文档 | +| `package-lock.json` | Provides version information for all packages installed into `node_modules` by the npm client. See [npm documentation](https://docs.npmjs.com/files/package-lock.json) for details. If you use the yarn client, this file will be [yarn.lock](https://yarnpkg.com/lang/en/docs/yarn-lock/) instead. 为 npm 客户端安装到 `node_modules` 中的所有软件包提供版本信息。详情参见 [npm documentation](https://docs.npmjs.com/files/package-lock.json)。如果你使用 yarn 客户端,此文件会由 [yarn.lock](https://yarnpkg.com/lang/en/docs/yarn-lock/) 代替。 | All projects within a workspace share this configuration context. Project-specific [TypeScript](https://www.typescriptlang.org/) configuration files inherit from the workspace-wide `tsconfig.*.json`, and app-specific [TSLint](https://palantir.github.io/tslint/) configuration files inherit from the workspace-wide `tslint.json`. +工作空间中的所有项目都共享这个配置上下文。 +每个项目自己的 [TypeScript](https://www.typescriptlang.org/) 配置文件继承自工作空间级的 `tsconfig.*.json`,而每个项目自己的 [TSLint](https://palantir.github.io/tslint/) 配置文件也继承自工作空间级的 `tslint.json`。 + ### Default app project files +### 默认应用工程文件 + The CLI command `ng new my-app` creates a workspace folder named "my-app" and generates a new app skeleton. This initial app is the *default app* for CLI commands (unless you change the default after creating additional apps). +CLI 命令 `ng new my-app` 创建了一个名叫 "my-app" 的工作空间目录,并生成了一个新应用的骨架。 +这个初始应用是 CLI 命令的*默认应用*(除非你在创建了其它应用之后修改了默认应用)。 + A newly generated app contains the source files for a root module, with a root component and template. When the workspace file structure is in place, you can use the `ng generate` command on the command line to add functionality and data to the initial app. +新生成的应用包含根模块和一个根组件及其模板的代码。 +当工作空间的文件结构就绪之后,你可以在命令行上运行 `ng generate` 命令,来给这个初始应用添加功能和数据。 +