Skip to content

Commit

Permalink
feat: add ivy partial build
Browse files Browse the repository at this point in the history
  • Loading branch information
stumpam committed Feb 14, 2022
1 parent 23804da commit 4b69e84
Show file tree
Hide file tree
Showing 16 changed files with 3,188 additions and 5,097 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
!.vscode/extensions.json

# misc
/.angular/cache
/.sass-cache
/connect.lock
/coverage
Expand Down
50 changes: 9 additions & 41 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,6 @@
"browserTarget": "demo:build"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"apps/demo/tsconfig.app.json",
"apps/demo/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**",
"!apps/demo/**/*"
]
}
},
"test": {
"builder": "@nrwl/jest:jest",
"options": {
Expand All @@ -103,7 +90,8 @@
"coverage/apps/demo"
]
}
}
},
"tags": []
},
"demo-e2e": {
"root": "apps/demo-e2e",
Expand All @@ -122,20 +110,12 @@
"devServerTarget": "demo:serve:production"
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"apps/demo-e2e/tsconfig.e2e.json"
],
"exclude": [
"**/node_modules/**",
"!apps/demo-e2e/**/*"
]
}
}
}
},
"tags": [],
"implicitDependencies": [
"demo"
]
},
"ngx-masked-input": {
"projectType": "library",
Expand All @@ -156,19 +136,6 @@
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"libs/ngx-masked-input/tsconfig.lib.json",
"libs/ngx-masked-input/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**",
"!libs/ngx-masked-input/**/*"
]
}
},
"test": {
"builder": "@nrwl/jest:jest",
"options": {
Expand All @@ -184,7 +151,8 @@
"@nrwl/angular:component": {
"style": "scss"
}
}
},
"tags": []
}
}
}
21 changes: 9 additions & 12 deletions apps/demo/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,19 @@ module.exports = {
name: 'demo',
preset: '../../jest.config.js',
coverageDirectory: '../../coverage/apps/demo',
snapshotSerializers: [
'jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js',
'jest-preset-angular/build/AngularSnapshotSerializer.js',
'jest-preset-angular/build/HTMLCommentSerializer.js',
],

setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
globals: {
'ts-jest': {
tsConfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
astTransformers: {
before: [
'jest-preset-angular/build/InlineFilesTransformer',
'jest-preset-angular/build/StripStylesTransformer',
],
},

tsconfig: '<rootDir>/tsconfig.spec.json',
},
},
snapshotSerializers: [
'jest-preset-angular/build/serializers/no-ng-attributes',
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment',
],
transform: { '^.+\\.(ts|js|html)$': 'jest-preset-angular' },
};
10 changes: 0 additions & 10 deletions apps/demo/src/polyfills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,6 @@
* BROWSER POLYFILLS
*/

/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`.

/**
* Web Animations `@angular/platform-browser/animations`
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
*/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.

/**
* By default, zone.js will patch all possible macroTask and DomEvents
* user can disable parts of macroTask/DomEvents patch by setting following flags
Expand Down
15 changes: 14 additions & 1 deletion apps/demo/src/test-setup.ts
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
import 'jest-preset-angular';
import 'jest-preset-angular/setup-jest';

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

getTestBed().resetTestEnvironment();
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(),
{ teardown: { destroyAfterEach: false } },
);
2 changes: 1 addition & 1 deletion apps/demo/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"types": ["jest", "node"]
},
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
"include": ["**/*.spec.ts", "**/*.test.ts", "**/*.d.ts"]
}
7 changes: 5 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
const { getJestProjects } = require('@nrwl/jest');

module.exports = {
testMatch: ['**/+(*.)+(spec|test).+(ts|js)?(x)'],
transform: {
'^.+\\.(ts|js|html)$': 'ts-jest'
'^.+\\.(ts|js|html)$': 'ts-jest',
},
resolver: '@nrwl/jest/plugins/resolver',
moduleFileExtensions: ['ts', 'js', 'html'],
coverageReporters: ['html']
coverageReporters: ['html'],
projects: getJestProjects(),
};
21 changes: 9 additions & 12 deletions libs/ngx-masked-input/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,19 @@ module.exports = {
name: 'ngx-masked-input',
preset: '../../jest.config.js',
coverageDirectory: '../../coverage/libs/ngx-masked-input',
snapshotSerializers: [
'jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js',
'jest-preset-angular/build/AngularSnapshotSerializer.js',
'jest-preset-angular/build/HTMLCommentSerializer.js',
],

setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
globals: {
'ts-jest': {
tsConfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
astTransformers: {
before: [
'jest-preset-angular/build/InlineFilesTransformer',
'jest-preset-angular/build/StripStylesTransformer',
],
},

tsconfig: '<rootDir>/tsconfig.spec.json',
},
},
snapshotSerializers: [
'jest-preset-angular/build/serializers/no-ng-attributes',
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment',
],
transform: { '^.+\\.(ts|js|html)$': 'jest-preset-angular' },
};
2 changes: 1 addition & 1 deletion libs/ngx-masked-input/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@stumpam/ngx-masked-input",
"license": "MIT",
"version": "3.2.3",
"version": "3.3.0",
"description": "Angular Date picker with masked input.",
"homepage": "https://github.com/stumpam/ngx-masked-input",
"author": "Martin Štumpa (https://github.com/stumpam)",
Expand Down
15 changes: 14 additions & 1 deletion libs/ngx-masked-input/src/test-setup.ts
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
import 'jest-preset-angular';
import 'jest-preset-angular/setup-jest';

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

getTestBed().resetTestEnvironment();
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(),
{ teardown: { destroyAfterEach: false } },
);
2 changes: 1 addition & 1 deletion libs/ngx-masked-input/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"enableResourceInlining": true,
"enableIvy": false
},
"exclude": ["src/test-setup.ts", "**/*.spec.ts"],
"exclude": ["src/test-setup.ts", "**/*.spec.ts", "**/*.test.ts"],
"files": [],
"include": []
}
2 changes: 1 addition & 1 deletion libs/ngx-masked-input/tsconfig.lib.prod.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "./tsconfig.lib.json",
"angularCompilerOptions": {
"enableIvy": false
"compilationMode": "partial"
}
}
2 changes: 1 addition & 1 deletion libs/ngx-masked-input/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"types": ["jest", "node"]
},
"files": ["src/test-setup.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts"]
"include": ["**/*.spec.ts", "**/*.test.ts", "**/*.d.ts"]
}
25 changes: 10 additions & 15 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,6 @@
"nx.json": "*",
"tsconfig.base.json": "*"
},
"projects": {
"demo": {
"tags": []
},
"demo-e2e": {
"tags": [],
"implicitDependencies": [
"demo"
]
},
"ngx-masked-input": {
"tags": []
}
},
"affected": {
"defaultBase": "master"
},
Expand All @@ -36,7 +22,8 @@
"lint",
"test",
"e2e"
]
],
"parallel": 1
}
}
},
Expand All @@ -53,5 +40,13 @@
"@nrwl/angular:library": {
"unitTestRunner": "jest"
}
},
"targetDependencies": {
"build": [
{
"target": "build",
"projects": "dependencies"
}
]
}
}
Loading

0 comments on commit 4b69e84

Please sign in to comment.