Skip to content

Commit

Permalink
feat: enable Ivy partial compilation
Browse files Browse the repository at this point in the history
BREAKING CHANGE
ngx-speculoos now targets Angular v12 and Ivy only.
Partial compilation is now enabled, allowing ngcc to skip this package.
  • Loading branch information
cexbrayat committed May 13, 2021
1 parent bad0b52 commit 5731919
Show file tree
Hide file tree
Showing 12 changed files with 1,515 additions and 2,476 deletions.
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -12,7 +12,6 @@

# profiling files
chrome-profiler-events.json
speed-measure-plugin.json

# IDEs and editors
/.idea
Expand Down
42 changes: 24 additions & 18 deletions angular.json
Expand Up @@ -12,15 +12,18 @@
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"tsConfig": "projects/ngx-speculoos/tsconfig.lib.json",
"project": "projects/ngx-speculoos/ng-package.json"
},
"configurations": {
"production": {
"project": "projects/ngx-speculoos/ng-package.prod.json",
"tsConfig": "projects/ngx-speculoos/tsconfig.lib.prod.json"
},
"development": {
"tsConfig": "projects/ngx-speculoos/tsconfig.lib.json"
}
}
},
"defaultConfiguration": "production"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
Expand Down Expand Up @@ -68,41 +71,44 @@
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
],
"fileReplacements": [
{
"replace": "projects/demo/src/environments/environment.ts",
"with": "projects/demo/src/environments/environment.prod.ts"
}
],
"buildOptimizer": true,
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
]
"vendorChunk": false
},
"development": {
"vendorChunk": true
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "demo:build"
},
"configurations": {
"production": {
"browserTarget": "demo:build:production"
},
"development": {
"browserTarget": "demo:build:development"
}
}
},
Expand Down
31 changes: 15 additions & 16 deletions package.json
Expand Up @@ -3,9 +3,10 @@
"version": "0.0.0",
"scripts": {
"ng": "ng",
"build": "ng build --prod",
"build": "ng build",
"test": "ng test --no-progress --no-watch --code-coverage --project=ngx-speculoos",
"demobuild": "ng build --prod --no-progress --project=demo",
"watch": "ng build --watch --configuration development",
"demobuild": "ng build --no-progress --project=demo",
"demotest": "ng test --no-progress --no-watch --project=demo",
"lint": "ng lint",
"release": "cd projects/ngx-speculoos && standard-version --infile ../../CHANGELOG.md",
Expand All @@ -16,26 +17,26 @@
},
"private": true,
"dependencies": {
"@angular/common": "11.2.14",
"@angular/compiler": "11.2.14",
"@angular/core": "11.2.14",
"@angular/forms": "11.2.14",
"@angular/platform-browser": "11.2.14",
"@angular/platform-browser-dynamic": "11.2.14",
"@angular/router": "11.2.14",
"@angular/common": "12.0.0",
"@angular/compiler": "12.0.0",
"@angular/core": "12.0.0",
"@angular/forms": "12.0.0",
"@angular/platform-browser": "12.0.0",
"@angular/platform-browser-dynamic": "12.0.0",
"@angular/router": "12.0.0",
"rxjs": "6.6.7",
"tslib": "2.2.0",
"zone.js": "0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "0.1102.13",
"@angular-devkit/build-angular": "12.0.0",
"@angular-eslint/builder": "4.3.0",
"@angular-eslint/eslint-plugin": "4.3.0",
"@angular-eslint/eslint-plugin-template": "4.3.0",
"@angular-eslint/schematics": "4.3.0",
"@angular-eslint/template-parser": "4.3.0",
"@angular/cli": "11.2.13",
"@angular/compiler-cli": "11.2.14",
"@angular/cli": "12.0.0",
"@angular/compiler-cli": "12.0.0",
"@compodoc/compodoc": "1.1.11",
"@types/jasmine": "3.7.2",
"@types/node": "12.20.13",
Expand All @@ -48,16 +49,14 @@
"eslint-plugin-deprecation": "1.2.1",
"eslint-plugin-prettier": "3.4.0",
"jasmine-core": "3.7.1",
"jasmine-spec-reporter": "7.0.0",
"karma": "6.3.2",
"karma-chrome-launcher": "3.1.0",
"karma-coverage": "2.0.3",
"karma-jasmine": "4.0.1",
"karma-jasmine-html-reporter": "1.6.0",
"ng-packagr": "11.2.4",
"ng-packagr": "12.0.0",
"prettier": "2.3.0",
"standard-version": "9.3.0",
"ts-node": "9.1.1",
"typescript": "4.1.5"
"typescript": "4.2.4"
}
}
4 changes: 2 additions & 2 deletions projects/demo/src/environments/environment.ts
@@ -1,5 +1,5 @@
// This file can be replaced during build by using the `fileReplacements` array.
// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
// `ng build` replaces `environment.ts` with `environment.prod.ts`.
// The list of file replacements can be found in `angular.json`.

export const environment = {
Expand All @@ -13,4 +13,4 @@ export const environment = {
* This import should be commented out in production mode because it will have a negative impact
* on performance if an error is thrown.
*/
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.
2 changes: 1 addition & 1 deletion projects/demo/src/polyfills.ts
Expand Up @@ -56,7 +56,7 @@
/***************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
import 'zone.js/dist/zone'; // Included with Angular CLI.
import 'zone.js'; // Included with Angular CLI.
/***************************************************************************************************
* APPLICATION IMPORTS
*/
2 changes: 1 addition & 1 deletion projects/demo/src/test.ts
@@ -1,6 +1,6 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files

import 'zone.js/dist/zone-testing';
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';

Expand Down
6 changes: 3 additions & 3 deletions projects/ngx-speculoos/package.json
Expand Up @@ -3,9 +3,9 @@
"version": "5.0.0",
"description": "Helps writing Angular unit tests",
"peerDependencies": {
"@angular/core": "^11.0.0",
"@angular/platform-browser": "^11.0.0",
"@angular/router": "^11.0.0",
"@angular/core": "^12.0.0",
"@angular/platform-browser": "^12.0.0",
"@angular/router": "^12.0.0",
"rxjs": "^6.5.4"
},
"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions projects/ngx-speculoos/src/test.ts
@@ -1,7 +1,7 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files

import 'zone.js/dist/zone';
import 'zone.js/dist/zone-testing';
import 'zone.js';
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';

Expand Down
28 changes: 10 additions & 18 deletions projects/ngx-speculoos/tsconfig.lib.json
@@ -1,28 +1,20 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"declarationMap": true,
"target": "es2015",
"module": "es2015",
"moduleResolution": "node",
"declaration": true,
"sourceMap": true,
"declarationMap": true,
"inlineSources": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"strict": true,
"types": ["@types/jasmine"],
"lib": ["dom", "es2018"]
},
"angularCompilerOptions": {
"skipTemplateCodegen": true,
"strictMetadataEmit": true,
"strictTemplates": true,
"strictInjectionParameters": true,
"flatModuleId": "AUTOGENERATED",
"flatModuleOutFile": "AUTOGENERATED"
"lib": [
"dom",
"es2018"
]
},
"exclude": ["src/test.ts", "**/*.spec.ts"]
"exclude": [
"src/test.ts",
"**/*.spec.ts"
]
}
3 changes: 2 additions & 1 deletion projects/ngx-speculoos/tsconfig.lib.prod.json
@@ -1,9 +1,10 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.lib.json",
"compilerOptions": {
"declarationMap": false
},
"angularCompilerOptions": {
"enableIvy": false
"compilationMode": "partial"
}
}
3 changes: 1 addition & 2 deletions tsconfig.json
Expand Up @@ -12,10 +12,9 @@
"declaration": false,
"module": "esnext",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "es2015",
"target": "es2017",
"typeRoots": [
"node_modules/@types"
],
Expand Down

0 comments on commit 5731919

Please sign in to comment.