You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wrote down my understanding of the best ways to build/run/test/debug this repository.
A couple other random things included here:
* I removed an extraneous `debugger;` statement which I kept hitting.
* I also removed the `watch` scripts which are no longer used and don't need to be supported.
To get started locally, follow these instructions:
48
49
49
50
1. If you haven't done it already, [make a fork of this repo](https://github.com/angular/angular-cli/fork).
50
51
1. Clone to your local computer using `git`.
51
52
1. Make sure that you have Node 10.13 or later installed. See instructions [here](https://nodejs.org/en/download/).
52
53
1. Make sure that you have `yarn` installed; see instructions [here](https://yarnpkg.com/lang/en/docs/install/).
53
-
1. Run `yarn` (no arguments) from the root of your clone of this project.
54
-
1. Run `yarn link` to add all custom scripts we use to your global install.
54
+
1. Run `yarn` (no arguments) from the root of your clone of this project to install dependencies.
55
+
56
+
## Building and Installing the CLI
57
+
58
+
To make a local build:
59
+
60
+
```shell
61
+
yarn build --local
62
+
```
63
+
64
+
This generates a number of tarballs in the `dist/` directory. To actually use
65
+
the locally built tools, switch to another repository reproducing the specific
66
+
issue you want to fix (or just generate a local repo with `ng new`). Then
67
+
install the locally built packages:
68
+
69
+
```shell
70
+
cd"${EXAMPLE_ANGULAR_PROJECT_REPO}"
71
+
npm install -D ${CLI_REPO}/dist/*.tgz
72
+
```
73
+
74
+
Builds of this example project will use tooling created from the previous local
75
+
build and include any local changes. When using the CLI, it will automatically
76
+
check for a local install and use that if present. This means you can just run:
77
+
78
+
```shell
79
+
npm install -g @angular/cli
80
+
```
81
+
82
+
to get a global install of the latest CLI release. Then running any `ng` command
83
+
in the example project will automatically find and use the local build of the
84
+
CLI.
85
+
86
+
Note: If you are testing `ng update`, be aware that installing all the tarballs
87
+
will also update the framework (`@angular/core`) to the latest version. In this
88
+
case, simply install the CLI alone with
89
+
`npm install -D ${CLI_REPO}/dist/_angular_cli.tgz`, that way the rest of the
90
+
project remains to be upgraded with `ng update`.
91
+
92
+
## Debugging
93
+
94
+
To debug an invocation of the CLI, [build and install the CLI for an example
95
+
project](#building-and-installing-the-cli), then run the desired `ng` command
96
+
as:
97
+
98
+
```shell
99
+
node --inspect-brk node_modules/.bin/ng ...
100
+
```
101
+
102
+
This will trigger a breakpoint as the CLI starts up. You can connect to this
103
+
using the supported mechanisms for your IDE, but the simplest option is to open
104
+
Chrome to [chrome://inspect](chrome://inspect) and then click on the `inspect`
105
+
link for the `node_modules/.bin/ng` Node target.
106
+
107
+
Unfortunately, the CLI dynamically `require()`'s other files mid-execution, so
108
+
the debugger is not aware of all the source code files before hand. As a result,
109
+
it is tough to put breakpoints on files before the CLI loads them. The easiest
110
+
workaround is to use the `debugger;` statement to stop execution in the file you
111
+
are interested in, and then you should be able to step around and set breakpoints
112
+
as expected.
113
+
114
+
## Testing
115
+
116
+
There are three different test suites which can be run locally:
117
+
118
+
* Unit tests
119
+
* Run: `yarn test --full`
120
+
* Debug: `yarn debug:test --full`
121
+
* Large tests
122
+
* Run: `yarn test-large --full`
123
+
* Debug: `yarn debug:test-large --full`
124
+
* End to end tests
125
+
* Run: `yarn test-cli-e2e`
126
+
* Run subset of tests: `yarn test-cli-e2e tests/legacy-cli/e2e/tests/i18n/ivy-localize-*`
127
+
128
+
When running the debug commands, Node will stop and wait for a debugger to
129
+
attach. You can attach your IDE to the debugger to stop on breakpoints and step through the code. Also see [IDE Specific Usage](#ide-specific-usage) for a
130
+
simpler debug story.
131
+
132
+
When debugging a specific test, change `describe()` or `it()` to `fdescribe()`
133
+
and `fit()` to focus execution to just that one test. This will keep the output clean and speed up execution by not running irrelevant tests.
134
+
135
+
## IDE Specific Usage
136
+
137
+
Some additional tips for developing in specific IDEs.
138
+
139
+
### Intellij IDEA / WebStorm
140
+
141
+
To load the project in Intellij products, simply `Open` the repository folder.
142
+
Do **not**`Import Project`, because that will overwrite the existing
143
+
configuration.
144
+
145
+
Once opened, the editor should automatically detect run configurations in the
146
+
workspace. Use the drop down to choose which one to run and then click the `Run`
147
+
button to start it. When executing a debug target, make sure to click the
148
+
`Debug` icon to automatically attach the debugger (if you click `Run`, Node will
149
+
wait forever for a debugger to attach).
150
+
151
+

55
152
56
153
## Creating New Packages
154
+
57
155
Adding a package to this repository means running two separate commands:
58
156
59
157
1.`schematics devkit:package PACKAGE_NAME`. This will update the `.monorepo` file, and create the
0 commit comments