From d7042768f13e4c357b1cf7475eee4aa988d9e280 Mon Sep 17 00:00:00 2001 From: Suguru Inatomi Date: Fri, 16 Aug 2024 22:00:29 +0900 Subject: [PATCH] fix: translate file-structure guide --- .../reference/configs/file-structure.en.md | 157 +++++++++++++++ .../reference/configs/file-structure.md | 186 +++++++++--------- 2 files changed, 250 insertions(+), 93 deletions(-) create mode 100644 adev-ja/src/content/reference/configs/file-structure.en.md diff --git a/adev-ja/src/content/reference/configs/file-structure.en.md b/adev-ja/src/content/reference/configs/file-structure.en.md new file mode 100644 index 0000000000..947e75d9df --- /dev/null +++ b/adev-ja/src/content/reference/configs/file-structure.en.md @@ -0,0 +1,157 @@ +# Workspace and project file structure + +You develop applications in the context of an Angular workspace. +A workspace contains the files for one or more projects. +A project is the set of files that comprise an application or a shareable library. + +The Angular CLI `ng new` command creates a workspace. + + + +ng new my-project + + + +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*. + +By default, `ng new` creates an initial skeleton application at the root level of the workspace, along with its end-to-end tests. +The skeleton is for a simple welcome application that is ready to run and easy to modify. +The root-level application has the same name as the workspace, and the source files reside in the `src/` subfolder of the workspace. + +This default behavior is suitable for a typical "multi-repo" development style where each application resides in its own workspace. +Beginners and intermediate users are encouraged to use `ng new` to create a separate workspace for each application. + +Angular also supports workspaces with [multiple projects](#multiple-projects). +This type of development environment is suitable for advanced users who are developing shareable libraries, +and for enterprises that use a "monorepo" development style, with a single repository and global configuration for all Angular projects. + +To set up a monorepo workspace, you should skip creating the root application. +See [Setting up for a multi-project workspace](#multiple-projects) below. + +## Workspace configuration files + +All projects within a workspace share a [configuration](reference/configs/workspace-config). +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. + +| Workspace configuration 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. | +| `README.md` | Documentation for the workspace. | +| `angular.json` | CLI configuration for all projects in the workspace, including configuration options for how to build, serve, and test each project. For details, see [Angular Workspace Configuration](reference/configs/workspace-config). | +| `package.json` | Configures [npm package dependencies](reference/configs/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-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. | +| `src/` | Source files for the root-level application project. | +| `public/` | Contains image and other asset files to be served as static files by the dev server and copied as-is when you build your application. | +| `node_modules/` | Installed [npm packages](reference/configs/npm-packages) for the entire workspace. Workspace-wide `node_modules` dependencies are visible to all projects. | +| `tsconfig.json` | The base [TypeScript](https://www.typescriptlang.org) configuration for projects in the workspace. All other configuration files inherit from this base file. For more information, see the [relevant TypeScript documentation](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#tsconfig-bases). | + +## Application project files + +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. +A newly generated application contains 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 application. +This initial root-level application is the *default app* for CLI commands (unless you change the default after creating [additional apps](#multiple-projects)). + +For a single-application workspace, the `src` subfolder of the workspace contains the source files (application logic, data, and assets) for the root application. +For a multi-project workspace, additional projects in the `projects` folder contain a `project-name/src/` subfolder with the same structure. + +### Application source files + +Files at the top level of `src/` support running your application. +Subfolders contain the application source and application-specific configuration. + +| Application support files | Purpose | +|:--- |:--- | +| `app/` | Contains the component files in which your application logic and data are defined. See details [below](#app-src). | +| `favicon.ico` | An icon to use for this application in the bookmark bar. | +| `index.html` | The main HTML page that is served when someone visits your site. The CLI automatically adds all JavaScript and CSS files when building your app, so you typically don't need to add any `