fix: 文字微调:工作空间 ==> 工作区

This commit is contained in:
Zhicheng WANG 2019-02-22 03:52:36 +08:00
parent 2b4662edeb
commit 7c81861676
11 changed files with 68 additions and 68 deletions

View File

@ -63,16 +63,16 @@ When you use the [ng serve](cli/serve) command to build an app and serve it loca
## Workspaces and project files ## Workspaces and project files
## 工作空间与项目文件 ## 工作与项目文件
The [ng new](cli/new) command creates an *Angular workspace* folder and generates a new app skeleton. The [ng new](cli/new) command creates an *Angular workspace* folder and generates a new app skeleton.
A workspace can contain multiple apps and libraries. A workspace can contain multiple apps and libraries.
The initial app created by the [ng new](cli/new) command is at the top level of the workspace. The initial app created by the [ng new](cli/new) command is at the top level of the workspace.
When you generate an additional app or library in a workspace, it goes into a `projects/` subfolder. When you generate an additional app or library in a workspace, it goes into a `projects/` subfolder.
[ng new](cli/new) 命令会创建一个 *Angular 工作空间*目录,并生成一个新的应用骨架。 [ng new](cli/new) 命令会创建一个 *Angular 工作*目录,并生成一个新的应用骨架。
每个工作空间中可以包含多个应用和库。 每个工作中可以包含多个应用和库。
由 [ng new](cli/new) 命令创建的初始应用位于工作空间的顶层。 由 [ng new](cli/new) 命令创建的初始应用位于工作的顶层。
你在工作区中生成的其它应用或库,会放在 `projects/` 子目录下。 你在工作区中生成的其它应用或库,会放在 `projects/` 子目录下。
A newly generated app contains the source files for a root module, with a root component and template. A newly generated app contains the source files for a root module, with a root component and template.
@ -87,21 +87,21 @@ Commands such as [add](cli/add) and [generate](cli/generate), which create or op
你可以直接编辑这些生成的文件,也可以使用 CLI 命令来添加或修改它们。 你可以直接编辑这些生成的文件,也可以使用 CLI 命令来添加或修改它们。
使用 [ng generate](cli/generate) 命令也可以添加其它组件和服务,以及管道、指令的源码等。 使用 [ng generate](cli/generate) 命令也可以添加其它组件和服务,以及管道、指令的源码等。
必须在工作空间或项目目录下才能执行 [add](cli/add) 或 [generate](cli/generate) 之类的命令,因为这些命令需要在应用或库上进行创建或其它操作。 必须在工作或项目目录下才能执行 [add](cli/add) 或 [generate](cli/generate) 之类的命令,因为这些命令需要在应用或库上进行创建或其它操作。
* See more about the [Workspace file structure](guide/file-structure). * See more about the [Workspace file structure](guide/file-structure).
欲知详情,参见[工作空间的文件结构](guide/file-structure)。 欲知详情,参见[工作的文件结构](guide/file-structure)。
### Workspace and project configuration ### Workspace and project configuration
### 工作空间与项目的配置 ### 工作与项目的配置
A single workspace configuration file, `angular.json`, is created at the top level of the workspace. A single workspace configuration file, `angular.json`, is created at the top level of the workspace.
This is where you can set per-project defaults for CLI command options, and specify configurations to use when the CLI builds a project for different targets. This is where you can set per-project defaults for CLI command options, and specify configurations to use when the CLI builds a project for different targets.
工作空间的配置文件 `angular.json` 位于此工作空间的顶层。 工作区的配置文件 `angular.json` 位于此工作区的顶层。
在这里,你可以设置全工作空间范围的默认值,并指定当 CLI 为不同目标构建项目时要用到的配置。 在这里,你可以设置全工作范围的默认值,并指定当 CLI 为不同目标构建项目时要用到的配置。
The [ng config](cli/config) command lets you set and retrieve configuration values from the command line, or you can edit the `angular.json` file directly. The [ng config](cli/config) command lets you set and retrieve configuration values from the command line, or you can edit the `angular.json` file directly.
Note that option names in the configuration file must use [camelCase](guide/glossary#case-types), while option names supplied to commands can use either camelCase or dash-case. Note that option names in the configuration file must use [camelCase](guide/glossary#case-types), while option names supplied to commands can use either camelCase or dash-case.
@ -111,7 +111,7 @@ Note that option names in the configuration file must use [camelCase](guide/glos
* See more about [Workspace Configuration](guide/workspace-config). * See more about [Workspace Configuration](guide/workspace-config).
参见 [工作空间配置](guide/workspace-config)。 参见 [工作配置](guide/workspace-config)。
* See the [complete schema](https://github.com/angular/angular-cli/wiki/angular-workspace) for `angular.json`. * See the [complete schema](https://github.com/angular/angular-cli/wiki/angular-workspace) for `angular.json`.
@ -178,7 +178,7 @@ Allowed values are given with each enumerated option description, with the defau
Options that specify files can be given as absolute paths, or as paths relative to the current working directory, which is generally either the workspace or project root. Options that specify files can be given as absolute paths, or as paths relative to the current working directory, which is generally either the workspace or project root.
用来指定文件的选项可以用绝对路径,也可以用相对于当前目录的相对路径,当前目录通常是工作空间或项目的根目录。 用来指定文件的选项可以用绝对路径,也可以用相对于当前目录的相对路径,当前目录通常是工作或项目的根目录。
### Schematics ### Schematics

View File

@ -83,7 +83,7 @@ without deep knowledge of animation techniques or CSS.
* [Workspace and File Structure](guide/file-structure): Understand the structure of Angular workspace and project folders. * [Workspace and File Structure](guide/file-structure): Understand the structure of Angular workspace and project folders.
[工作空间与文件结构](guide/file-structure):理解 Angular 工作空间与项目文件夹的结构。 [工作区与文件结构](guide/file-structure):理解 Angular 工作区与项目文件夹的结构。
* [npm Packages](guide/npm-packages): The Angular Framework, Angular CLI, and components used by Angular applications are packaged as [npm](https://docs.npmjs.com/) packages and distributed via the npm registry. The Angular CLI creates a default `package.json` file, which specifies a starter set of packages that work well together and jointly support many common application scenarios. * [npm Packages](guide/npm-packages): The Angular Framework, Angular CLI, and components used by Angular applications are packaged as [npm](https://docs.npmjs.com/) packages and distributed via the npm registry. The Angular CLI creates a default `package.json` file, which specifies a starter set of packages that work well together and jointly support many common application scenarios.

View File

@ -25,7 +25,7 @@ Use the Angular CLI to generate a new library skeleton with the following comman
This creates the `projects/my-lib` folder in your workspace, which contains a component and a service inside an NgModule. This creates the `projects/my-lib` folder in your workspace, which contains a component and a service inside an NgModule.
The workspace configuration file, `angular.json`, is updated with a project of type 'library'. The workspace configuration file, `angular.json`, is updated with a project of type 'library'.
这会在你的工作区中创建 `projects/my-lib` 文件夹,里面包含 NgModule 中的一个组件和一个服务。该工作空间的配置文件 `angular.json` 中也添加了一个 'library' 类型的项目。 这会在你的工作区中创建 `projects/my-lib` 文件夹,里面包含 NgModule 中的一个组件和一个服务。该工作的配置文件 `angular.json` 中也添加了一个 'library' 类型的项目。
<code-example format="json"> <code-example format="json">
"projects": { "projects": {

View File

@ -1,18 +1,18 @@
# Workspace and project file structure # Workspace and project file structure
# 工作空间与项目文件的结构 # 工作与项目文件的结构
You develop apps in the context of an Angular [workspace](guide/glossary#workspace). A workspace contains the files for one or more [projects](guide/glossary#project). A project is the set of files that comprise a standalone app, a library, or a set of end-to-end (e2e) tests. You develop apps in the context of an Angular [workspace](guide/glossary#workspace). A workspace contains the files for one or more [projects](guide/glossary#project). A project is the set of files that comprise a standalone app, a library, or a set of end-to-end (e2e) tests.
你要在 Angular [工作空间](guide/glossary#workspace)的上下文环境中开发应用。每个工作空间中包括一个或多个[项目](guide/glossary#project)的文件。每个项目是一组文件由标准应用、库或一组端到端e2e测试组成。 你要在 Angular [工作区](guide/glossary#workspace)的上下文环境中开发应用。每个工作区中包括一个或多个[项目](guide/glossary#project)的文件。每个项目是一组文件由标准应用、库或一组端到端e2e测试组成。
The Angular CLI command `ng new <project_name>` gets you started. The Angular CLI command `ng new <project_name>` 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*. 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: It also creates the following workspace and starter project files:
Angular CLI 命令 `ng new <project_name>` 可以帮你开始项目。 Angular CLI 命令 `ng new <project_name>` 可以帮你开始项目。
当你运行该命令时CLI 会在新建的工作空间(以 *project_name* 为根目录)中,安装必要的 Angular npm 包和其它依赖。 当你运行该命令时CLI 会在新建的工作(以 *project_name* 为根目录)中,安装必要的 Angular npm 包和其它依赖。
它还会创建如下的工作空间和最初的项目文件: 它还会创建如下的工作和最初的项目文件:
* An initial skeleton app project, also called *project_name* (in the `src/` subfolder). * An initial skeleton app project, also called *project_name* (in the `src/` subfolder).
@ -32,39 +32,39 @@ The initial app project contains a simple Welcome app, ready to run.
## Workspace files ## Workspace files
## 工作空间文件 ## 工作文件
The top level of the workspace contains a number of workspace-wide configuration 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/). | | `.editorconfig` | Configuration for code editors. See [EditorConfig](https://editorconfig.org/). |
| `.editorconfig` | 代码编辑器配置。参见 [EditorConfig](https://editorconfig.org/) | | `.editorconfig` | 代码编辑器配置。参见 [EditorConfig](https://editorconfig.org/) |
| `.gitignore` | Specifies intentionally untracked files that [Git](https://git-scm.com/) should ignore. | | `.gitignore` | Specifies intentionally untracked files that [Git](https://git-scm.com/) should ignore. |
| `.gitignore` | 指定 [Git](https://git-scm.com/) 要忽略的非跟踪的文件。 | | `.gitignore` | 指定 [Git](https://git-scm.com/) 要忽略的非跟踪的文件。 |
| `angular.json` | CLI configuration defaults for all projects in the workspace, including configuration options for build, serve, and test tools that the CLI uses, such as [TSLint](https://palantir.github.io/tslint/), [Karma](https://karma-runner.github.io/), and [Protractor](http://www.protractortest.org/). For details, see [Angular Workspace Configuration](guide/workspace-config). | | `angular.json` | CLI configuration defaults for all projects in the workspace, including configuration options for build, serve, and test tools that the CLI uses, such as [TSLint](https://palantir.github.io/tslint/), [Karma](https://karma-runner.github.io/), and [Protractor](http://www.protractortest.org/). For details, see [Angular Workspace Configuration](guide/workspace-config). |
| `angular.json` | 工作区中所有项目的默认 CLI 配置,包括 CLI 使用的构建选项、运行选项、测试工具选项(比如 [TSLint](https://palantir.github.io/tslint/)、[Karma](https://karma-runner.github.io/)、[Protractor](http://www.protractortest.org/))等。欲知详情,参见 [Angular 工作空间配置](guide/workspace-config)。 | | `angular.json` | 工作区中所有项目的默认 CLI 配置,包括 CLI 使用的构建选项、运行选项、测试工具选项(比如 [TSLint](https://palantir.github.io/tslint/)、[Karma](https://karma-runner.github.io/)、[Protractor](http://www.protractortest.org/))等。欲知详情,参见 [Angular 工作配置](guide/workspace-config)。 |
| `node_modules` | Provides [npm packages](guide/npm-packages) to the entire workspace. | | `node_modules` | Provides [npm packages](guide/npm-packages) to the entire workspace. |
| `node_modules` | 提供给整个工作空间的 [npm 包](guide/npm-packages)。 | | `node_modules` | 提供给整个工作的 [npm 包](guide/npm-packages)。 |
| `package.json` | Configures [npm package dependencies](guide/npm-packages) that are available to all projects in the workspace. See [npm documentation](https://docs.npmjs.com/files/package.json) for the specific format and contents of this file. | | `package.json` | Configures [npm package dependencies](guide/npm-packages) that are available to all projects in the workspace. See [npm documentation](https://docs.npmjs.com/files/package.json) for the specific format and contents of this file. |
| `package.json` | 配置用于工作空间中所有项目的包依赖项。有关此文件的特有格式和内容,参见 [npm 文档](https://docs.npmjs.com/files/package.json)。 | | `package.json` | 配置用于工作中所有项目的包依赖项。有关此文件的特有格式和内容,参见 [npm 文档](https://docs.npmjs.com/files/package.json)。 |
| `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. | | `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. |
| `package-lock.json` | 为 npm 客户端安装到 `node_modules` 中的所有软件包提供版本信息。详情参见 [npm documentation](https://docs.npmjs.com/files/package-lock.json)。如果你使用 yarn 客户端,此文件会由 [yarn.lock](https://yarnpkg.com/lang/en/docs/yarn-lock/) 代替。 | | `package-lock.json` | 为 npm 客户端安装到 `node_modules` 中的所有软件包提供版本信息。详情参见 [npm documentation](https://docs.npmjs.com/files/package-lock.json)。如果你使用 yarn 客户端,此文件会由 [yarn.lock](https://yarnpkg.com/lang/en/docs/yarn-lock/) 代替。 |
| `tsconfig.json` | Default [TypeScript](https://www.typescriptlang.org/) configuration for apps in the workspace, including TypeScript and Angular template compiler options. See [TypeScript Configuration](guide/typescript-configuration). | | `tsconfig.json` | Default [TypeScript](https://www.typescriptlang.org/) configuration for apps in the workspace, including TypeScript and Angular template compiler options. See [TypeScript Configuration](guide/typescript-configuration). |
| `tsconfig.json` | 工作空间中所有应用的默认 [TypeScript](https://www.typescriptlang.org/) 配置。包括 TypeScript 选项和 Angular 模板编译器选项。参见 [TypeScript 配置](guide/typescript-configuration)。 | | `tsconfig.json` | 工作中所有应用的默认 [TypeScript](https://www.typescriptlang.org/) 配置。包括 TypeScript 选项和 Angular 模板编译器选项。参见 [TypeScript 配置](guide/typescript-configuration)。 |
| `tslint.json` | Default [TSLint](https://palantir.github.io/tslint/) configuration for apps in the workspace. | | `tslint.json` | Default [TSLint](https://palantir.github.io/tslint/) configuration for apps in the workspace. |
| `tslint.json` | 工作空间中所有应用的默认 [TSLint](https://palantir.github.io/tslint/) 配置。 | | `tslint.json` | 工作中所有应用的默认 [TSLint](https://palantir.github.io/tslint/) 配置。 |
| `README.md` | Introductory documentation. | | `README.md` | Introductory documentation. |
| `README.md` | 介绍文档 | | `README.md` | 介绍文档 |
All projects within a workspace share a [CLI configuration context](guide/workspace-config). All projects within a workspace share a [CLI configuration context](guide/workspace-config).
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`. 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` 每个项目自己的 [TypeScript](https://www.typescriptlang.org/) 配置文件继承自工作级的 `tsconfig.*.json`,而每个项目自己的 [TSLint](https://palantir.github.io/tslint/) 配置文件也继承自工作级的 `tslint.json`
### Default app project files ### Default app project files
@ -73,14 +73,14 @@ Project-specific [TypeScript](https://www.typescriptlang.org/) configuration fil
The CLI command `ng new my-app` creates a workspace folder named "my-app" and generates a new app skeleton. 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). 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 命令 `ng new my-app` 创建了一个名叫 "my-app" 的工作目录,并生成了一个新应用的骨架。
这个初始应用是 CLI 命令的*默认应用*(除非你在创建了其它应用之后修改了默认应用)。 这个初始应用是 CLI 命令的*默认应用*(除非你在创建了其它应用之后修改了默认应用)。
A newly generated app contains the source files for a root module, with a root component and template. 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. 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` 命令,来给这个初始应用添加功能和数据。 当工作的文件结构就绪之后,你可以在命令行上运行 `ng generate` 命令,来给这个初始应用添加功能和数据。
<div class="alert is-helpful"> <div class="alert is-helpful">
@ -94,7 +94,7 @@ The `src/` subfolder contains the source files (app logic, data, and assets), al
Workspace-wide `node_modules` dependencies are visible to this project. Workspace-wide `node_modules` dependencies are visible to this project.
`src/` 子目录包含该初始应用的源文件(应用逻辑、数据和资源)以及配置文件。 `src/` 子目录包含该初始应用的源文件(应用逻辑、数据和资源)以及配置文件。
工作空间级的 `node_modules` 依赖,对于这个项目也是可见的。 工作级的 `node_modules` 依赖,对于这个项目也是可见的。
| APP SOURCE & CONFIG FILES | PURPOSE | | APP SOURCE & CONFIG FILES | PURPOSE |
| :--------------------- | :------------------------------------------| | :--------------------- | :------------------------------------------|
@ -120,11 +120,11 @@ Workspace-wide `node_modules` dependencies are visible to this project.
| `test.ts` | The main entry point for your unit tests, with some Angular-specific configuration. You don't typically need to edit this file. | | `test.ts` | The main entry point for your unit tests, with some Angular-specific configuration. You don't typically need to edit this file. |
| `test.ts` | 单元测试的主入口点,其中带有一些特定于 Angular 的配置。一般来说你不必编辑这个问题。 | | `test.ts` | 单元测试的主入口点,其中带有一些特定于 Angular 的配置。一般来说你不必编辑这个问题。 |
| `tsconfig.app.json` | Inherits from the workspace-wide `tsconfig.json` file. | | `tsconfig.app.json` | Inherits from the workspace-wide `tsconfig.json` file. |
| `tsconfig.app.json` | 继承自工作空间级的 `tsconfig.json` 文件。 | | `tsconfig.app.json` | 继承自工作级的 `tsconfig.json` 文件。 |
| `tsconfig.spec.json` | Inherits from the workspace-wide `tsconfig.json` file. | | `tsconfig.spec.json` | Inherits from the workspace-wide `tsconfig.json` file. |
| `tsconfig.spec.json` | 继承自工作空间级的 `tsconfig.json` 文件。 | | `tsconfig.spec.json` | 继承自工作级的 `tsconfig.json` 文件。 |
| `tslint.json` | Inherits from the workspace-wide `tslint.json` file. | | `tslint.json` | Inherits from the workspace-wide `tslint.json` file. |
| `tslint.json` | 继承自工作空间级的 `tsconfig.json` 文件。 | | `tslint.json` | 继承自工作级的 `tsconfig.json` 文件。 |
### Default app project e2e files ### Default app project e2e files
@ -150,7 +150,7 @@ my-app/
When you generate new projects in a workspace, When you generate new projects in a workspace,
the CLI creates a new *workspace*`/projects` folder, and adds the generated files there. the CLI creates a new *workspace*`/projects` folder, and adds the generated files there.
当你在工作空间中生成新项目时CLI 会在*工作空间*目录下创建一个新的 `/projects` 目录,并把生成的文件添加到那里。 当你在工作区中生成新项目时CLI 会在*工作区*目录下创建一个新的 `/projects` 目录,并把生成的文件添加到那里。
When you generate an app (`ng generate application my-other-app`), the CLI adds folders under `projects/` for both the app and its corresponding end-to-end tests. Newly generated libraries are also added under `projects/`. When you generate an app (`ng generate application my-other-app`), the CLI adds folders under `projects/` for both the app and its corresponding end-to-end tests. Newly generated libraries are also added under `projects/`.

View File

@ -223,7 +223,7 @@ In Angular, a set of related [schematics](#schematic) collected in an [npm packa
The [Angular CLI](cli) is a command-line tool for managing the Angular development cycle. Use it to create the initial filesystem scaffolding for a [workspace](guide/glossary#workspace) or [project](guide/glossary#project), and to run [schematics](guide/glossary#schematic) that add and modify code for initial generic versions of various elements. The CLI supports all stages of the development cycle, including building, testing, bundling, and deployment. The [Angular CLI](cli) is a command-line tool for managing the Angular development cycle. Use it to create the initial filesystem scaffolding for a [workspace](guide/glossary#workspace) or [project](guide/glossary#project), and to run [schematics](guide/glossary#schematic) that add and modify code for initial generic versions of various elements. The CLI supports all stages of the development cycle, including building, testing, bundling, and deployment.
[Angular CLI](cli) 是一个命令行工具,用于管理 Angular 的开发周期。它用于为[工作空间](guide/glossary#workspace)或[项目](guide/glossary#project)创建初始的脚手架,并且运行[生成器schematics](guide/glossary#schematic)来为初始生成的版本添加或修改各类代码。 [Angular CLI](cli) 是一个命令行工具,用于管理 Angular 的开发周期。它用于为[工作](guide/glossary#workspace)或[项目](guide/glossary#project)创建初始的脚手架,并且运行[生成器schematics](guide/glossary#schematic)来为初始生成的版本添加或修改各类代码。
CLI 支持开发周期中的所有阶段,比如构建、测试、打包和部署。 CLI 支持开发周期中的所有阶段,比如构建、测试、打包和部署。
* To begin using the CLI for a new project, see [Getting Started](guide/quickstart). * To begin using the CLI for a new project, see [Getting Started](guide/quickstart).
@ -781,11 +781,11 @@ A library isn't a complete Angular app and can't run independently.
* Library developers can use the [Angular CLI](guide/glossary#cli) to `generate` scaffolding for a new library in an existing [workspace](guide/glossary#workspace), and can publish a library as an `npm` package. * Library developers can use the [Angular CLI](guide/glossary#cli) to `generate` scaffolding for a new library in an existing [workspace](guide/glossary#workspace), and can publish a library as an `npm` package.
库的开发者可以使用 [CLI](guide/glossary#cli) 在现有的 [工作空间](guide/glossary#workspace) 中 `generate` 新库的脚手架,还能把库发布为 `npm` 包。 库的开发者可以使用 [CLI](guide/glossary#cli) 在现有的 [工作](guide/glossary#workspace) 中 `generate` 新库的脚手架,还能把库发布为 `npm` 包。
* Application developers can use the [Angular CLI](guide/glossary#cli) to `add` a published library for use with an application in the same [workspace](guide/glossary#workspace). * Application developers can use the [Angular CLI](guide/glossary#cli) to `add` a published library for use with an application in the same [workspace](guide/glossary#workspace).
应用开发者可以使用 [CLI](guide/glossary#cli) 来把一个已发布的库 `add` 进这个应用所在的[工作空间](guide/glossary#workspace)。 应用开发者可以使用 [CLI](guide/glossary#cli) 来把一个已发布的库 `add` 进这个应用所在的[工作](guide/glossary#workspace)。
See also [schematic](#schematic). See also [schematic](#schematic).
@ -1005,8 +1005,8 @@ In Angular, a folder within a [workspace](guide/glossary#workspace) that contain
A workspace can contain multiple projects. A workspace can contain multiple projects.
All apps in a workspace can use libraries in the same workspace. All apps in a workspace can use libraries in the same workspace.
在 Angular 中,是指[工作空间](guide/glossary#workspace)中的一个文件夹,它包含 Angular 应用或[库](guide/glossary#library)。 在 Angular 中,是指[工作](guide/glossary#workspace)中的一个文件夹,它包含 Angular 应用或[库](guide/glossary#library)。
每个工作空间中可以包含多个项目。工作空间中的每个应用都可以使用同一工作空间中的任意库。 每个工作区中可以包含多个项目。工作区中的每个应用都可以使用同一工作区中的任意库。
{@a provider} {@a provider}
@ -1451,14 +1451,14 @@ See [custom element](guide/glossary#custom-element).
## workspace ## workspace
## 工作空间Workspace ## 工作Workspace
In Angular, a folder that contains [projects](guide/glossary#project) (that is, apps and libraries). In Angular, a folder that contains [projects](guide/glossary#project) (that is, apps and libraries).
The [CLI](guide/glossary#cli) `ng new` command creates a workspace to contain projects. The [CLI](guide/glossary#cli) `ng new` command creates a workspace to contain projects.
Commands that create or operate on apps and libraries (such as `add` and `generate`) must be executed from within a workspace folder. Commands that create or operate on apps and libraries (such as `add` and `generate`) must be executed from within a workspace folder.
在 Angular 中,是指一个包含[项目](guide/glossary#project)(即应用和库)的文件夹。 在 Angular 中,是指一个包含[项目](guide/glossary#project)(即应用和库)的文件夹。
[CLI](guide/glossary#cli) 的 `ng new` 命令会创建一个包含项目的工作空间。而用来创建或操作应用和库的 `add``generate` 命令必须在工作空间目录下才能执行。 [CLI](guide/glossary#cli) 的 `ng new` 命令会创建一个包含项目的工作。而用来创建或操作应用和库的 `add``generate` 命令必须在工作目录下才能执行。
{@a X} {@a X}

View File

@ -32,7 +32,7 @@ These libraries can be used locally in your workspace, or you can publish them a
These packages can be published to the npm registry, a private npm Enterprise registry, or a private package management system that supports npm packages. These packages can be published to the npm registry, a private npm Enterprise registry, or a private package management system that supports npm packages.
See [Creating Libraries](guide/creating-libraries). See [Creating Libraries](guide/creating-libraries).
如果已经开发出了适合重用的功能,你就可以创建自己的库。这些库可以在你的工作空间中本地使用,也可以把它们发布成 [npm 包](guide/npm-packages),共享给其它项目或其他 Angular 开发者。这些包可以发布到 npm 服务器、一个私有的 npm 企业版服务器,或一个支持 npm 包的私有包管理系统。参见[创建库](guide/creating-libraries) 。 如果已经开发出了适合重用的功能,你就可以创建自己的库。这些库可以在你的工作中本地使用,也可以把它们发布成 [npm 包](guide/npm-packages),共享给其它项目或其他 Angular 开发者。这些包可以发布到 npm 服务器、一个私有的 npm 企业版服务器,或一个支持 npm 包的私有包管理系统。参见[创建库](guide/creating-libraries) 。
Whether you decide to package functionality as a library is an architectural decision, similar to deciding whether a piece of functionality is a component or a service, or deciding on the scope of a component. Whether you decide to package functionality as a library is an architectural decision, similar to deciding whether a piece of functionality is a component or a service, or deciding on the scope of a component.

View File

@ -36,8 +36,8 @@ Both `npm` and `yarn` install the packages that are identified in a [`package.js
The CLI command `ng new` creates a `package.json` file when it creates the new workspace. The CLI command `ng new` creates a `package.json` file when it creates the new workspace.
This `package.json` is used by all projects in the workspace, including the initial app project that is created by the CLI when it creates the workspace. This `package.json` is used by all projects in the workspace, including the initial app project that is created by the CLI when it creates the workspace.
CLI 的 `ng new` 命令会在创建新的工作空间的同时创建一个 `package.json` CLI 的 `ng new` 命令会在创建新的工作的同时创建一个 `package.json`
这个 `package.json` 用于此工作空间中的所有项目,包括由 CLI 在创建工作空间时创建的那个初始项目。 这个 `package.json` 用于此工作区中的所有项目,包括由 CLI 在创建工作区时创建的那个初始项目。
Initially, this `package.json` includes _a starter set of packages_, some of which are required by Angular and others that support common application scenarios. Initially, this `package.json` includes _a starter set of packages_, some of which are required by Angular and others that support common application scenarios.
You add packages to `package.json` as your application evolves. You add packages to `package.json` as your application evolves.
@ -104,7 +104,7 @@ To add a new dependency, use the [`ng add`](cli/add) command.
The following Angular packages are included as dependencies in the default `package.json` file for a new Angular workspace. The following Angular packages are included as dependencies in the default `package.json` file for a new Angular workspace.
For a complete list of Angular packages, see the [API reference](http://angular.io/api?type=package). For a complete list of Angular packages, see the [API reference](http://angular.io/api?type=package).
新 Angular 工作空间`package.json` 文件中默认包含下列 Angular 包。 新 Angular 工作`package.json` 文件中默认包含下列 Angular 包。
要了解 Angular 包的完整列表,参见 [API 参考手册](http://angular.io/api?type=package)。 要了解 Angular 包的完整列表,参见 [API 参考手册](http://angular.io/api?type=package)。
Package name | Description Package name | Description
@ -136,7 +136,7 @@ Package name | Description
The following support packages are included as dependencies in the default `package.json` file for a new Angular workspace. The following support packages are included as dependencies in the default `package.json` file for a new Angular workspace.
新的 Angular 工作空间`package.json` 文件中默认包含下列支持包。 新的 Angular 工作`package.json` 文件中默认包含下列支持包。
Package name | Description Package name | Description
---------------------------------------- | -------------------------------------------------- ---------------------------------------- | --------------------------------------------------
@ -164,7 +164,7 @@ how you can add them.
The `package.json` for a new Angular workspace installs the [core-js](https://github.com/zloirock/core-js) package, The `package.json` for a new Angular workspace installs the [core-js](https://github.com/zloirock/core-js) package,
which polyfills missing features for several popular browser. which polyfills missing features for several popular browser.
默认的 `package.json` 会为新的 Angular 工作空间安装 **[core-js](https://github.com/zloirock/core-js)** 包,它会弥补很多常用浏览器缺失的特性。 默认的 `package.json` 会为新的 Angular 工作安装 **[core-js](https://github.com/zloirock/core-js)** 包,它会弥补很多常用浏览器缺失的特性。
{@a dev-dependencies} {@a dev-dependencies}
@ -189,7 +189,7 @@ To add a new `devDependency`, use either one of the following commands:
The following `devDependencies` are provided in the default `package.json` file for a new Angular workspace. The following `devDependencies` are provided in the default `package.json` file for a new Angular workspace.
新 Angular 工作空间的默认 `package.json` 中包含下列 `devDependencies` 新 Angular 工作的默认 `package.json` 中包含下列 `devDependencies`
Package name | Description Package name | Description
---------------------------------------- | ----------------------------------- ---------------------------------------- | -----------------------------------

View File

@ -92,17 +92,17 @@ To install the CLI using `npm`, open a terminal/console window and enter the fol
## Step 2: Create a workspace and initial application ## Step 2: Create a workspace and initial application
## 第二步:创建工作空间和初始应用 ## 第二步:创建工作和初始应用
You develop apps in the context of an Angular [**workspace**](guide/glossary#workspace). A workspace contains the files for one or more [**projects**](guide/glossary/#project). A project is the set of files that comprise an app, a library, or end-to-end (e2e) tests. You develop apps in the context of an Angular [**workspace**](guide/glossary#workspace). A workspace contains the files for one or more [**projects**](guide/glossary/#project). A project is the set of files that comprise an app, a library, or end-to-end (e2e) tests.
Angular [**工作空间**](guide/glossary#workspace)就是你开发应用的上下文环境。 Angular [**工作**](guide/glossary#workspace)就是你开发应用的上下文环境。
每个工作空间包含一些供一个或多个[**项目**](guide/glossary/#project)使用的文件。 每个工作包含一些供一个或多个[**项目**](guide/glossary/#project)使用的文件。
每个项目都是一组由应用、库或端到端e2e测试构成的文件。 每个项目都是一组由应用、库或端到端e2e测试构成的文件。
To create a new workspace and initial app project: To create a new workspace and initial app project:
要想创建工作空间和初始应用项目: 要想创建工作和初始应用项目:
1. Run the CLI command `ng new` and provide the name `my-app`, as shown here: 1. Run the CLI command `ng new` and provide the name `my-app`, as shown here:
@ -123,11 +123,11 @@ Angular CLI 会安装必要的 Angular npm 包及其它依赖。这可能要花
It also creates the following workspace and starter project files: It also creates the following workspace and starter project files:
还将创建下列工作空间和初始项目文件: 还将创建下列工作和初始项目文件:
* A new workspace, with a root folder named `my-app` * A new workspace, with a root folder named `my-app`
一个新的工作空间,根目录名叫 `my-app` 一个新的工作,根目录名叫 `my-app`
* An initial skeleton app project, also called `my-app` (in the `src` subfolder) * An initial skeleton app project, also called `my-app` (in the `src` subfolder)
@ -157,7 +157,7 @@ Angular 包含一个开发服务器,以便你能轻易地在本地构建应用
1. Go to the workspace folder (`my-app`). 1. Go to the workspace folder (`my-app`).
进入工作空间目录(`my-app`)。 进入工作目录(`my-app`)。
1. Launch the server by using the CLI command `ng serve`, with the `--open` option. 1. Launch the server by using the CLI command `ng serve`, with the `--open` option.
@ -256,7 +256,7 @@ You can <a href="generated/zips/cli-quickstart/cli-quickstart.zip" target="_blan
For more information about Angular project files and the file structure, see [Workspace and project file struture](guide/file-structure). For more information about Angular project files and the file structure, see [Workspace and project file struture](guide/file-structure).
要了解关于 Angular 项目文件和文件结构的更多信息,请参见[工作空间与项目的文件结构](guide/file-structure)。 要了解关于 Angular 项目文件和文件结构的更多信息,请参见[工作与项目的文件结构](guide/file-structure)。
## Next steps ## Next steps

View File

@ -45,7 +45,7 @@ npm install @types/d3 --save-dev
Types defined in a `@types/` package for a library installed into the workspace are automatically added to the TypeScript configuration for the project that uses that library. Types defined in a `@types/` package for a library installed into the workspace are automatically added to the TypeScript configuration for the project that uses that library.
TypeScript looks for types in the `node_modules/@types` folder by default, so you don't have to add each type package individually. TypeScript looks for types in the `node_modules/@types` folder by default, so you don't have to add each type package individually.
已安装到工作空间中的 `@types/` 包中所定义的类型,会自动添加到使用该库的项目的 TypeScript 配置文件中。TypeScript 默认就会在 `node_modules/@types` 文件夹中查找类型,所以你不必单独添加每一个类型包。 已安装到工作中的 `@types/` 包中所定义的类型,会自动添加到使用该库的项目的 TypeScript 配置文件中。TypeScript 默认就会在 `node_modules/@types` 文件夹中查找类型,所以你不必单独添加每一个类型包。
If a library doesn't have typings available at `@types/`, you can still use it by manually adding typings for it. If a library doesn't have typings available at `@types/`, you can still use it by manually adding typings for it.
To do this: To do this:

View File

@ -522,7 +522,7 @@
{ {
"url": "guide/file-structure", "url": "guide/file-structure",
"title": "项目文件结构", "title": "项目文件结构",
"tooltip": "Angular 工作空间在文件系统中是怎样的。" "tooltip": "Angular 工作在文件系统中是怎样的。"
}, },
{ {
"url": "guide/workspace-config", "url": "guide/workspace-config",

View File

@ -17,7 +17,7 @@ In this part of the tutorial, you'll do the following:
2. Create a new workspace and initial app project. 2. Create a new workspace and initial app project.
创建新的工作空间,并初始化应用项目。 创建新的工作,并初始化应用项目。
3. Serve the application. 3. Serve the application.
@ -47,27 +47,27 @@ To set up your development environment, follow these instructions in [Getting St
**Note:** You do not need to complete the entire Getting Started. After you complete the above two sections of Getting Started, your environment is set up. Continue below to create the Tour of Heroes workspace and an initial app project. **Note:** You do not need to complete the entire Getting Started. After you complete the above two sections of Getting Started, your environment is set up. Continue below to create the Tour of Heroes workspace and an initial app project.
**注意:**你不用做完整个快速上手。只要完成了上面这两个部分,你的环境就已经设置好了。然后继续下面的步骤来创建一个《英雄指南》的工作空间和一个初始应用项目。 **注意:**你不用做完整个快速上手。只要完成了上面这两个部分,你的环境就已经设置好了。然后继续下面的步骤来创建一个《英雄指南》的工作和一个初始应用项目。
</div> </div>
## Create a new workspace and an initial application ## Create a new workspace and an initial application
## 创建新的工作空间和一个初始应用 ## 创建新的工作和一个初始应用
You develop apps in the context of an Angular [workspace](guide/glossary#workspace). A workspace contains the files for one or more [projects](guide/glossary#project). A project is the set of files that comprise an app, a library, or end-to-end (e2e) tests. For this tutorial, you will create a new workspace. You develop apps in the context of an Angular [workspace](guide/glossary#workspace). A workspace contains the files for one or more [projects](guide/glossary#project). A project is the set of files that comprise an app, a library, or end-to-end (e2e) tests. For this tutorial, you will create a new workspace.
Angular 的[工作空间](guide/glossary#workspace)就是你开发应用所在的上下文环境。一个工作空间包含一个或多个[项目](guide/glossary#project)所需的文件。 Angular 的[工作区](guide/glossary#workspace)就是你开发应用所在的上下文环境。一个工作区包含一个或多个[项目](guide/glossary#project)所需的文件。
每个项目都是一组由应用、库或端到端e2e测试组成的文件集合。 每个项目都是一组由应用、库或端到端e2e测试组成的文件集合。
在本教程中,你将创建一个新的工作空间 在本教程中,你将创建一个新的工作
To create a new workspace and an initial app project: To create a new workspace and an initial app project:
要想创建一个新的工作空间和一个初始应用项目,需要: 要想创建一个新的工作和一个初始应用项目,需要:
1. Ensure that you are not already in an Angular workspace folder. For example, if you have previously created the Getting Started workspace, change to the parent of that folder. 1. Ensure that you are not already in an Angular workspace folder. For example, if you have previously created the Getting Started workspace, change to the parent of that folder.
确保你现在没有位于 Angular 工作区的文件夹中。例如,如果你之前已经创建过 "快速上手" 工作空间,请回到其父目录中。 确保你现在没有位于 Angular 工作区的文件夹中。例如,如果你之前已经创建过 "快速上手" 工作,请回到其父目录中。
2. Run the CLI command `ng new` and provide the name `angular-tour-of-heroes`, as shown here: 2. Run the CLI command `ng new` and provide the name `angular-tour-of-heroes`, as shown here:
@ -87,11 +87,11 @@ Angular CLI 会安装必要的 Angular `npm` 包和其它依赖项。这可能
It also creates the following workspace and starter project files: It also creates the following workspace and starter project files:
它还会创建下列工作空间和初始项目的文件: 它还会创建下列工作和初始项目的文件:
* A new workspace, with a root folder named `angular-tour-of-heroes`. * A new workspace, with a root folder named `angular-tour-of-heroes`.
新的工作空间,其根目录名叫 `angular-tour-of-heroes` 新的工作,其根目录名叫 `angular-tour-of-heroes`
* An initial skeleton app project, also called `angular-tour-of-heroes` (in the `src` subfolder). * An initial skeleton app project, also called `angular-tour-of-heroes` (in the `src` subfolder).
@ -115,7 +115,7 @@ The initial app project contains a simple Welcome app, ready to run.
Go to the workspace directory and launch the application. Go to the workspace directory and launch the application.
进入工作空间目录,并启动这个应用。 进入工作目录,并启动这个应用。
<code-example language="sh" class="code-shell"> <code-example language="sh" class="code-shell">
cd angular-tour-of-heroes cd angular-tour-of-heroes