Pages

Sunday, 29 December 2019

安装ng

CLI tool for Angular

you can just run:
npm install -g @angular/cli 
(运行此命令即可安装ng.
会显示:
~/node-v12.6.0/node-v12.6.0-darwin-x64/bin/ng -> ~/node-v12.6.0/node-v12.6.0-darwin-x64/lib/node_modules/@angular/cli/bin/ng 
...

which ng
会显示:
~/node-v12.6.0/node-v12.6.0-darwin-x64/bin/ng )

to get a global install of the latest CLI release. Then running any ng command in the example project will automatically find and use the local build of the CLI.
Note: If you are testing ng update, be aware that installing all the tarballs will also update the framework (@angular/core) to the latest version. In this case, simply install the CLI alone with npm install -D ${CLI_REPO}/dist/_angular_cli.tgz, that way the rest of the project remains to be upgraded with ng update.

Debugging

To debug an invocation of the CLI, build and install the CLI for an example project, then run the desired ng command as:
node --inspect-brk node_modules/.bin/ng ...
This will trigger a breakpoint as the CLI starts up. You can connect to this using the supported mechanisms for your IDE, but the simplest option is to open Chrome to chrome://inspect and then click on the inspect link for the node_modules/.bin/ng Node target.
Unfortunately, the CLI dynamically require()'s other files mid-execution, so the debugger is not aware of all the source code files before hand. As a result, it is tough to put breakpoints on files before the CLI loads them. The easiest workaround is to use the debugger; statement to stop execution in the file you are interested in, and then you should be able to step around and set breakpoints as expected.

from  https://github.com/angular/angular-cli
------

ng -h
Available Commands:
  add Adds support for an external library to your project.
  analytics Configures the gathering of Angular CLI usage metrics. See https://v8.angular.io/cli/usage-analytics-gathering.
  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.
  deploy (d) Invokes the deploy builder for a specified project or for the default project in the workspace.
  config Retrieves or sets Angular configuration values in the angular.json file for 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.
  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 app.
  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.
  xi18n Extracts i18n messages from source code.

For more detailed help run "ng [command name] --help"
-------

https://ng.ant.design/docs/getting-started/zh
http://pelli.ren/gitbooks/ng-intro/install.html
https://github.com/ng-alain/ng-alain-.netcore/blob/master/fe/README-zh_CN.md
https://blog.csdn.net/etemal_bright/article/details/79398631