Skip to content

Commit 417a6fc

Browse files
committed
fix(ngcc): rename the executable from ivy-ngcc to ngcc
Previously, the executable for the Angular Compatibility Compiler (`ngcc`) was called `ivy-ngcc`. This would be confusing for users not familiar with our internal terminology, especially given that we call it `ngcc` in all our docs and presentations. This commit renames the executable to `ngcc` and replaces `ivy-ngcc` with a script that errors with an informative message (prompting the user to use `ngcc` instead). Jira issue: [FW-1624](https://angular-team.atlassian.net/browse/FW-1624)
1 parent c88305d commit 417a6fc

File tree

6 files changed

+58
-37
lines changed

6 files changed

+58
-37
lines changed

aio/tools/examples/example-boilerplate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class ExampleBoilerPlate {
8282
if (ivy) {
8383
// We only need the "es2015" bundles as the CLI webpack build does not need
8484
// any other formats for building and serving.
85-
shelljs.exec(`yarn --cwd ${SHARED_PATH} ivy-ngcc --properties es2015`);
85+
shelljs.exec(`yarn --cwd ${SHARED_PATH} ngcc --properties es2015`);
8686
}
8787

8888
exampleFolders.forEach(exampleFolder => {

integration/cli-hello-world-ivy-compat/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"e2e": "ng e2e --webdriver-update=false",
88
"lint": "ng lint",
99
"ng": "ng",
10-
"postinstall": "yarn update-webdriver && yarn ivy-ngcc --properties es2015 --create-ivy-entry-points",
10+
"postinstall": "yarn update-webdriver && yarn ngcc --properties es2015 --create-ivy-entry-points",
1111
"update-webdriver": "webdriver-manager update --gecko=false --standalone=false $CI_CHROMEDRIVER_VERSION_ARG",
1212
"start": "ng serve",
1313
"pretest": "ng version",

integration/cli-hello-world-ivy-minimal/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"e2e": "ng e2e --webdriver-update=false",
88
"lint": "ng lint",
99
"ng": "ng",
10-
"postinstall": "webdriver-manager update --gecko=false --standalone=false $CI_CHROMEDRIVER_VERSION_ARG && yarn ivy-ngcc",
10+
"postinstall": "webdriver-manager update --gecko=false --standalone=false $CI_CHROMEDRIVER_VERSION_ARG && yarn ngcc",
1111
"start": "ng serve",
1212
"pretest": "ng version",
1313
"test": "ng test --progress=false --watch=false && yarn e2e --configuration=ci && yarn e2e --configuration=ci-production"

integration/ngcc/test.sh

Lines changed: 41 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -23,89 +23,89 @@ function assertSucceeded {
2323
}
2424

2525

26-
ivy-ngcc --help
27-
assertSucceeded "Expected 'ivy-ngcc --help' to succeed."
26+
ngcc --help
27+
assertSucceeded "Expected 'ngcc --help' to succeed."
2828

29-
# node --inspect-brk $(npm bin)/ivy-ngcc -f esm2015
29+
# node --inspect-brk $(npm bin)/ngcc -f esm2015
3030
# Run ngcc and check it logged compilation output as expected
31-
ivy-ngcc | grep 'Compiling'
32-
assertSucceeded "Expected 'ivy-ngcc' to log 'Compiling'."
31+
ngcc | grep 'Compiling'
32+
assertSucceeded "Expected 'ngcc' to log 'Compiling'."
3333

3434

3535
# Did it add the appropriate build markers?
3636

3737
# - esm2015
3838
cat node_modules/@angular/common/package.json | awk 'ORS=" "' | grep '"__processed_by_ivy_ngcc__":[^}]*"esm2015": "'
39-
assertSucceeded "Expected 'ivy-ngcc' to add build marker for 'esm2015' in '@angular/common'."
39+
assertSucceeded "Expected 'ngcc' to add build marker for 'esm2015' in '@angular/common'."
4040

4141
# - fesm2015
4242
cat node_modules/@angular/common/package.json | awk 'ORS=" "' | grep '"__processed_by_ivy_ngcc__":[^}]*"fesm2015": "'
43-
assertSucceeded "Expected 'ivy-ngcc' to add build marker for 'fesm2015' in '@angular/common'."
43+
assertSucceeded "Expected 'ngcc' to add build marker for 'fesm2015' in '@angular/common'."
4444

4545
cat node_modules/@angular/common/package.json | awk 'ORS=" "' | grep '"__processed_by_ivy_ngcc__":[^}]*"es2015": "'
46-
assertSucceeded "Expected 'ivy-ngcc' to add build marker for 'es2015' in '@angular/common'."
46+
assertSucceeded "Expected 'ngcc' to add build marker for 'es2015' in '@angular/common'."
4747

4848
# - esm5
4949
cat node_modules/@angular/common/package.json | awk 'ORS=" "' | grep '"__processed_by_ivy_ngcc__":[^}]*"esm5": "'
50-
assertSucceeded "Expected 'ivy-ngcc' to add build marker for 'esm5' in '@angular/common'."
50+
assertSucceeded "Expected 'ngcc' to add build marker for 'esm5' in '@angular/common'."
5151

5252
# - fesm5
5353
cat node_modules/@angular/common/package.json | awk 'ORS=" "' | grep '"__processed_by_ivy_ngcc__":[^}]*"module": "'
54-
assertSucceeded "Expected 'ivy-ngcc' to add build marker for 'module' in '@angular/common'."
54+
assertSucceeded "Expected 'ngcc' to add build marker for 'module' in '@angular/common'."
5555

5656
cat node_modules/@angular/common/package.json | awk 'ORS=" "' | grep '"__processed_by_ivy_ngcc__":[^}]*"fesm5": "'
57-
assertSucceeded "Expected 'ivy-ngcc' to add build marker for 'fesm5' in '@angular/common'."
57+
assertSucceeded "Expected 'ngcc' to add build marker for 'fesm5' in '@angular/common'."
5858

5959

6060
# Did it replace the PRE_R3 markers correctly?
6161
grep "= SWITCH_COMPILE_COMPONENT__POST_R3__" node_modules/@angular/core/fesm2015/core.js
62-
assertSucceeded "Expected 'ivy-ngcc' to replace 'SWITCH_COMPILE_COMPONENT__PRE_R3__' in '@angular/core' (fesm2015)."
62+
assertSucceeded "Expected 'ngcc' to replace 'SWITCH_COMPILE_COMPONENT__PRE_R3__' in '@angular/core' (fesm2015)."
6363

6464
grep "= SWITCH_COMPILE_COMPONENT__POST_R3__" node_modules/@angular/core/fesm5/core.js
65-
assertSucceeded "Expected 'ivy-ngcc' to replace 'SWITCH_COMPILE_COMPONENT__PRE_R3__' in '@angular/core' (fesm5)."
65+
assertSucceeded "Expected 'ngcc' to replace 'SWITCH_COMPILE_COMPONENT__PRE_R3__' in '@angular/core' (fesm5)."
6666

6767

6868
# Did it compile @angular/core/ApplicationModule correctly?
6969
grep "ApplicationModule.ngModuleDef = ɵɵdefineNgModule" node_modules/@angular/core/fesm2015/core.js
70-
assertSucceeded "Expected 'ivy-ngcc' to correctly compile 'ApplicationModule' in '@angular/core' (fesm2015)."
70+
assertSucceeded "Expected 'ngcc' to correctly compile 'ApplicationModule' in '@angular/core' (fesm2015)."
7171

7272
grep "ApplicationModule.ngModuleDef = ɵɵdefineNgModule" node_modules/@angular/core/fesm5/core.js
73-
assertSucceeded "Expected 'ivy-ngcc' to correctly compile 'ApplicationModule' in '@angular/core' (fesm5)."
73+
assertSucceeded "Expected 'ngcc' to correctly compile 'ApplicationModule' in '@angular/core' (fesm5)."
7474

7575
grep "ApplicationModule.ngModuleDef = ɵngcc0.ɵɵdefineNgModule" node_modules/@angular/core/esm2015/src/application_module.js
76-
assertSucceeded "Expected 'ivy-ngcc' to correctly compile 'ApplicationModule' in '@angular/core' (esm2015)."
76+
assertSucceeded "Expected 'ngcc' to correctly compile 'ApplicationModule' in '@angular/core' (esm2015)."
7777

7878
grep "ApplicationModule.ngModuleDef = ɵngcc0.ɵɵdefineNgModule" node_modules/@angular/core/esm5/src/application_module.js
79-
assertSucceeded "Expected 'ivy-ngcc' to correctly compile 'ApplicationModule' in '@angular/core' (esm5)."
79+
assertSucceeded "Expected 'ngcc' to correctly compile 'ApplicationModule' in '@angular/core' (esm5)."
8080

8181

8282
# Did it transform @angular/core typing files correctly?
8383
grep "import [*] as ɵngcc0 from './src/r3_symbols';" node_modules/@angular/core/core.d.ts
84-
assertSucceeded "Expected 'ivy-ngcc' to add an import for 'src/r3_symbols' in '@angular/core' typings."
84+
assertSucceeded "Expected 'ngcc' to add an import for 'src/r3_symbols' in '@angular/core' typings."
8585

8686
grep "static ngInjectorDef: ɵngcc0.ɵɵInjectorDef<ApplicationModule>;" node_modules/@angular/core/core.d.ts
87-
assertSucceeded "Expected 'ivy-ngcc' to add a definition for 'ApplicationModule.ngInjectorDef' in '@angular/core' typings."
87+
assertSucceeded "Expected 'ngcc' to add a definition for 'ApplicationModule.ngInjectorDef' in '@angular/core' typings."
8888

8989

9090
# Did it generate a base factory call for synthesized constructors correctly?
9191
grep "const ɵMatTable_BaseFactory = ɵngcc0.ɵɵgetInheritedFactory(MatTable);" node_modules/@angular/material/esm2015/table.js
92-
assertSucceeded "Expected 'ivy-ngcc' to generate a base factory for 'MatTable' in '@angular/material' (esm2015)."
92+
assertSucceeded "Expected 'ngcc' to generate a base factory for 'MatTable' in '@angular/material' (esm2015)."
9393

9494
grep "const ɵMatTable_BaseFactory = ɵngcc0.ɵɵgetInheritedFactory(MatTable);" node_modules/@angular/material/esm5/table.es5.js
95-
assertSucceeded "Expected 'ivy-ngcc' to generate a base factory for 'MatTable' in '@angular/material' (esm5)."
95+
assertSucceeded "Expected 'ngcc' to generate a base factory for 'MatTable' in '@angular/material' (esm5)."
9696

9797

9898
# Did it generate a base definition for undecorated classes with inputs and view queries?
9999
grep "_MatMenuBase.ngBaseDef = ɵngcc0.ɵɵdefineBase({ inputs: {" node_modules/@angular/material/esm2015/menu.js
100-
assertSucceeded "Expected 'ivy-ngcc' to generate a base definition for 'MatMenuBase' in '@angular/material' (esm2015)."
100+
assertSucceeded "Expected 'ngcc' to generate a base definition for 'MatMenuBase' in '@angular/material' (esm2015)."
101101

102102
grep "_MatMenuBase.ngBaseDef = ɵngcc0.ɵɵdefineBase({ inputs: {" node_modules/@angular/material/esm5/menu.es5.js
103-
assertSucceeded "Expected 'ivy-ngcc' to generate a base definition for 'MatMenuBase' in '@angular/material' (esm5)."
103+
assertSucceeded "Expected 'ngcc' to generate a base definition for 'MatMenuBase' in '@angular/material' (esm5)."
104104

105105

106106
# Did it handle namespace imported decorators in UMD using `__decorate` syntax?
107107
grep "type: i0.Injectable" node_modules/@angular/common/bundles/common.umd.js
108-
assertSucceeded "Expected 'ivy-ngcc' to correctly handle '__decorate' syntax in '@angular/common' (umd)."
108+
assertSucceeded "Expected 'ngcc' to correctly handle '__decorate' syntax in '@angular/common' (umd)."
109109

110110
# (and ensure the @angular/common package is indeed using `__decorate` syntax)
111111
grep "JsonPipe = __decorate(" node_modules/@angular/common/bundles/common.umd.js.__ivy_ngcc_bak
@@ -114,7 +114,7 @@ assertSucceeded "Expected 'ivy-ngcc' to log 'Compiling'."
114114

115115
# Did it handle namespace imported decorators in UMD using static properties?
116116
grep "type: core.Injectable," node_modules/@angular/cdk/bundles/cdk-a11y.umd.js
117-
assertSucceeded "Expected 'ivy-ngcc' to correctly handle decorators via static properties in '@angular/cdk/a11y' (umd)."
117+
assertSucceeded "Expected 'ngcc' to correctly handle decorators via static properties in '@angular/cdk/a11y' (umd)."
118118

119119
# (and ensure the @angular/cdk/a11y package is indeed using static properties)
120120
grep "FocusMonitor.decorators =" node_modules/@angular/cdk/bundles/cdk-a11y.umd.js.__ivy_ngcc_bak
@@ -123,20 +123,20 @@ assertSucceeded "Expected 'ivy-ngcc' to log 'Compiling'."
123123

124124
# Can it be safely run again (as a noop)?
125125
# And check that it logged skipping compilation as expected
126-
ivy-ngcc -l debug | grep 'Skipping'
127-
assertSucceeded "Expected 'ivy-ngcc -l debug' to successfully rerun (as a noop) and log 'Skipping'."
126+
ngcc -l debug | grep 'Skipping'
127+
assertSucceeded "Expected 'ngcc -l debug' to successfully rerun (as a noop) and log 'Skipping'."
128128

129129
# Does it process the tasks in parallel?
130-
ivy-ngcc -l debug | grep 'Running ngcc on ClusterExecutor'
131-
assertSucceeded "Expected 'ivy-ngcc -l debug' to run in parallel mode (using 'ClusterExecutor')."
130+
ngcc -l debug | grep 'Running ngcc on ClusterExecutor'
131+
assertSucceeded "Expected 'ngcc -l debug' to run in parallel mode (using 'ClusterExecutor')."
132132

133133
# Check that running it with logging level error outputs nothing
134-
ivy-ngcc -l error | grep '.'
135-
assertFailed "Expected 'ivy-ngcc -l error' to not output anything."
134+
ngcc -l error | grep '.'
135+
assertFailed "Expected 'ngcc -l error' to not output anything."
136136

137137
# Does running it with --formats fail?
138-
ivy-ngcc --formats fesm2015
139-
assertFailed "Expected 'ivy-ngcc --formats fesm2015' to fail (since '--formats' is deprecated)."
138+
ngcc --formats fesm2015
139+
assertFailed "Expected 'ngcc --formats fesm2015' to fail (since '--formats' is deprecated)."
140140

141141
# Now try compiling the app using the ngcc compiled libraries
142142
ngc -p tsconfig-app.json
@@ -148,3 +148,11 @@ assertSucceeded "Expected the app to successfully compile with the ngcc-processe
148148

149149
grep "directives: \[.*\.MatButton.*\]" dist/src/main.js
150150
assertSucceeded "Expected the compiled app's 'main.ts' to list 'MatButton' in 'directives'."
151+
152+
153+
# 'ivy-ngcc' should fail with an appropriate error message.
154+
ivy-ngcc
155+
assertFailed "Expected 'ivy-ngcc' to fail (since it was renamed to 'ngcc')."
156+
157+
ivy-ngcc 2>&1 | grep "Error: The 'ivy-ngcc' command was renamed to just 'ngcc'. Please update your usage."
158+
assertSucceeded "Expected 'ivy-ngcc' to show an appropriate error message."
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env node
2+
/**
3+
* @license
4+
* Copyright Google Inc. All Rights Reserved.
5+
*
6+
* Use of this source code is governed by an MIT-style license that can be
7+
* found in the LICENSE file at https://angular.io/license
8+
*/
9+
10+
console.error(
11+
new Error('The \'ivy-ngcc\' command was renamed to just \'ngcc\'. Please update your usage.'));
12+
process.exit(1);

packages/compiler-cli/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"main": "index.js",
66
"typings": "index.d.ts",
77
"bin": {
8-
"ivy-ngcc": "./ngcc/main-ngcc.js",
8+
"ivy-ngcc": "./ngcc/main-ivy-ngcc.js",
9+
"ngcc": "./ngcc/main-ngcc.js",
910
"ngc": "./src/main.js",
1011
"ng-xi18n": "./src/extract_i18n.js"
1112
},

0 commit comments

Comments
 (0)