Monday, 19 April 2021

What is Angular CLI ? Angular CLI Commands ? Basic Project structure ? What is Mono Repo Pattern?

What is Angular CLI ? Angular CLI Commands ? Basic Project structure ? What is Mono Repo Pattern?

  • The Angular CLI is a command-line interface tool that you use to initialize, develop, scaffold, and maintain Angular applications directly from a command shell
  • npm install -g @angular/cli
  • Online help is available on the command line
  • ng help 
  • ng generate –help
  • To create, build, and serve a new, basic Angular project on a development server
  • ng new my-first-project 
  • cd my-first-project 
  • ng serve


                    

COMMAND

ALIAS

DESCRIPTION

add

 

Adds support for an external library to your project.

analytics

 

Configures the gathering of Angular CLI usage metrics

build

b

Compiles an Angular app into an output directory named dist/ at the given output path. Must be executed from within a workspace directory.

config

 

Retrieves or sets Angular configuration values in the angular.json file for the workspace.

deploy

 

Invokes the deploy builder for a specified project or for the default project in the workspace.

doc

d

Opens the official Angular documentation (angular.io) in a browser, and searches for a given keyword.

e2e

e

Builds and serves an Angular app, then runs end-to-end tests using Protractor.

extract-i18n

i18n-extract xi18n

Extracts i18n messages from source code.

generate

g

Generates and/or modifies files based on a schematic.

help

 

Lists available commands and their short descriptions.

lint

l

Runs linting tools on Angular app code in a given project folder.

new

n

Creates a new workspace and an initial Angular application.

run

 

Runs an Architect target with an optional custom builder configuration defined in your project.

serve

s

Builds and serves your app, rebuilding on file changes.

test

t

Runs unit tests in a project.

update

 

Updates your application and its dependencies. See https://update.angular.io/

version

v

Outputs Angular CLI version.


WORKSPACE CONFIG FILES

PURPOSE

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 TSLintKarma, and Protractor. For details, see Angular Workspace Configuration.

package.json

Configures npm package dependencies that are available to all projects in the workspace. See npm documentation 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 for details. If you use the yarn client, this file will be yarn.lock instead.

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.json

The base TypeScript configuration for projects in the workspace. All other configuration files inherit from this base file. For more information, see the Configuration inheritance with extends section of the TypeScript documentation.

tslint.json

Default TSLint configuration for projects in the workspace.

Mono Repo :

  • The Monorepo, as the name suggests mono (single) and repo (repository of the codebase) is a single source of truth for the entire organization code base.


Angular Workspace can be divided into sub-projects which are categorized into:
Standalone Sub-project(s) - These are standalone projects which hold modules/components falling under one set of business functionality or domain. 
Integration Sub-Project(s)- These primarily work as integration project which consolidates bits and pieces from standalone and library projects and serves it as a web-application.
Library Sub-Project(s) - The library sub-projects hold any components/modules/directive/pipes/interceptors that may be used in more than on sub-project or integration project.

No comments:

Post a Comment