@angular/cli 13.2.1 → 14.0.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -271
- package/commands/build.d.ts +0 -8
- package/commands/config-impl.js +1 -13
- package/commands/definitions.json +1 -6
- package/commands/e2e.d.ts +0 -8
- package/commands/extract-i18n.d.ts +0 -8
- package/commands/serve.d.ts +0 -8
- package/commands/test.d.ts +0 -8
- package/commands/update-impl.js +0 -11
- package/commands/update.d.ts +0 -4
- package/commands/update.json +0 -6
- package/lib/config/schema.json +114 -74
- package/models/architect-command.js +1 -25
- package/package.json +11 -11
- package/src/commands/update/schematic/index.js +1 -3
- package/utilities/config.d.ts +2 -2
- package/utilities/config.js +6 -74
- package/utilities/package-manager.d.ts +0 -2
- package/utilities/package-manager.js +46 -23
- package/utilities/project.js +1 -6
package/README.md
CHANGED
|
@@ -1,273 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
# Angular CLI - The CLI tool for Angular.
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The sources for this package are in the [Angular CLI](https://github.com/angular/angular-cli) repository. Please file issues and pull requests against that repository.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
[![devDependency Status][david-dev-badge]][david-dev-badge-url]
|
|
7
|
-
|
|
8
|
-
[][npm-badge-url]
|
|
9
|
-
[][npm-badge-url]
|
|
10
|
-
[][license-url]
|
|
11
|
-
[][npm-badge-url]
|
|
12
|
-
|
|
13
|
-
[](https://gitter.im/angular/angular-cli?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
14
|
-
|
|
15
|
-
[](https://github.com/angular/angular-cli/fork)
|
|
16
|
-
[](https://github.com/angular/angular-cli)
|
|
17
|
-
|
|
18
|
-
## Note
|
|
19
|
-
|
|
20
|
-
If you are updating from a beta or RC version, check out our [1.0 Update Guide](https://github.com/angular/angular-cli/wiki/stories-1.0-update).
|
|
21
|
-
|
|
22
|
-
If you wish to collaborate, check out [our issue list](https://github.com/angular/angular-cli/issues).
|
|
23
|
-
|
|
24
|
-
Before submitting new issues, have a look at [issues marked with the `type: faq` label](https://github.com/angular/angular-cli/issues?utf8=%E2%9C%93&q=is%3Aissue%20label%3A%22type%3A%20faq%22%20).
|
|
25
|
-
|
|
26
|
-
## Prerequisites
|
|
27
|
-
|
|
28
|
-
Both the CLI and generated project have dependencies that require Node 8.9 or higher, together
|
|
29
|
-
with NPM 5.5.1 or higher.
|
|
30
|
-
|
|
31
|
-
## Table of Contents
|
|
32
|
-
|
|
33
|
-
- [Installation](#installation)
|
|
34
|
-
- [Usage](#usage)
|
|
35
|
-
- [Generating a New Project](#generating-and-serving-an-angular-project-via-a-development-server)
|
|
36
|
-
- [Generating Components, Directives, Pipes and Services](#generating-components-directives-pipes-and-services)
|
|
37
|
-
- [Updating Angular CLI](#updating-angular-cli)
|
|
38
|
-
- [Development Hints for working on Angular CLI](#development-hints-for-working-on-angular-cli)
|
|
39
|
-
- [Documentation](#documentation)
|
|
40
|
-
- [License](#license)
|
|
41
|
-
|
|
42
|
-
## Installation
|
|
43
|
-
|
|
44
|
-
**BEFORE YOU INSTALL:** please read the [prerequisites](#prerequisites)
|
|
45
|
-
|
|
46
|
-
### Install Globally
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
npm install -g @angular/cli
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### Install Locally
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
npm install @angular/cli
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
To run a locally installed version of the angular-cli, you can call `ng` commands directly by adding the `.bin` folder within your local `node_modules` folder to your PATH. The `node_modules` and `.bin` folders are created in the directory where `npm install @angular/cli` was run upon completion of the install command.
|
|
59
|
-
|
|
60
|
-
Alternatively, you can install [npx](https://www.npmjs.com/package/npx) and run `npx ng <command>` within the local directory where `npm install @angular/cli` was run, which will use the locally installed angular-cli.
|
|
61
|
-
|
|
62
|
-
### Install Specific Version (Example: 6.1.1)
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
npm install -g @angular/cli@6.1.1
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## Usage
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
ng help
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### Generating and serving an Angular project via a development server
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
ng new PROJECT-NAME
|
|
78
|
-
cd PROJECT-NAME
|
|
79
|
-
ng serve
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
|
|
83
|
-
|
|
84
|
-
You can configure the default HTTP host and port used by the development server with two command-line options :
|
|
85
|
-
|
|
86
|
-
```bash
|
|
87
|
-
ng serve --host 0.0.0.0 --port 4201
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
### Generating Components, Directives, Pipes and Services
|
|
91
|
-
|
|
92
|
-
You can use the `ng generate` (or just `ng g`) command to generate Angular components:
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
ng generate component my-new-component
|
|
96
|
-
ng g component my-new-component # using the alias
|
|
97
|
-
|
|
98
|
-
# components support relative path generation
|
|
99
|
-
# if in the directory src/app/feature/ and you run
|
|
100
|
-
ng g component new-cmp
|
|
101
|
-
# your component will be generated in src/app/feature/new-cmp
|
|
102
|
-
# but if you were to run
|
|
103
|
-
ng g component ./newer-cmp
|
|
104
|
-
# your component will be generated in src/app/newer-cmp
|
|
105
|
-
# if in the directory src/app you can also run
|
|
106
|
-
ng g component feature/new-cmp
|
|
107
|
-
# and your component will be generated in src/app/feature/new-cmp
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
You can find all possible blueprints in the table below:
|
|
111
|
-
|
|
112
|
-
| Scaffold | Usage |
|
|
113
|
-
| ------------------------------------------------------ | --------------------------------- |
|
|
114
|
-
| [Component](https://angular.io/cli/generate#component) | `ng g component my-new-component` |
|
|
115
|
-
| [Directive](https://angular.io/cli/generate#directive) | `ng g directive my-new-directive` |
|
|
116
|
-
| [Pipe](https://angular.io/cli/generate#pipe) | `ng g pipe my-new-pipe` |
|
|
117
|
-
| [Service](https://angular.io/cli/generate#service) | `ng g service my-new-service` |
|
|
118
|
-
| [Class](https://angular.io/cli/generate#class) | `ng g class my-new-class` |
|
|
119
|
-
| [Guard](https://angular.io/cli/generate#guard) | `ng g guard my-new-guard` |
|
|
120
|
-
| [Interface](https://angular.io/cli/generate#interface) | `ng g interface my-new-interface` |
|
|
121
|
-
| [Enum](https://angular.io/cli/generate#enum) | `ng g enum my-new-enum` |
|
|
122
|
-
| [Module](https://angular.io/cli/generate#module) | `ng g module my-module` |
|
|
123
|
-
|
|
124
|
-
angular-cli will add reference to `components`, `directives` and `pipes` automatically in the `app.module.ts`. If you need to add this references to another custom module, follow these steps:
|
|
125
|
-
|
|
126
|
-
1. `ng g module new-module` to create a new module
|
|
127
|
-
2. call `ng g component new-module/new-component`
|
|
128
|
-
|
|
129
|
-
This should add the new `component`, `directive` or `pipe` reference to the `new-module` you've created.
|
|
130
|
-
|
|
131
|
-
### Updating Angular CLI
|
|
132
|
-
|
|
133
|
-
If you're using Angular CLI `1.0.0-beta.28` or less, you need to uninstall `angular-cli` package. It should be done due to changing of package's name and scope from `angular-cli` to `@angular/cli`:
|
|
134
|
-
|
|
135
|
-
```bash
|
|
136
|
-
npm uninstall -g angular-cli
|
|
137
|
-
npm uninstall --save-dev angular-cli
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
To update Angular CLI to a new version, you must update both the global package and your project's local package.
|
|
141
|
-
|
|
142
|
-
Global package:
|
|
143
|
-
|
|
144
|
-
```bash
|
|
145
|
-
npm uninstall -g @angular/cli
|
|
146
|
-
npm cache verify
|
|
147
|
-
# if npm version is < 5 then use `npm cache clean`
|
|
148
|
-
npm install -g @angular/cli@latest
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
Local project package:
|
|
152
|
-
|
|
153
|
-
```bash
|
|
154
|
-
rm -rf node_modules dist # use rmdir /S/Q node_modules dist in Windows Command Prompt; use rm -r -fo node_modules,dist in Windows PowerShell
|
|
155
|
-
npm install --save-dev @angular/cli@latest
|
|
156
|
-
npm install
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
If you are updating to 1.0 from a beta or RC version, check out our [1.0 Update Guide](https://github.com/angular/angular-cli/wiki/stories-1.0-update).
|
|
160
|
-
|
|
161
|
-
You can find more details about changes between versions in [the Releases tab on GitHub](https://github.com/angular/angular-cli/releases).
|
|
162
|
-
|
|
163
|
-
## Development Hints for working on Angular CLI
|
|
164
|
-
|
|
165
|
-
### Working with master
|
|
166
|
-
|
|
167
|
-
```bash
|
|
168
|
-
git clone https://github.com/angular/angular-cli.git
|
|
169
|
-
yarn
|
|
170
|
-
npm run build
|
|
171
|
-
cd dist/@angular/cli
|
|
172
|
-
npm link
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
`npm link` is very similar to `npm install -g` except that instead of downloading the package
|
|
176
|
-
from the repo, the just built `dist/@angular/cli/` folder becomes the global package.
|
|
177
|
-
Additionally, this repository publishes several packages and we use special logic to load all of them
|
|
178
|
-
on development setups.
|
|
179
|
-
|
|
180
|
-
Any changes to the files in the `angular-cli/` folder will immediately affect the global `@angular/cli` package,
|
|
181
|
-
meaning that, in order to quickly test any changes you make to the cli project, you should simply just run `npm run build`
|
|
182
|
-
again.
|
|
183
|
-
|
|
184
|
-
Now you can use `@angular/cli` via the command line:
|
|
185
|
-
|
|
186
|
-
```bash
|
|
187
|
-
ng new foo
|
|
188
|
-
cd foo
|
|
189
|
-
npm link @angular/cli
|
|
190
|
-
ng serve
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
`npm link @angular/cli` is needed because by default the globally installed `@angular/cli` just loads
|
|
194
|
-
the local `@angular/cli` from the project which was fetched remotely from npm.
|
|
195
|
-
`npm link @angular/cli` symlinks the global `@angular/cli` package to the local `@angular/cli` package.
|
|
196
|
-
Now the `angular-cli` you cloned before is in three places:
|
|
197
|
-
The folder you cloned it into, npm's folder where it stores global packages and the Angular CLI project you just created.
|
|
198
|
-
|
|
199
|
-
You can also use `ng new foo --link-cli` to automatically link the `@angular/cli` package.
|
|
200
|
-
|
|
201
|
-
Please read the official [npm-link documentation](https://docs.npmjs.com/cli/link)
|
|
202
|
-
and the [npm-link cheatsheet](http://browsenpm.org/help#linkinganynpmpackagelocally) for more information.
|
|
203
|
-
|
|
204
|
-
To run the Angular CLI E2E test suite, use the `node ./tests/legacy-cli/run_e2e` command.
|
|
205
|
-
It can also receive a filename to only run that test (e.g. `node ./tests/legacy-cli/run_e2e tests/legacy-cli/e2e/tests/build/dev-build.ts`).
|
|
206
|
-
|
|
207
|
-
As part of the test procedure, all packages will be built and linked.
|
|
208
|
-
You will need to re-run `npm link` to re-link the development Angular CLI environment after tests finish.
|
|
209
|
-
|
|
210
|
-
### Debugging with VS Code
|
|
211
|
-
|
|
212
|
-
In order to debug some Angular CLI behaviour using Visual Studio Code, you can run `npm run build`, and then use a launch configuration like the following:
|
|
213
|
-
|
|
214
|
-
```json
|
|
215
|
-
{
|
|
216
|
-
"type": "node",
|
|
217
|
-
"request": "launch",
|
|
218
|
-
"name": "ng serve",
|
|
219
|
-
"cwd": "<path to an Angular project generated with Angular-CLI>",
|
|
220
|
-
"program": "${workspaceFolder}/dist/@angular/cli/bin/ng",
|
|
221
|
-
"args": [
|
|
222
|
-
"<ng command>",
|
|
223
|
-
...other arguments
|
|
224
|
-
],
|
|
225
|
-
"console": "integratedTerminal"
|
|
226
|
-
}
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
Then you can add breakpoints in `dist/@angular` files.
|
|
230
|
-
|
|
231
|
-
For more informations about Node.js debugging in VS Code, see the related [VS Code Documentation](https://code.visualstudio.com/docs/nodejs/nodejs-debugging).
|
|
232
|
-
|
|
233
|
-
### CPU Profiling
|
|
234
|
-
|
|
235
|
-
In order to investigate performance issues, CPU profiling is often useful.
|
|
236
|
-
|
|
237
|
-
#### Creating a profile
|
|
238
|
-
|
|
239
|
-
Node.js 16+ users can use the Node.js command line argument `--cpu-prof` to create a CPU profile.
|
|
240
|
-
|
|
241
|
-
```bash
|
|
242
|
-
node --cpu-prof node_modules/.bin/ng build
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
In addition to this one, another, more elaborated way to capture a CPU profile using the Chrome Devtools is detailed in https://github.com/angular/angular-cli/issues/8259#issue-269908550.
|
|
246
|
-
|
|
247
|
-
#### Opening a profile
|
|
248
|
-
|
|
249
|
-
You can use the Chrome Devtools to process it. To do so:
|
|
250
|
-
|
|
251
|
-
1. open `chrome://inspect` in Chrome
|
|
252
|
-
1. click on "Open dedicated DevTools for Node"
|
|
253
|
-
1. go to the "profiler" tab
|
|
254
|
-
1. click on the "Load" button and select the generated `.cpuprofile` file
|
|
255
|
-
1. on the left panel, select the associated file
|
|
256
|
-
|
|
257
|
-
## Documentation
|
|
258
|
-
|
|
259
|
-
The documentation for the Angular CLI is located on our [documentation website](https://angular.io/cli).
|
|
260
|
-
|
|
261
|
-
## License
|
|
262
|
-
|
|
263
|
-
[MIT](https://github.com/angular/angular-cli/blob/master/LICENSE)
|
|
264
|
-
|
|
265
|
-
[travis-badge]: https://travis-ci.org/angular/angular-cli.svg?branch=master
|
|
266
|
-
[travis-badge-url]: https://travis-ci.org/angular/angular-cli
|
|
267
|
-
[david-badge]: https://david-dm.org/angular/angular-cli.svg
|
|
268
|
-
[david-badge-url]: https://david-dm.org/angular/angular-cli
|
|
269
|
-
[david-dev-badge]: https://david-dm.org/angular/angular-cli/dev-status.svg
|
|
270
|
-
[david-dev-badge-url]: https://david-dm.org/angular/angular-cli?type=dev
|
|
271
|
-
[npm-badge]: https://img.shields.io/npm/v/@angular/cli.svg
|
|
272
|
-
[npm-badge-url]: https://www.npmjs.com/package/@angular/cli
|
|
273
|
-
[license-url]: https://github.com/angular/angular-cli/blob/master/LICENSE
|
|
5
|
+
Usage information and reference details can be found in repository [README](../../../README.md) file.
|
package/commands/build.d.ts
CHANGED
|
@@ -9,20 +9,12 @@ export interface Schema {
|
|
|
9
9
|
* The builder uses the named configurations to run the given target.
|
|
10
10
|
* For more information, see
|
|
11
11
|
* https://angular.io/guide/workspace-config#alternate-build-configurations.
|
|
12
|
-
* Setting this explicitly overrides the "--prod" flag.
|
|
13
12
|
*/
|
|
14
13
|
configuration?: string;
|
|
15
14
|
/**
|
|
16
15
|
* Shows a help message for this command in the console.
|
|
17
16
|
*/
|
|
18
17
|
help?: HelpUnion;
|
|
19
|
-
/**
|
|
20
|
-
* Shorthand for "--configuration=production".
|
|
21
|
-
* Set the build configuration to the production target.
|
|
22
|
-
* By default, the production target is set up in the workspace configuration such that all
|
|
23
|
-
* builds make use of bundling, limited tree-shaking, and also limited dead code elimination.
|
|
24
|
-
*/
|
|
25
|
-
prod?: boolean;
|
|
26
18
|
/**
|
|
27
19
|
* The name of the project to build. Can be an application or a library.
|
|
28
20
|
*/
|
package/commands/config-impl.js
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.ConfigCommand = void 0;
|
|
11
|
-
const core_1 = require("@angular-devkit/core");
|
|
12
11
|
const uuid_1 = require("uuid");
|
|
13
12
|
const command_1 = require("../models/command");
|
|
14
13
|
const interface_1 = require("../models/interface");
|
|
@@ -88,18 +87,7 @@ class ConfigCommand extends command_1.Command {
|
|
|
88
87
|
if (!options.global) {
|
|
89
88
|
await this.validateScope(interface_1.CommandScope.InProject);
|
|
90
89
|
}
|
|
91
|
-
|
|
92
|
-
if (options.global && !config) {
|
|
93
|
-
try {
|
|
94
|
-
if ((0, config_1.migrateLegacyGlobalConfig)()) {
|
|
95
|
-
config = (0, config_1.getWorkspaceRaw)(level)[0];
|
|
96
|
-
this.logger.info(core_1.tags.oneLine `
|
|
97
|
-
We found a global configuration that was used in Angular CLI 1.
|
|
98
|
-
It has been automatically migrated.`);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
catch { }
|
|
102
|
-
}
|
|
90
|
+
const [config] = (0, config_1.getWorkspaceRaw)(level);
|
|
103
91
|
if (options.value == undefined) {
|
|
104
92
|
if (!config) {
|
|
105
93
|
this.logger.error('No config found.');
|
|
@@ -14,14 +14,9 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"configuration": {
|
|
17
|
-
"description": "One or more named builder configurations as a comma-separated list as specified in the \"configurations\" section of angular.json.\nThe builder uses the named configurations to run the given target.\nFor more information, see https://angular.io/guide/workspace-config#alternate-build-configurations
|
|
17
|
+
"description": "One or more named builder configurations as a comma-separated list as specified in the \"configurations\" section of angular.json.\nThe builder uses the named configurations to run the given target.\nFor more information, see https://angular.io/guide/workspace-config#alternate-build-configurations.",
|
|
18
18
|
"type": "string",
|
|
19
19
|
"aliases": ["c"]
|
|
20
|
-
},
|
|
21
|
-
"prod": {
|
|
22
|
-
"description": "Shorthand for \"--configuration=production\".\nSet the build configuration to the production target.\nBy default, the production target is set up in the workspace configuration such that all builds make use of bundling, limited tree-shaking, and also limited dead code elimination.",
|
|
23
|
-
"type": "boolean",
|
|
24
|
-
"x-deprecated": "Use `--configuration production` instead."
|
|
25
20
|
}
|
|
26
21
|
}
|
|
27
22
|
},
|
package/commands/e2e.d.ts
CHANGED
|
@@ -8,20 +8,12 @@ export interface Schema {
|
|
|
8
8
|
* The builder uses the named configurations to run the given target.
|
|
9
9
|
* For more information, see
|
|
10
10
|
* https://angular.io/guide/workspace-config#alternate-build-configurations.
|
|
11
|
-
* Setting this explicitly overrides the "--prod" flag.
|
|
12
11
|
*/
|
|
13
12
|
configuration?: string;
|
|
14
13
|
/**
|
|
15
14
|
* Shows a help message for this command in the console.
|
|
16
15
|
*/
|
|
17
16
|
help?: HelpUnion;
|
|
18
|
-
/**
|
|
19
|
-
* Shorthand for "--configuration=production".
|
|
20
|
-
* Set the build configuration to the production target.
|
|
21
|
-
* By default, the production target is set up in the workspace configuration such that all
|
|
22
|
-
* builds make use of bundling, limited tree-shaking, and also limited dead code elimination.
|
|
23
|
-
*/
|
|
24
|
-
prod?: boolean;
|
|
25
17
|
/**
|
|
26
18
|
* The name of the project to build. Can be an application or a library.
|
|
27
19
|
*/
|
|
@@ -8,20 +8,12 @@ export interface Schema {
|
|
|
8
8
|
* The builder uses the named configurations to run the given target.
|
|
9
9
|
* For more information, see
|
|
10
10
|
* https://angular.io/guide/workspace-config#alternate-build-configurations.
|
|
11
|
-
* Setting this explicitly overrides the "--prod" flag.
|
|
12
11
|
*/
|
|
13
12
|
configuration?: string;
|
|
14
13
|
/**
|
|
15
14
|
* Shows a help message for this command in the console.
|
|
16
15
|
*/
|
|
17
16
|
help?: HelpUnion;
|
|
18
|
-
/**
|
|
19
|
-
* Shorthand for "--configuration=production".
|
|
20
|
-
* Set the build configuration to the production target.
|
|
21
|
-
* By default, the production target is set up in the workspace configuration such that all
|
|
22
|
-
* builds make use of bundling, limited tree-shaking, and also limited dead code elimination.
|
|
23
|
-
*/
|
|
24
|
-
prod?: boolean;
|
|
25
17
|
/**
|
|
26
18
|
* The name of the project to build. Can be an application or a library.
|
|
27
19
|
*/
|
package/commands/serve.d.ts
CHANGED
|
@@ -8,20 +8,12 @@ export interface Schema {
|
|
|
8
8
|
* The builder uses the named configurations to run the given target.
|
|
9
9
|
* For more information, see
|
|
10
10
|
* https://angular.io/guide/workspace-config#alternate-build-configurations.
|
|
11
|
-
* Setting this explicitly overrides the "--prod" flag.
|
|
12
11
|
*/
|
|
13
12
|
configuration?: string;
|
|
14
13
|
/**
|
|
15
14
|
* Shows a help message for this command in the console.
|
|
16
15
|
*/
|
|
17
16
|
help?: HelpUnion;
|
|
18
|
-
/**
|
|
19
|
-
* Shorthand for "--configuration=production".
|
|
20
|
-
* Set the build configuration to the production target.
|
|
21
|
-
* By default, the production target is set up in the workspace configuration such that all
|
|
22
|
-
* builds make use of bundling, limited tree-shaking, and also limited dead code elimination.
|
|
23
|
-
*/
|
|
24
|
-
prod?: boolean;
|
|
25
17
|
/**
|
|
26
18
|
* The name of the project to build. Can be an application or a library.
|
|
27
19
|
*/
|
package/commands/test.d.ts
CHANGED
|
@@ -8,20 +8,12 @@ export interface Schema {
|
|
|
8
8
|
* The builder uses the named configurations to run the given target.
|
|
9
9
|
* For more information, see
|
|
10
10
|
* https://angular.io/guide/workspace-config#alternate-build-configurations.
|
|
11
|
-
* Setting this explicitly overrides the "--prod" flag.
|
|
12
11
|
*/
|
|
13
12
|
configuration?: string;
|
|
14
13
|
/**
|
|
15
14
|
* Shows a help message for this command in the console.
|
|
16
15
|
*/
|
|
17
16
|
help?: HelpUnion;
|
|
18
|
-
/**
|
|
19
|
-
* Shorthand for "--configuration=production".
|
|
20
|
-
* Set the build configuration to the production target.
|
|
21
|
-
* By default, the production target is set up in the workspace configuration such that all
|
|
22
|
-
* builds make use of bundling, limited tree-shaking, and also limited dead code elimination.
|
|
23
|
-
*/
|
|
24
|
-
prod?: boolean;
|
|
25
17
|
/**
|
|
26
18
|
* The name of the project to build. Can be an application or a library.
|
|
27
19
|
*/
|
package/commands/update-impl.js
CHANGED
|
@@ -230,17 +230,6 @@ class UpdateCommand extends command_1.Command {
|
|
|
230
230
|
this.logger.info(message);
|
|
231
231
|
}
|
|
232
232
|
};
|
|
233
|
-
if (options.all) {
|
|
234
|
-
const updateCmd = this.packageManager === workspace_schema_1.PackageManager.Yarn
|
|
235
|
-
? `'yarn upgrade-interactive' or 'yarn upgrade'`
|
|
236
|
-
: `'${this.packageManager} update'`;
|
|
237
|
-
this.logger.warn(`
|
|
238
|
-
'--all' functionality has been removed as updating multiple packages at once is not recommended.
|
|
239
|
-
To update packages which don’t provide 'ng update' capabilities in your workspace 'package.json' use ${updateCmd} instead.
|
|
240
|
-
Run the package manager update command after updating packages which provide 'ng update' capabilities.
|
|
241
|
-
`);
|
|
242
|
-
return 0;
|
|
243
|
-
}
|
|
244
233
|
const packages = [];
|
|
245
234
|
for (const request of options['--'] || []) {
|
|
246
235
|
try {
|
package/commands/update.d.ts
CHANGED
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
* Updates your application and its dependencies. See https://update.angular.io/
|
|
3
3
|
*/
|
|
4
4
|
export interface Schema {
|
|
5
|
-
/**
|
|
6
|
-
* Whether to update all packages in package.json.
|
|
7
|
-
*/
|
|
8
|
-
all?: boolean;
|
|
9
5
|
/**
|
|
10
6
|
* Whether to allow updating when the repository contains modified or untracked files.
|
|
11
7
|
*/
|
package/commands/update.json
CHANGED
|
@@ -32,12 +32,6 @@
|
|
|
32
32
|
"default": false,
|
|
33
33
|
"type": "boolean"
|
|
34
34
|
},
|
|
35
|
-
"all": {
|
|
36
|
-
"description": "Whether to update all packages in package.json.",
|
|
37
|
-
"default": false,
|
|
38
|
-
"type": "boolean",
|
|
39
|
-
"x-deprecated": true
|
|
40
|
-
},
|
|
41
35
|
"next": {
|
|
42
36
|
"description": "Use the prerelease version, including beta and RCs.",
|
|
43
37
|
"default": false,
|
package/lib/config/schema.json
CHANGED
|
@@ -1584,7 +1584,34 @@
|
|
|
1584
1584
|
"type": "array",
|
|
1585
1585
|
"default": [],
|
|
1586
1586
|
"items": {
|
|
1587
|
-
"
|
|
1587
|
+
"oneOf": [
|
|
1588
|
+
{
|
|
1589
|
+
"type": "object",
|
|
1590
|
+
"properties": {
|
|
1591
|
+
"input": {
|
|
1592
|
+
"type": "string",
|
|
1593
|
+
"description": "The file to include.",
|
|
1594
|
+
"pattern": "\\.[cm]?jsx?$"
|
|
1595
|
+
},
|
|
1596
|
+
"bundleName": {
|
|
1597
|
+
"type": "string",
|
|
1598
|
+
"pattern": "^[\\w\\-.]*$",
|
|
1599
|
+
"description": "The bundle name for this extra entry point."
|
|
1600
|
+
},
|
|
1601
|
+
"inject": {
|
|
1602
|
+
"type": "boolean",
|
|
1603
|
+
"description": "If the bundle will be referenced in the HTML file.",
|
|
1604
|
+
"default": true
|
|
1605
|
+
}
|
|
1606
|
+
},
|
|
1607
|
+
"additionalProperties": false
|
|
1608
|
+
},
|
|
1609
|
+
{
|
|
1610
|
+
"type": "string",
|
|
1611
|
+
"description": "The file to include.",
|
|
1612
|
+
"pattern": "\\.[cm]?jsx?$"
|
|
1613
|
+
}
|
|
1614
|
+
]
|
|
1588
1615
|
}
|
|
1589
1616
|
},
|
|
1590
1617
|
"styles": {
|
|
@@ -1592,7 +1619,34 @@
|
|
|
1592
1619
|
"type": "array",
|
|
1593
1620
|
"default": [],
|
|
1594
1621
|
"items": {
|
|
1595
|
-
"
|
|
1622
|
+
"oneOf": [
|
|
1623
|
+
{
|
|
1624
|
+
"type": "object",
|
|
1625
|
+
"properties": {
|
|
1626
|
+
"input": {
|
|
1627
|
+
"type": "string",
|
|
1628
|
+
"description": "The file to include.",
|
|
1629
|
+
"pattern": "\\.(?:css|scss|sass|less|styl)$"
|
|
1630
|
+
},
|
|
1631
|
+
"bundleName": {
|
|
1632
|
+
"type": "string",
|
|
1633
|
+
"pattern": "^[\\w\\-.]*$",
|
|
1634
|
+
"description": "The bundle name for this extra entry point."
|
|
1635
|
+
},
|
|
1636
|
+
"inject": {
|
|
1637
|
+
"type": "boolean",
|
|
1638
|
+
"description": "If the bundle will be referenced in the HTML file.",
|
|
1639
|
+
"default": true
|
|
1640
|
+
}
|
|
1641
|
+
},
|
|
1642
|
+
"additionalProperties": false
|
|
1643
|
+
},
|
|
1644
|
+
{
|
|
1645
|
+
"type": "string",
|
|
1646
|
+
"description": "The file to include.",
|
|
1647
|
+
"pattern": "\\.(?:css|scss|sass|less|styl)$"
|
|
1648
|
+
}
|
|
1649
|
+
]
|
|
1596
1650
|
}
|
|
1597
1651
|
},
|
|
1598
1652
|
"inlineStyleLanguage": {
|
|
@@ -1846,15 +1900,9 @@
|
|
|
1846
1900
|
"description": "Extract all licenses in a separate file.",
|
|
1847
1901
|
"default": true
|
|
1848
1902
|
},
|
|
1849
|
-
"showCircularDependencies": {
|
|
1850
|
-
"type": "boolean",
|
|
1851
|
-
"description": "Show circular dependency warnings on builds.",
|
|
1852
|
-
"default": false,
|
|
1853
|
-
"x-deprecated": "The recommended method to detect circular dependencies in project code is to use either a lint rule or other external tooling."
|
|
1854
|
-
},
|
|
1855
1903
|
"buildOptimizer": {
|
|
1856
1904
|
"type": "boolean",
|
|
1857
|
-
"description": "Enables
|
|
1905
|
+
"description": "Enables advanced build optimizations when using the 'aot' option.",
|
|
1858
1906
|
"default": true
|
|
1859
1907
|
},
|
|
1860
1908
|
"namedChunks": {
|
|
@@ -2009,34 +2057,6 @@
|
|
|
2009
2057
|
}
|
|
2010
2058
|
]
|
|
2011
2059
|
},
|
|
2012
|
-
"extraEntryPoint": {
|
|
2013
|
-
"oneOf": [
|
|
2014
|
-
{
|
|
2015
|
-
"type": "object",
|
|
2016
|
-
"properties": {
|
|
2017
|
-
"input": {
|
|
2018
|
-
"type": "string",
|
|
2019
|
-
"description": "The file to include."
|
|
2020
|
-
},
|
|
2021
|
-
"bundleName": {
|
|
2022
|
-
"type": "string",
|
|
2023
|
-
"pattern": "^[\\w\\-.]*$",
|
|
2024
|
-
"description": "The bundle name for this extra entry point."
|
|
2025
|
-
},
|
|
2026
|
-
"inject": {
|
|
2027
|
-
"type": "boolean",
|
|
2028
|
-
"description": "If the bundle will be referenced in the HTML file.",
|
|
2029
|
-
"default": true
|
|
2030
|
-
}
|
|
2031
|
-
},
|
|
2032
|
-
"additionalProperties": false
|
|
2033
|
-
},
|
|
2034
|
-
{
|
|
2035
|
-
"type": "string",
|
|
2036
|
-
"description": "The file to include."
|
|
2037
|
-
}
|
|
2038
|
-
]
|
|
2039
|
-
},
|
|
2040
2060
|
"budget": {
|
|
2041
2061
|
"type": "object",
|
|
2042
2062
|
"properties": {
|
|
@@ -2266,7 +2286,34 @@
|
|
|
2266
2286
|
"type": "array",
|
|
2267
2287
|
"default": [],
|
|
2268
2288
|
"items": {
|
|
2269
|
-
"
|
|
2289
|
+
"oneOf": [
|
|
2290
|
+
{
|
|
2291
|
+
"type": "object",
|
|
2292
|
+
"properties": {
|
|
2293
|
+
"input": {
|
|
2294
|
+
"type": "string",
|
|
2295
|
+
"description": "The file to include.",
|
|
2296
|
+
"pattern": "\\.[cm]?jsx?$"
|
|
2297
|
+
},
|
|
2298
|
+
"bundleName": {
|
|
2299
|
+
"type": "string",
|
|
2300
|
+
"pattern": "^[\\w\\-.]*$",
|
|
2301
|
+
"description": "The bundle name for this extra entry point."
|
|
2302
|
+
},
|
|
2303
|
+
"inject": {
|
|
2304
|
+
"type": "boolean",
|
|
2305
|
+
"description": "If the bundle will be referenced in the HTML file.",
|
|
2306
|
+
"default": true
|
|
2307
|
+
}
|
|
2308
|
+
},
|
|
2309
|
+
"additionalProperties": false
|
|
2310
|
+
},
|
|
2311
|
+
{
|
|
2312
|
+
"type": "string",
|
|
2313
|
+
"description": "The file to include.",
|
|
2314
|
+
"pattern": "\\.[cm]?jsx?$"
|
|
2315
|
+
}
|
|
2316
|
+
]
|
|
2270
2317
|
}
|
|
2271
2318
|
},
|
|
2272
2319
|
"styles": {
|
|
@@ -2274,7 +2321,34 @@
|
|
|
2274
2321
|
"type": "array",
|
|
2275
2322
|
"default": [],
|
|
2276
2323
|
"items": {
|
|
2277
|
-
"
|
|
2324
|
+
"oneOf": [
|
|
2325
|
+
{
|
|
2326
|
+
"type": "object",
|
|
2327
|
+
"properties": {
|
|
2328
|
+
"input": {
|
|
2329
|
+
"type": "string",
|
|
2330
|
+
"description": "The file to include.",
|
|
2331
|
+
"pattern": "\\.(?:css|scss|sass|less|styl)$"
|
|
2332
|
+
},
|
|
2333
|
+
"bundleName": {
|
|
2334
|
+
"type": "string",
|
|
2335
|
+
"pattern": "^[\\w\\-.]*$",
|
|
2336
|
+
"description": "The bundle name for this extra entry point."
|
|
2337
|
+
},
|
|
2338
|
+
"inject": {
|
|
2339
|
+
"type": "boolean",
|
|
2340
|
+
"description": "If the bundle will be referenced in the HTML file.",
|
|
2341
|
+
"default": true
|
|
2342
|
+
}
|
|
2343
|
+
},
|
|
2344
|
+
"additionalProperties": false
|
|
2345
|
+
},
|
|
2346
|
+
{
|
|
2347
|
+
"type": "string",
|
|
2348
|
+
"description": "The file to include.",
|
|
2349
|
+
"pattern": "\\.(?:css|scss|sass|less|styl)$"
|
|
2350
|
+
}
|
|
2351
|
+
]
|
|
2278
2352
|
}
|
|
2279
2353
|
},
|
|
2280
2354
|
"inlineStyleLanguage": {
|
|
@@ -2308,7 +2382,7 @@
|
|
|
2308
2382
|
"items": {
|
|
2309
2383
|
"type": "string"
|
|
2310
2384
|
},
|
|
2311
|
-
"description": "Globs of files to include, relative to workspace or project root. \nThere are 2 special cases:\n - when a path to directory is provided, all spec files ending \".spec.@(ts|tsx)\" will be included\n - when a path to a file is provided, and a matching spec file exists it will be included instead"
|
|
2385
|
+
"description": "Globs of files to include, relative to workspace or project root. \nThere are 2 special cases:\n - when a path to directory is provided, all spec files ending \".spec.@(ts|tsx)\" will be included\n - when a path to a file is provided, and a matching spec file exists it will be included instead."
|
|
2312
2386
|
},
|
|
2313
2387
|
"sourceMap": {
|
|
2314
2388
|
"description": "Output source maps for scripts and styles. For more information, see https://angular.io/guide/workspace-config#source-map-configuration.",
|
|
@@ -2452,34 +2526,6 @@
|
|
|
2452
2526
|
"type": "string"
|
|
2453
2527
|
}
|
|
2454
2528
|
]
|
|
2455
|
-
},
|
|
2456
|
-
"extraEntryPoint": {
|
|
2457
|
-
"oneOf": [
|
|
2458
|
-
{
|
|
2459
|
-
"type": "object",
|
|
2460
|
-
"properties": {
|
|
2461
|
-
"input": {
|
|
2462
|
-
"type": "string",
|
|
2463
|
-
"description": "The file to include."
|
|
2464
|
-
},
|
|
2465
|
-
"bundleName": {
|
|
2466
|
-
"type": "string",
|
|
2467
|
-
"pattern": "^[\\w\\-.]*$",
|
|
2468
|
-
"description": "The bundle name for this extra entry point."
|
|
2469
|
-
},
|
|
2470
|
-
"inject": {
|
|
2471
|
-
"type": "boolean",
|
|
2472
|
-
"description": "If the bundle will be referenced in the HTML file.",
|
|
2473
|
-
"default": true
|
|
2474
|
-
}
|
|
2475
|
-
},
|
|
2476
|
-
"additionalProperties": false
|
|
2477
|
-
},
|
|
2478
|
-
{
|
|
2479
|
-
"type": "string",
|
|
2480
|
-
"description": "The file to include."
|
|
2481
|
-
}
|
|
2482
|
-
]
|
|
2483
2529
|
}
|
|
2484
2530
|
}
|
|
2485
2531
|
},
|
|
@@ -2734,12 +2780,6 @@
|
|
|
2734
2780
|
"description": "Extract all licenses in a separate file, in the case of production builds only.",
|
|
2735
2781
|
"default": true
|
|
2736
2782
|
},
|
|
2737
|
-
"showCircularDependencies": {
|
|
2738
|
-
"type": "boolean",
|
|
2739
|
-
"description": "Show circular dependency warnings on builds.",
|
|
2740
|
-
"default": false,
|
|
2741
|
-
"x-deprecated": "The recommended method to detect circular dependencies in project code is to use either a lint rule or other external tooling."
|
|
2742
|
-
},
|
|
2743
2783
|
"namedChunks": {
|
|
2744
2784
|
"type": "boolean",
|
|
2745
2785
|
"description": "Use file name for lazy loaded chunks.",
|
|
@@ -218,19 +218,7 @@ class ArchitectCommand extends command_1.Command {
|
|
|
218
218
|
return;
|
|
219
219
|
}
|
|
220
220
|
const packageManager = await (0, package_manager_1.getPackageManager)(basePath);
|
|
221
|
-
|
|
222
|
-
switch (packageManager) {
|
|
223
|
-
case 'npm':
|
|
224
|
-
installSuggestion += `'npm install'`;
|
|
225
|
-
break;
|
|
226
|
-
case 'yarn':
|
|
227
|
-
installSuggestion += `'yarn'`;
|
|
228
|
-
break;
|
|
229
|
-
default:
|
|
230
|
-
installSuggestion += `the project's package manager`;
|
|
231
|
-
break;
|
|
232
|
-
}
|
|
233
|
-
this.logger.warn(`Node packages may not be installed. ${installSuggestion}.`);
|
|
221
|
+
this.logger.warn(`Node packages may not be installed. Try installing with '${packageManager} install'.`);
|
|
234
222
|
}
|
|
235
223
|
async run(options) {
|
|
236
224
|
return await this.runArchitectTarget(options);
|
|
@@ -346,7 +334,6 @@ class ArchitectCommand extends command_1.Command {
|
|
|
346
334
|
}
|
|
347
335
|
}
|
|
348
336
|
_makeTargetSpecifier(commandOptions) {
|
|
349
|
-
var _a, _b, _c;
|
|
350
337
|
let project, target, configuration;
|
|
351
338
|
if (commandOptions.target) {
|
|
352
339
|
[project, target, configuration] = commandOptions.target.split(':');
|
|
@@ -357,17 +344,6 @@ class ArchitectCommand extends command_1.Command {
|
|
|
357
344
|
else {
|
|
358
345
|
project = commandOptions.project;
|
|
359
346
|
target = this.target;
|
|
360
|
-
if (commandOptions.prod) {
|
|
361
|
-
const defaultConfig = project &&
|
|
362
|
-
target &&
|
|
363
|
-
((_c = (_b = (_a = this.workspace) === null || _a === void 0 ? void 0 : _a.projects.get(project)) === null || _b === void 0 ? void 0 : _b.targets.get(target)) === null || _c === void 0 ? void 0 : _c.defaultConfiguration);
|
|
364
|
-
this.logger.warn(defaultConfig === 'production'
|
|
365
|
-
? 'Option "--prod" is deprecated: No need to use this option as this builder defaults to configuration "production".'
|
|
366
|
-
: 'Option "--prod" is deprecated: Use "--configuration production" instead.');
|
|
367
|
-
// The --prod flag will always be the first configuration, available to be overwritten
|
|
368
|
-
// by following configurations.
|
|
369
|
-
configuration = 'production';
|
|
370
|
-
}
|
|
371
347
|
if (commandOptions.configuration) {
|
|
372
348
|
configuration = `${configuration ? `${configuration},` : ''}${commandOptions.configuration}`;
|
|
373
349
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.0.0-next.1",
|
|
4
4
|
"description": "CLI tool for Angular",
|
|
5
5
|
"main": "lib/cli/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/angular/angular-cli",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@angular-devkit/architect": "0.
|
|
32
|
-
"@angular-devkit/core": "
|
|
33
|
-
"@angular-devkit/schematics": "
|
|
34
|
-
"@schematics/angular": "
|
|
31
|
+
"@angular-devkit/architect": "0.1400.0-next.1",
|
|
32
|
+
"@angular-devkit/core": "14.0.0-next.1",
|
|
33
|
+
"@angular-devkit/schematics": "14.0.0-next.1",
|
|
34
|
+
"@schematics/angular": "14.0.0-next.1",
|
|
35
35
|
"@yarnpkg/lockfile": "1.1.0",
|
|
36
36
|
"ansi-colors": "4.1.1",
|
|
37
37
|
"debug": "4.3.3",
|
|
@@ -51,12 +51,12 @@
|
|
|
51
51
|
"ng-update": {
|
|
52
52
|
"migrations": "@schematics/angular/migrations/migration-collection.json",
|
|
53
53
|
"packageGroup": {
|
|
54
|
-
"@angular/cli": "
|
|
55
|
-
"@angular-devkit/architect": "0.
|
|
56
|
-
"@angular-devkit/build-angular": "
|
|
57
|
-
"@angular-devkit/build-webpack": "0.
|
|
58
|
-
"@angular-devkit/core": "
|
|
59
|
-
"@angular-devkit/schematics": "
|
|
54
|
+
"@angular/cli": "14.0.0-next.1",
|
|
55
|
+
"@angular-devkit/architect": "0.1400.0-next.1",
|
|
56
|
+
"@angular-devkit/build-angular": "14.0.0-next.1",
|
|
57
|
+
"@angular-devkit/build-webpack": "0.1400.0-next.1",
|
|
58
|
+
"@angular-devkit/core": "14.0.0-next.1",
|
|
59
|
+
"@angular-devkit/schematics": "14.0.0-next.1"
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
"engines": {
|
|
@@ -650,9 +650,7 @@ function default_1(options) {
|
|
|
650
650
|
const npmPackageJsonMap = allPackageMetadata.reduce((acc, npmPackageJson) => {
|
|
651
651
|
// If the package was not found on the registry. It could be private, so we will just
|
|
652
652
|
// ignore. If the package was part of the list, we will error out, but will simply ignore
|
|
653
|
-
// if it's either not requested (so just part of package.json. silently)
|
|
654
|
-
// `--all` situation. There is an edge case here where a public package peer depends on a
|
|
655
|
-
// private one, but it's rare enough.
|
|
653
|
+
// if it's either not requested (so just part of package.json. silently).
|
|
656
654
|
if (!npmPackageJson.name) {
|
|
657
655
|
if (npmPackageJson.requestedName && packages.has(npmPackageJson.requestedName)) {
|
|
658
656
|
throw new schematics_1.SchematicsException(`Package ${JSON.stringify(npmPackageJson.requestedName)} was not found on the ` +
|
package/utilities/config.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
import { json, workspaces } from '@angular-devkit/core';
|
|
9
|
+
import { PackageManager } from '../lib/config/workspace-schema';
|
|
9
10
|
import { JSONFile } from './json-file';
|
|
10
11
|
export declare const workspaceSchemaPath: string;
|
|
11
12
|
export declare class AngularWorkspace {
|
|
@@ -24,7 +25,6 @@ export declare function createGlobalSettings(): string;
|
|
|
24
25
|
export declare function getWorkspaceRaw(level?: 'local' | 'global'): [JSONFile | null, string | null];
|
|
25
26
|
export declare function validateWorkspace(data: json.JsonObject): Promise<void>;
|
|
26
27
|
export declare function getProjectByCwd(workspace: AngularWorkspace): string | null;
|
|
27
|
-
export declare function getConfiguredPackageManager(): Promise<
|
|
28
|
-
export declare function migrateLegacyGlobalConfig(): boolean;
|
|
28
|
+
export declare function getConfiguredPackageManager(): Promise<PackageManager | null>;
|
|
29
29
|
export declare function getSchematicDefaults(collection: string, schematic: string, project?: string | null): Promise<{}>;
|
|
30
30
|
export declare function isWarningEnabled(warning: string): Promise<boolean>;
|
package/utilities/config.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
26
26
|
return result;
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.isWarningEnabled = exports.getSchematicDefaults = exports.
|
|
29
|
+
exports.isWarningEnabled = exports.getSchematicDefaults = exports.getConfiguredPackageManager = exports.getProjectByCwd = exports.validateWorkspace = exports.getWorkspaceRaw = exports.createGlobalSettings = exports.getWorkspace = exports.AngularWorkspace = exports.workspaceSchemaPath = void 0;
|
|
30
30
|
const core_1 = require("@angular-devkit/core");
|
|
31
31
|
const fs_1 = require("fs");
|
|
32
32
|
const os = __importStar(require("os"));
|
|
@@ -139,12 +139,6 @@ class AngularWorkspace {
|
|
|
139
139
|
return (project === null || project === void 0 ? void 0 : project.extensions['cli']) || {};
|
|
140
140
|
}
|
|
141
141
|
static async load(workspaceFilePath) {
|
|
142
|
-
const oldConfigFileNames = ['.angular-cli.json', 'angular-cli.json'];
|
|
143
|
-
if (oldConfigFileNames.includes(path.basename(workspaceFilePath))) {
|
|
144
|
-
// 1.x file format
|
|
145
|
-
// Create an empty workspace to allow update to be used
|
|
146
|
-
return new AngularWorkspace({ extensions: {}, projects: new core_1.workspaces.ProjectDefinitionCollection() }, workspaceFilePath);
|
|
147
|
-
}
|
|
148
142
|
const result = await core_1.workspaces.readWorkspace(workspaceFilePath, createWorkspaceHost(), core_1.workspaces.WorkspaceFormat.JSON);
|
|
149
143
|
return new AngularWorkspace(result.workspace, workspaceFilePath);
|
|
150
144
|
}
|
|
@@ -268,86 +262,24 @@ async function getConfiguredPackageManager() {
|
|
|
268
262
|
return value;
|
|
269
263
|
}
|
|
270
264
|
}
|
|
265
|
+
return null;
|
|
271
266
|
};
|
|
272
|
-
let result;
|
|
267
|
+
let result = null;
|
|
273
268
|
const workspace = await getWorkspace('local');
|
|
274
269
|
if (workspace) {
|
|
275
270
|
const project = getProjectByCwd(workspace);
|
|
276
271
|
if (project) {
|
|
277
272
|
result = getPackageManager((_a = workspace.projects.get(project)) === null || _a === void 0 ? void 0 : _a.extensions['cli']);
|
|
278
273
|
}
|
|
279
|
-
result
|
|
274
|
+
result !== null && result !== void 0 ? result : (result = getPackageManager(workspace.extensions['cli']));
|
|
280
275
|
}
|
|
281
|
-
if (result
|
|
276
|
+
if (!result) {
|
|
282
277
|
const globalOptions = await getWorkspace('global');
|
|
283
278
|
result = getPackageManager(globalOptions === null || globalOptions === void 0 ? void 0 : globalOptions.extensions['cli']);
|
|
284
|
-
if (!workspace && !globalOptions) {
|
|
285
|
-
// Only check legacy if updated workspace is not found
|
|
286
|
-
result = getLegacyPackageManager();
|
|
287
|
-
}
|
|
288
279
|
}
|
|
289
|
-
|
|
290
|
-
return result !== null && result !== void 0 ? result : null;
|
|
280
|
+
return result;
|
|
291
281
|
}
|
|
292
282
|
exports.getConfiguredPackageManager = getConfiguredPackageManager;
|
|
293
|
-
function migrateLegacyGlobalConfig() {
|
|
294
|
-
const homeDir = os.homedir();
|
|
295
|
-
if (homeDir) {
|
|
296
|
-
const legacyGlobalConfigPath = path.join(homeDir, '.angular-cli.json');
|
|
297
|
-
if ((0, fs_1.existsSync)(legacyGlobalConfigPath)) {
|
|
298
|
-
const legacy = (0, json_file_1.readAndParseJson)(legacyGlobalConfigPath);
|
|
299
|
-
if (!isJsonObject(legacy)) {
|
|
300
|
-
return false;
|
|
301
|
-
}
|
|
302
|
-
const cli = {};
|
|
303
|
-
if (legacy.packageManager &&
|
|
304
|
-
typeof legacy.packageManager == 'string' &&
|
|
305
|
-
legacy.packageManager !== 'default') {
|
|
306
|
-
cli['packageManager'] = legacy.packageManager;
|
|
307
|
-
}
|
|
308
|
-
if (isJsonObject(legacy.defaults) &&
|
|
309
|
-
isJsonObject(legacy.defaults.schematics) &&
|
|
310
|
-
typeof legacy.defaults.schematics.collection == 'string') {
|
|
311
|
-
cli['defaultCollection'] = legacy.defaults.schematics.collection;
|
|
312
|
-
}
|
|
313
|
-
if (isJsonObject(legacy.warnings)) {
|
|
314
|
-
const warnings = {};
|
|
315
|
-
if (typeof legacy.warnings.versionMismatch == 'boolean') {
|
|
316
|
-
warnings['versionMismatch'] = legacy.warnings.versionMismatch;
|
|
317
|
-
}
|
|
318
|
-
if (Object.getOwnPropertyNames(warnings).length > 0) {
|
|
319
|
-
cli['warnings'] = warnings;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
if (Object.getOwnPropertyNames(cli).length > 0) {
|
|
323
|
-
const globalPath = path.join(homeDir, globalFileName);
|
|
324
|
-
(0, fs_1.writeFileSync)(globalPath, JSON.stringify({ version: 1, cli }, null, 2));
|
|
325
|
-
return true;
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
return false;
|
|
330
|
-
}
|
|
331
|
-
exports.migrateLegacyGlobalConfig = migrateLegacyGlobalConfig;
|
|
332
|
-
// Fallback, check for packageManager in config file in v1.* global config.
|
|
333
|
-
function getLegacyPackageManager() {
|
|
334
|
-
const homeDir = os.homedir();
|
|
335
|
-
if (homeDir) {
|
|
336
|
-
const legacyGlobalConfigPath = path.join(homeDir, '.angular-cli.json');
|
|
337
|
-
if ((0, fs_1.existsSync)(legacyGlobalConfigPath)) {
|
|
338
|
-
const legacy = (0, json_file_1.readAndParseJson)(legacyGlobalConfigPath);
|
|
339
|
-
if (!isJsonObject(legacy)) {
|
|
340
|
-
return null;
|
|
341
|
-
}
|
|
342
|
-
if (legacy.packageManager &&
|
|
343
|
-
typeof legacy.packageManager === 'string' &&
|
|
344
|
-
legacy.packageManager !== 'default') {
|
|
345
|
-
return legacy.packageManager;
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
return null;
|
|
350
|
-
}
|
|
351
283
|
async function getSchematicDefaults(collection, schematic, project) {
|
|
352
284
|
var _a;
|
|
353
285
|
const result = {};
|
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
import { PackageManager } from '../lib/config/workspace-schema';
|
|
9
|
-
export declare function supportsYarn(): boolean;
|
|
10
|
-
export declare function supportsNpm(): boolean;
|
|
11
9
|
export declare function getPackageManager(root: string): Promise<PackageManager>;
|
|
12
10
|
/**
|
|
13
11
|
* Checks if the npm version is a supported 7.x version. If not, display a warning.
|
|
@@ -7,54 +7,77 @@
|
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.ensureCompatibleNpm = exports.getPackageManager =
|
|
10
|
+
exports.ensureCompatibleNpm = exports.getPackageManager = void 0;
|
|
11
11
|
const child_process_1 = require("child_process");
|
|
12
12
|
const fs_1 = require("fs");
|
|
13
13
|
const path_1 = require("path");
|
|
14
14
|
const semver_1 = require("semver");
|
|
15
|
+
const util_1 = require("util");
|
|
15
16
|
const workspace_schema_1 = require("../lib/config/workspace-schema");
|
|
16
17
|
const config_1 = require("./config");
|
|
17
|
-
|
|
18
|
+
const exec = (0, util_1.promisify)(child_process_1.exec);
|
|
19
|
+
async function supports(name) {
|
|
18
20
|
try {
|
|
19
|
-
|
|
21
|
+
await exec(`${name} --version`);
|
|
20
22
|
return true;
|
|
21
23
|
}
|
|
22
24
|
catch {
|
|
23
25
|
return false;
|
|
24
26
|
}
|
|
25
27
|
}
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
async function hasLockfile(root, packageManager) {
|
|
29
|
+
try {
|
|
30
|
+
let lockfileName;
|
|
31
|
+
switch (packageManager) {
|
|
32
|
+
case workspace_schema_1.PackageManager.Yarn:
|
|
33
|
+
lockfileName = 'yarn.lock';
|
|
34
|
+
break;
|
|
35
|
+
case workspace_schema_1.PackageManager.Pnpm:
|
|
36
|
+
lockfileName = 'pnpm-lock.yaml';
|
|
37
|
+
break;
|
|
38
|
+
case workspace_schema_1.PackageManager.Npm:
|
|
39
|
+
default:
|
|
40
|
+
lockfileName = 'package-lock.json';
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
await fs_1.promises.access((0, path_1.join)(root, lockfileName), fs_1.constants.F_OK);
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
32
49
|
}
|
|
33
|
-
exports.supportsNpm = supportsNpm;
|
|
34
50
|
async function getPackageManager(root) {
|
|
35
|
-
|
|
51
|
+
const packageManager = await (0, config_1.getConfiguredPackageManager)();
|
|
36
52
|
if (packageManager) {
|
|
37
53
|
return packageManager;
|
|
38
54
|
}
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
55
|
+
const [hasYarnLock, hasNpmLock, hasPnpmLock] = await Promise.all([
|
|
56
|
+
hasLockfile(root, workspace_schema_1.PackageManager.Yarn),
|
|
57
|
+
hasLockfile(root, workspace_schema_1.PackageManager.Npm),
|
|
58
|
+
hasLockfile(root, workspace_schema_1.PackageManager.Pnpm),
|
|
59
|
+
]);
|
|
60
|
+
const hasYarn = await supports(workspace_schema_1.PackageManager.Yarn);
|
|
43
61
|
if (hasYarn && hasYarnLock && !hasNpmLock) {
|
|
44
|
-
|
|
62
|
+
return workspace_schema_1.PackageManager.Yarn;
|
|
63
|
+
}
|
|
64
|
+
const hasPnpm = await supports(workspace_schema_1.PackageManager.Pnpm);
|
|
65
|
+
if (hasPnpm && hasPnpmLock && !hasNpmLock) {
|
|
66
|
+
return workspace_schema_1.PackageManager.Pnpm;
|
|
45
67
|
}
|
|
46
|
-
|
|
47
|
-
|
|
68
|
+
const hasNpm = await supports(workspace_schema_1.PackageManager.Npm);
|
|
69
|
+
if (hasNpm && hasNpmLock && !hasYarnLock && !hasPnpmLock) {
|
|
70
|
+
return workspace_schema_1.PackageManager.Npm;
|
|
48
71
|
}
|
|
49
|
-
|
|
50
|
-
|
|
72
|
+
if (hasYarn && !hasNpm && !hasPnpm) {
|
|
73
|
+
return workspace_schema_1.PackageManager.Yarn;
|
|
51
74
|
}
|
|
52
|
-
|
|
53
|
-
|
|
75
|
+
if (hasPnpm && !hasYarn && !hasNpm) {
|
|
76
|
+
return workspace_schema_1.PackageManager.Pnpm;
|
|
54
77
|
}
|
|
55
78
|
// TODO: This should eventually inform the user of ambiguous package manager usage.
|
|
56
79
|
// Potentially with a prompt to choose and optionally set as the default.
|
|
57
|
-
return
|
|
80
|
+
return workspace_schema_1.PackageManager.Npm;
|
|
58
81
|
}
|
|
59
82
|
exports.getPackageManager = getPackageManager;
|
|
60
83
|
/**
|
package/utilities/project.js
CHANGED
|
@@ -33,12 +33,7 @@ const os = __importStar(require("os"));
|
|
|
33
33
|
const path = __importStar(require("path"));
|
|
34
34
|
const find_up_1 = require("./find-up");
|
|
35
35
|
function findWorkspaceFile(currentDirectory = process.cwd()) {
|
|
36
|
-
const possibleConfigFiles = [
|
|
37
|
-
'angular.json',
|
|
38
|
-
'.angular.json',
|
|
39
|
-
'angular-cli.json',
|
|
40
|
-
'.angular-cli.json',
|
|
41
|
-
];
|
|
36
|
+
const possibleConfigFiles = ['angular.json', '.angular.json'];
|
|
42
37
|
const configFilePath = (0, find_up_1.findUp)(possibleConfigFiles, currentDirectory);
|
|
43
38
|
if (configFilePath === null) {
|
|
44
39
|
return null;
|