when you run `ng new my-first-project` a new folder, named `my-first-project`, will be created in the current working directory. since you want to be able to create files inside that folder, make sure you have sufficient rights in the current working directory before running the command.
当你运行 `ng new my-first-project` 时,将在当前工作目录中创建一个名为 `my-first-project` 的新文件夹。由于你希望在该文件夹中创建文件,因此在运行命令之前,请确保你在当前工作目录中具有足够的权限。
If the current working directory is not the right place for your project, you can change to a more appropriate directory by running `cd
` first.
如果当前工作目录不适合放你的项目,可以先运行 `cd ` 来切换到更合适的目录。
## Workspaces and project files
## 工作区与项目文件
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.
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.
[ng new](cli/new) 命令会创建一个 *Angular 工作区*目录,并生成一个新的应用骨架。
每个工作区中可以包含多个应用和库。
由 [ng new](cli/new) 命令创建的初始应用位于工作区的顶层。
你在工作区中生成的其它应用或库,会放在 `projects/` 子目录下。
A newly generated app contains the source files for a root module, with a root component and template.
Each app has a `src` folder that contains the logic, data, and assets.
新生成的应用中包含根模块的源码,还有根组件和模板。
每个应用都有一个 `src` 目录,其中包含逻辑、数据和静态文件。
You can edit the generated files directly, or add to and modify them using CLI commands.
Use the [ng generate](cli/generate) command to add new files for additional components and services, and code for new pipes, directives, and so on.
Commands such as [add](cli/add) and [generate](cli/generate), which create or operate on apps and libraries, must be executed from within a workspace or project folder.
你可以直接编辑这些生成的文件,也可以使用 CLI 命令来添加或修改它们。
使用 [ng generate](cli/generate) 命令也可以添加其它组件和服务,以及管道、指令的源码等。
必须在工作区或项目目录下才能执行 [add](cli/add) 或 [generate](cli/generate) 之类的命令,因为这些命令需要在应用或库上进行创建或其它操作。
* See more about the [Workspace file structure](guide/file-structure).
欲知详情,参见[工作区的文件结构](guide/file-structure)。
### Workspace and project configuration
### 工作区与项目的配置
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.
工作区的配置文件 `angular.json` 位于此工作区的顶层。
在这里,你可以设置全工作区范围的默认值,并指定当 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.
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.
[ng config](cli/config) 让你可以从命令行中设置和获取配置项的值。你也可以直接编辑 `angular.json` 文件。
注意,此配置文件中的选项名称必须使用[小驼峰(camelCase)形式](guide/glossary#case-types),不过当在命令行中提供它是可以使用小驼峰和中线分隔(dash-case)两种形式。
* See more about [Workspace Configuration](guide/workspace-config).
参见 [工作区配置](guide/workspace-config)。
* See the [complete schema](https://github.com/angular/angular-cli/wiki/angular-workspace) for `angular.json`.
参见 `angular.json` 的[完整 schema](https://github.com/angular/angular-cli/wiki/angular-workspace)。
## CLI command-language syntax
## CLI 命令语法
Command syntax is shown as follows:
命令语法如下:
`ng` *commandNameOrAlias* *requiredArg* [*optionalArg*] `[options]`
* Most commands, and some options, have aliases. Aliases are shown in the syntax statement for each command.
大多数命令以及少量选项,会有别名。别名会显示在每个命令的语法描述中。
* Option names are prefixed with a double dash (--).
Option aliases are prefixed with a single dash (-).
Arguments are not prefixed.
For example: