Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to angular 11 #874

Merged
merged 5 commits into from
Nov 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions MIGRATION.MD
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Migration from version 10 to version 11

## No action needed

# Migration from version 9 to version 10

## Jest builder
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

The purpose of this repository is to consolidate all the community builders for Angular build facade.

## The latest version of all the builders require Angular CLI 10
## The latest version of all the builders require Angular CLI 11

## [Documentation for version 7](https://github.com/just-jeb/angular-builders/tree/7.x.x)

## [Documentation for version 8](https://github.com/just-jeb/angular-builders/tree/8.x.x)

## [Documentation for version 9](https://github.com/just-jeb/angular-builders/tree/9.x.x)

## [Documentation for version 10](https://github.com/just-jeb/angular-builders/tree/10.x.x)

## [Migration guide](./MIGRATION.MD)

# Builders
Expand Down Expand Up @@ -56,6 +58,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d

<!-- markdownlint-enable -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
1 change: 1 addition & 0 deletions packages/custom-webpack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Allow customizing build configuration without ejecting webpack configuration (`n
- [Version 7](https://github.com/just-jeb/angular-builders/blob/7.x.x/packages/custom-webpack/README.md)
- [Version 8](https://github.com/just-jeb/angular-builders/blob/8.x.x/packages/custom-webpack/README.md)
- [Version 9](https://github.com/just-jeb/angular-builders/blob/9.x.x/packages/custom-webpack/README.md)
- [Version 10](https://github.com/just-jeb/angular-builders/blob/10.x.x/packages/custom-webpack/README.md)

## Prerequisites:

Expand Down
36 changes: 18 additions & 18 deletions packages/custom-webpack/examples/full-cycle-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,39 @@
},
"private": true,
"dependencies": {
"@angular/animations": "^10.0.0",
"@angular/common": "^10.0.0",
"@angular/compiler": "^10.0.0",
"@angular/core": "^10.0.0",
"@angular/forms": "^10.0.0",
"@angular/platform-browser": "^10.0.0",
"@angular/platform-browser-dynamic": "^10.0.0",
"@angular/router": "^10.0.0",
"@angular/animations": "^11.0.0",
"@angular/common": "^11.0.0",
"@angular/compiler": "^11.0.0",
"@angular/core": "^11.0.0",
"@angular/forms": "^11.0.0",
"@angular/platform-browser": "^11.0.0",
"@angular/platform-browser-dynamic": "^11.0.0",
"@angular/router": "^11.0.0",
"rxjs": "~6.5.2",
"tslib": "^2.0.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-builders/custom-webpack": "latest",
"@angular-devkit/build-angular": ">=0.1000.0 < 0.1100.0",
"@angular/cli": "^10.0.0",
"@angular/compiler-cli": "^10.0.0",
"@angular/language-service": "^10.0.0",
"@types/jasmine": "~3.3.13",
"@angular-devkit/build-angular": ">=0.1100.0 < 0.1200.0",
"@angular/cli": "^11.0.1",
"@angular/compiler-cli": "^11.0.0",
"@angular/language-service": "^11.0.0",
"@types/jasmine": "~3.6.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"codelyzer": "^5.1.2",
"codelyzer": "^6.0.0",
"html-webpack-plugin": "^3.2.0",
"jasmine-core": "~3.5.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.0.0",
"karma": "~5.1.1",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~3.3.0",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"ts-node": "~8.1.1",
"tslint": "~6.1.0",
"typescript": "~3.9.5"
"typescript": "~4.0.5"
}
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,36 @@
import { TestBed, async } from '@angular/core/testing';
import { TestBed, waitForAsync } from '@angular/core/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [AppComponent],
}).compileComponents();
}));
it('should create the app', async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
it(`should have as title 'app'`, async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('full-cycle-app');
}));
it('should render title in a h1 tag', async(() => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('Welcome to full-cycle-app!');
}));
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [AppComponent],
}).compileComponents();
})
);
it(
'should create the app',
waitForAsync(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
})
);
it(
`should have as title 'app'`,
waitForAsync(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('full-cycle-app');
})
);
it(
'should render title in a h1 tag',
waitForAsync(() => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('Welcome to full-cycle-app!');
})
);
});
36 changes: 18 additions & 18 deletions packages/custom-webpack/examples/sanity-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,38 @@
},
"private": true,
"dependencies": {
"@angular/animations": "^10.0.0",
"@angular/common": "^10.0.0",
"@angular/compiler": "^10.0.0",
"@angular/core": "^10.0.0",
"@angular/forms": "^10.0.0",
"@angular/platform-browser": "^10.0.0",
"@angular/platform-browser-dynamic": "^10.0.0",
"@angular/router": "^10.0.0",
"@angular/animations": "^11.0.0",
"@angular/common": "^11.0.0",
"@angular/compiler": "^11.0.0",
"@angular/core": "^11.0.0",
"@angular/forms": "^11.0.0",
"@angular/platform-browser": "^11.0.0",
"@angular/platform-browser-dynamic": "^11.0.0",
"@angular/router": "^11.0.0",
"rxjs": "~6.5.2",
"tslib": "^2.0.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-builders/custom-webpack": "latest",
"@angular-devkit/build-angular": ">=0.1000.0 < 0.1100.0",
"@angular/cli": "^10.0.0",
"@angular/compiler-cli": "^10.0.0",
"@angular/language-service": "^10.0.0",
"@types/jasmine": "~3.3.13",
"@angular-devkit/build-angular": ">=0.1100.0 < 0.1200.0",
"@angular/cli": "^11.0.1",
"@angular/compiler-cli": "^11.0.0",
"@angular/language-service": "^11.0.0",
"@types/jasmine": "~3.6.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.5.0",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.0.0",
"karma": "~5.1.1",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~3.3.0",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"ts-node": "~8.2.0",
"tslint": "~6.1.0",
"typescript": "~3.9.5"
"typescript": "~4.0.5"
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { TestBed, async } from '@angular/core/testing';
import { TestBed, waitForAsync } from '@angular/core/testing';
import { AppComponent } from './app.component';

describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [AppComponent],
}).compileComponents();
}));
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [AppComponent],
}).compileComponents();
})
);

it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
Expand Down
6 changes: 3 additions & 3 deletions packages/custom-webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
},
"builders": "builders.json",
"dependencies": {
"@angular-devkit/architect": ">=0.1000.0 < 0.1100.0",
"@angular-devkit/build-angular": ">=0.1000.0 < 0.1100.0",
"@angular-devkit/core": "^10.0.0",
"@angular-devkit/architect": ">=0.1100.0 < 0.1200.0",
"@angular-devkit/build-angular": ">=0.1100.0 < 0.1200.0",
"@angular-devkit/core": "^11.0.0",
"lodash": "^4.17.15",
"ts-node": "^9.0.0",
"webpack-merge": "^4.2.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/custom-webpack/src/generic-browser-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
BuilderHandlerFn,
} from '@angular-devkit/architect';
import { ExecutionTransformer } from '@angular-devkit/build-angular';
import { IndexHtmlTransform } from '@angular-devkit/build-angular/src/angular-cli-files/utilities/index-file/write-index-html';
import { IndexHtmlTransform } from '@angular-devkit/build-angular/src/utils/index-file/write-index-html';
import { from } from 'rxjs';
import { switchMap } from 'rxjs/operators';
import { Configuration } from 'webpack';
Expand Down
2 changes: 1 addition & 1 deletion packages/custom-webpack/src/transform-factories.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BuilderContext } from '@angular-devkit/architect';
import { ExecutionTransformer } from '@angular-devkit/build-angular';
import { IndexHtmlTransform } from '@angular-devkit/build-angular/src/angular-cli-files/utilities/index-file/write-index-html';
import { IndexHtmlTransform } from '@angular-devkit/build-angular/src/utils/index-file/write-index-html';
import { getSystemPath, normalize } from '@angular-devkit/core';
import { Configuration } from 'webpack';
import { CustomWebpackBuilder } from './custom-webpack-builder';
Expand Down
3 changes: 2 additions & 1 deletion packages/jest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ The builder comes to provide zero configuration setup for Jest while keeping the
- [Version 7](https://github.com/just-jeb/angular-builders/blob/7.x.x/packages/custom-webpack/README.md)
- [Version 8](https://github.com/just-jeb/angular-builders/blob/8.x.x/packages/custom-webpack/README.md)
- [Version 9](https://github.com/just-jeb/angular-builders/blob/9.x.x/packages/custom-webpack/README.md)
- [Version 10](https://github.com/just-jeb/angular-builders/blob/10.x.x/packages/custom-webpack/README.md)

## Prerequisites

- [Angular CLI 10](https://www.npmjs.com/package/@angular/cli)
- [Angular CLI 11](https://www.npmjs.com/package/@angular/cli)
- [Jest 26](https://www.npmjs.com/package/jest)

## Installation
Expand Down
4 changes: 1 addition & 3 deletions packages/jest/examples/multiple-apps/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
Expand Down Expand Up @@ -149,7 +148,6 @@
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
Expand Down Expand Up @@ -227,7 +225,7 @@
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"tsConfig": "projects/my-shared-library/tsconfig.lib.json",
"project": "projects/my-shared-library/ng-package.json"
Expand Down
38 changes: 18 additions & 20 deletions packages/jest/examples/multiple-apps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,39 @@
"build": "yarn ng build",
"test": "yarn ng test",
"lint": "yarn ng lint",
"e2e": "yarn ng e2e",
"postinstall": "ngcc"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the ngcc postinstall has been removed?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

postinstall is no longer recommended (it it faster to process libs that application will import than whole node_modules)
https://github.com/angular/angular/blob/master/CHANGELOG.md#910-2020-03-25

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ngcc produced a warning because of a "solution-style" tsconfig. When I tried to resolve the warning, I found the PR angular/angular#38003 introducing it and found this comment of an angular team member:

Currently our docs do not recommend running ngcc as a postinstall hook, except for a particular scenario related to Angular Universal: https://angular.io/guide/ivy#ivy-and-universalapp-shell.

I tried without the ngcc postinstall and it did work without any issues. Therefore I have removed it.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting... The ngcc here was rather for example than because of actual need. The thing is that Angular CLI builders (including Karma) use Angular tool chain on order to prepare files for tests, while Jest doesn't. This means that there is no way to run ngcc programmatically only on libraries that you need (because ts-jest doesn't utilize Angular tool chain).
Well, there is a way but it's very complicated and requires major rewrite of ts-jest.
Hence, if your app uses incompatible libs (that were not compiled with Ivy) you have to run ngcc manually on these libs.
I guess we can remove it from the examples and add to the docs, this should be enough.

"e2e": "yarn ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^10.0.0",
"@angular/common": "^10.0.0",
"@angular/compiler": "^10.0.0",
"@angular/core": "^10.0.0",
"@angular/forms": "^10.0.0",
"@angular/platform-browser": "^10.0.0",
"@angular/platform-browser-dynamic": "^10.0.0",
"@angular/router": "^10.0.0",
"@angular/animations": "^11.0.0",
"@angular/common": "^11.0.0",
"@angular/compiler": "^11.0.0",
"@angular/core": "^11.0.0",
"@angular/forms": "^11.0.0",
"@angular/platform-browser": "^11.0.0",
"@angular/platform-browser-dynamic": "^11.0.0",
"@angular/router": "^11.0.0",
"rxjs": "~6.5.2",
"tslib": "^2.0.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-builders/jest": "latest",
"@angular-devkit/build-angular": ">=0.1000.0 < 0.1100.0",
"@angular-devkit/build-ng-packagr": ">=0.1000.0 < 0.1100.0",
"@angular/cli": "^10.0.0",
"@angular/compiler-cli": "^10.0.0",
"@angular/language-service": "^10.0.0",
"@types/jasmine": "~3.3.13",
"@angular-devkit/build-angular": ">=0.1100.0 < 0.1200.0",
"@angular/cli": "^11.0.1",
"@angular/compiler-cli": "^11.0.0",
"@angular/language-service": "^11.0.0",
"@types/jasmine": "~3.6.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.5.0",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"jest": "^26.1.0",
"ng-packagr": "^10.0.0",
"ng-packagr": "^11.0.2",
"protractor": "~7.0.0",
"ts-node": "~8.2.0",
"tslint": "~6.1.0",
"typescript": "~3.9.5"
"typescript": "~4.0.5"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"declarationMap": true,
"target": "es2015",
"declaration": true,
"inlineSources": true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"extends": "./tsconfig.lib.json",
"compilerOptions": {
"declarationMap": false
},
"angularCompilerOptions": {
"enableIvy": false
}
Expand Down
1 change: 0 additions & 1 deletion packages/jest/examples/simple-app/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
Expand Down
Loading