Saturday, November 12, 2022

Angular Project Structure With Generated Files Description

When you create an Angular project using Angular CLI ng new command, the CLI installs the necessary Angular npm packages and other dependencies in a new workspace. The workspace root folder contains various support and configuration files, and a README file with generated descriptive text that you can customize. This article gives an overview of the generated files with some explanation about those files.

File groups

The generated files for the Angular project can be divided into following groups:

  1. Workspace configuration files
  2. Application source files
  3. Application configuration files
  4. End-to-end test files

Workspace configuration files

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.

.editorconfigConfiguration for code editors so that consistent coding styles is maintained for multiple developers working on the same project across various editors and IDEs
.gitignoreSpecifies intentionally untracked files that GIT should ignore.
README.mdIntroductory documentation for the root app.
angular.jsonCLI configuration defaults for all projects in the workspace, including configuration options for build, serve, and test tools that the CLI uses, such as TSLint, Karma and Protractor.
package.jsonConfigures npm package dependencies that are available to all projects in the workspace.
package-lock.jsonProvides version information for all packages installed into node_modules by the npm client.
src/Source files for the root-level application project.
node_modules/Provides npm packages to the entire workspace. Workspace-wide node_modules dependencies are visible to all projects.
tsconfig.jsonDefault TypeScript configuration for projects in the workspace.
tslint.jsonDefault TSLint configuration for projects in the workspace.
e2e/Contains source files for a set of end-to-end tests.

Application source files

Files at the top level of src/ support testing and running your application. Subfolders contain the application source and application-specific configuration.

app/ Contains the component files in which your application logic and data are defined.
assets/ Contains image and other asset files to be copied as-is when you build your application.
environments/ Contains build configuration options for particular target environments. By default there is an unnamed standard development environment and a production ("prod") environment. You can define additional target environment configurations.
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 <script> or <link> tags here manually.
main.ts The main entry point for your application. Compiles the application and bootstraps the application's root module (AppModule) to run in the browser.
polyfills.ts Provides polyfill scripts for browser support.
styles.sass Lists CSS files that supply styles for a project. The extension reflects the style preprocessor you have configured for the 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.

The app/ folder, inside the /src folder, contains your project's logic and data. Angular components, templates, and styles go here.

app/app.component.ts Defines the logic for the app's root component, named AppComponent. The view associated with this root component becomes the root of the view hierarchy as you add components and services to your application.
app/app.component.html Defines the HTML template associated with the root AppComponent.
app/app.component.css Defines the base CSS stylesheet for the root AppComponent.
app/app.component.spec.ts Defines a unit test for the root AppComponent.
app/app.module.ts Defines the root module, named AppModule, that tells Angular how to assemble the application. Initially declares only the AppComponent. As you add more components to the app, they must be declared here.

Application configuration files

The application-specific configuration files for the root application reside at the workspace root level.

browserslist Configures sharing of target browsers and Node.js versions among various front-end tools.
karma.conf.js Application-specific Karma configuration. Application-specific TypeScript configuration, including TypeScript and Angular template compiler options.
tsconfig.spec.json TypeScript configuration for the application tests.
tslint.json Application-specific TSLint configuration.

End-to-end test files

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.

src/ End-to-end tests for the application.
protractor.conf.js Test-tool config
tsconfig.json TypeScript config inherits from workspace


That's all for this topic Angular Project Structure With Generated Files Description. If you have any doubt or any suggestions to make please drop a comment. Thanks!

>>>Return to Angular Tutorial Page

Related Topics

  1. How to Install Node.js and NPM in Windows
  2. How to Setup Angular
  3. How to Add Bootstrap to Angular Application
  4. Creating New Component in Angular
  5. Angular First App - Hello world Example

You may also like-

  1. Angular ngIf Directive With Examples
  2. Angular Property Binding With Examples
  3. Highlight Currently Selected Menu Item Angular Routing Example
  4. Angular Example to Render Multiple Rows
  5. How ArrayList Works Internally in Java
  6. Java Lambda Expressions Interview Questions And Answers
  7. Python Exception Handling Tutorial
  8. Spring MVC Form Example With Bean Validation

No comments:

Post a Comment