You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: aio/content/guide/file-structure.md
+16-13Lines changed: 16 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -5,15 +5,15 @@ You develop applications in the context of an Angular [workspace](guide/glossary
5
5
The Angular CLI `ng new` command creates a workspace.
6
6
7
7
<code-examplelanguage="bash"linenums="false">
8
-
ng new <project_name>
8
+
ng new <my-project>
9
9
</code-example>
10
10
11
-
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*.
12
-
The workspace root folder contains workspace configuration files and a README file with generated descriptive text that you can customize.
11
+
When you run this command, the CLI installs the necessary Angular npm packages and other dependencies in a new workspace, with a root-level application named *my-project*.
12
+
The workspace root folder contains various support and configuration files, and a README file with generated descriptive text that you can customize.
13
13
14
-
By default, `ng new`also creates an initial skeleton application, along with its end-to-end tests.
14
+
By default, `ng new` creates an initial skeleton application at the root level of the workspace, along with its end-to-end tests.
15
15
The skeleton is for a simple Welcome application that is ready to run and easy to modify.
16
-
This *root application* has the same name as the workspace, and the source files reside in the `src/` subfolder of the workspace.
16
+
The root-level application has the same name as the workspace, and the source files reside in the `src/` subfolder of the workspace.
17
17
18
18
This default behavior is suitable for a typical "multi-repo" development style where each application resides in its own workspace.
19
19
Beginners and intermediate users are encouraged to use `ng new` to create a separate workspace for each application.
@@ -28,27 +28,29 @@ See [Setting up for a multi-project workspace](#multiple-projects) below.
28
28
## Workspace configuration files
29
29
30
30
All projects within a workspace share a [CLI configuration context](guide/workspace-config).
31
-
The top level of the workspace contains workspace-wide configuration files.
31
+
The top level of the workspace contains workspace-wide configuration files, configuration files for the root-level application, and subfolders for the root-level application source and test files.
|`node_modules/`| Provides [npm packages](guide/npm-packages) to the entire workspace. Workspace-wide `node_modules` dependencies are visible to all projects. |
36
35
|`.editorconfig`| Configuration for code editors. See [EditorConfig](https://editorconfig.org/). |
37
36
|`.gitignore`| Specifies intentionally untracked files that [Git](https://git-scm.com/) should ignore. |
37
+
|`README.md`| Introductory documentation for the root app. |
38
38
|`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). |
39
39
|`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. |
40
40
|`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. |
41
-
|`README.md`| Introductory documentation for the root app. |
41
+
|`src/`| Source files for the root-level application project. |
42
+
|`node_modules/`| Provides [npm packages](guide/npm-packages) to the entire workspace. Workspace-wide `node_modules` dependencies are visible to all projects. |
42
43
|`tsconfig.json`| Default [TypeScript](https://www.typescriptlang.org/) configuration for projects in the workspace. |
43
44
|`tslint.json`| Default [TSLint](https://palantir.github.io/tslint/) configuration for projects in the workspace. |
44
45
46
+
45
47
## Application project files
46
48
47
-
By default, the CLI command `ng new my-app` creates a workspace folder named "my-app" and generates a new application skeleton for a root application at the top level of the workspace.
49
+
By default, the CLI command `ng new my-app` creates a workspace folder named "my-app" and generates a new application skeleton in a `src/` folder at the top level of the workspace.
48
50
A newly generated application contains source files for a root module, with a root component and template.
49
51
50
52
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 application.
51
-
This initial starter application is the *default app* for CLI commands (unless you change the default after creating [additional apps](#multiple-projects)).
53
+
This initial root-level application is the *default app* for CLI commands (unless you change the default after creating [additional apps](#multiple-projects)).
An `e2e/` subfolder contains source files for a set of end-to-end tests that correspond to an application, along with test-specific configuration files.
110
+
An `e2e/` folder at the top level contains source files for a set of end-to-end tests that correspond to the root-level application, along with test-specific configuration files.
111
+
112
+
For a multi-project workspace, application-specific end-to-end tests are in the project root, under `projects/project-name/e2e/`.
109
113
110
114
<code-examplelanguage="none"linenums="false">
111
-
my-app/
112
115
e2e/
113
116
src/ (end-to-end tests for my-app)
114
117
app.e2e-spec.ts
@@ -126,7 +129,7 @@ A multi-project workspace is suitable for an enterprise that uses a single repos
126
129
### Setting up for a multi-project workspace
127
130
128
131
If you intend to have multiple projects in a workspace, you can skip the initial application generation when you create the workspace, and give the workspace a unique name.
129
-
The following command creates a workspace with all of the workspace-wide configuration files, but no root application.
132
+
The following command creates a workspace with all of the workspace-wide configuration files, but no root-level application.
0 commit comments