From 225162aa6c08365d9e11fa73cf10d353181c9cf9 Mon Sep 17 00:00:00 2001 From: Judy Bogart Date: Thu, 4 Oct 2018 12:44:24 -0700 Subject: [PATCH] docs: edit file structure guide (#26256) PR Close #26256 --- aio/content/guide/build.md | 46 +-- aio/content/guide/file-structure.md | 440 ++++++---------------------- aio/content/navigation.json | 2 +- 3 files changed, 94 insertions(+), 394 deletions(-) diff --git a/aio/content/guide/build.md b/aio/content/guide/build.md index bca4781a37..53238778a6 100644 --- a/aio/content/guide/build.md +++ b/aio/content/guide/build.md @@ -1,6 +1,6 @@ # Building and serving Angular apps -*intro - here are some topics of interest in the app development cycle* +This page discusses build-specific configuration options for Angular projects. {@a app-environments} @@ -260,50 +260,6 @@ Each budget entry is a JSON object with the following properties: -{@a assets} - -## Adding project assets - -You can configure your project with a set of assets, such as images, to copy directly into the build for a particular build target. - -Each build target section of the CLI configuration file, `angular.json`, has an `assets` section that lists files or folders you want to copy into the build for that target. -By default, the `src/assets/` folder and `src/favicon.ico` are copied into a build. - -``` -"assets": [ - "src/assets", - "src/favicon.ico" -] -``` - -You can edit the assets configuration to extend it for assets outside your project. -For example, the following invokes the [node-glob pattern matcher](https://github.com/isaacs/node-glob) using input from a given base folder. -It sends output to a folder that is relative to `outDir`, a configuration value that defaults to `dist/`*project-name*). -The result in this cased is the same as for the default assets configuration. - -``` -"assets": [ - { "glob": "**/*", "input": "src/assets/", "output": "/assets/" }, - { "glob": "favicon.ico", "input": "/src", "output": "/" }, -] -``` - -You can use this extended configuration to copy assets from outside your project. -For instance, you can copy assets from a node package with the following value: - -``` -"assets": [ - { "glob": "**/*", "input": "./node_modules/some-package/images", "output": "/some-package/" }, -] -``` - -This makes the contents of `node_modules/some-package/images/` available in the output folder `dist/some-package/`. - -
- - For reasons of security, the CLI never writes files outside of the project output path. - -
{@a browser-compat} diff --git a/aio/content/guide/file-structure.md b/aio/content/guide/file-structure.md index d5f0470003..ad6d53f3eb 100644 --- a/aio/content/guide/file-structure.md +++ b/aio/content/guide/file-structure.md @@ -1,67 +1,110 @@ # Workspace and project file structure -An Angular CLI project is the foundation for both quick experiments and enterprise solutions. The CLI command `ng new` creates an Angular workspace in your file system that is the root for new projects, which can be apps and libraries. +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. -## Workspaces and project files +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 6 introduced the [workspace](guide/glossary#workspace) directory structure for Angular [projects](guide/glossary#project). A project can be a standalone *application* or a *library*, and a workspace can contain multiple applications, as well as libraries that can be used in any of the apps. +* An initial skeleton app project, also called *project_name* (in the `src/` subfolder). +* An end-to-end test project (in the `e2e/` subfolder). +* Related configuration files. -The CLI command `ng new my-workspace` creates a workspace folder and generates a new app skeleton in an `app` folder within that workspace. -Within the `app/` folder, a `src/` subfolder contains the logic, data, and assets. -A newly generated `app/` folder contains the source files for a root module, with a root component and template. +The initial app project contains a simple Welcome app, ready to run. -The `app/` folder also contains project-specific configuration files, end-to-end tests, and the Angular system modules. +## Workspace files -``` - my-workspace/ - app/ - e2e/ - src/ - node_modules/ - src/ -``` +The top level of the workspace contains a number of workspace-wide configuration files. -When this 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. +| 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. | -