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

63
160
64
161
## Creating New Packages
162
+
65
163
Adding a package to this repository means running two separate commands:
66
164
67
165
1. `schematics devkit:package PACKAGE_NAME`. This will update the `.monorepo` file, and create the
0 commit comments