Skip to content

Commit

Permalink
feat(ng-mat-core): Introducing @s-libs/ng-mat-core! A library of ut…
Browse files Browse the repository at this point in the history
…ility for Angular Material. The first things available: `SlDialogService` (#71)
  • Loading branch information
ersimont authored Dec 18, 2021
1 parent c850e95 commit 91de8e6
Show file tree
Hide file tree
Showing 47 changed files with 1,132 additions and 30 deletions.
13 changes: 13 additions & 0 deletions .idea/runConfigurations/ng_mat_core___build.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/runConfigurations/ng_mat_core___test_server.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 1 addition & 7 deletions .idea/s-libs.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 41 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,47 @@
}
}
},
"ng-mat-core": {
"projectType": "library",
"root": "projects/ng-mat-core",
"sourceRoot": "projects/ng-mat-core/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"project": "projects/ng-mat-core/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "projects/ng-mat-core/tsconfig.lib.prod.json"
},
"development": {
"tsConfig": "projects/ng-mat-core/tsconfig.lib.json"
}
},
"defaultConfiguration": "production"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/ng-mat-core/src/test.ts",
"tsConfig": "projects/ng-mat-core/tsconfig.spec.json",
"karmaConfig": "projects/ng-mat-core/karma.conf.js",
"polyfills": "projects/ng-mat-core/src/test-polyfills.ts"
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"projects/ng-mat-core/**/*.ts",
"projects/ng-mat-core/**/*.html"
]
}
}
}
},
"rxjs-core": {
"projectType": "library",
"root": "projects/rxjs-core",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@
},
"dependencies": {
"@angular/animations": "~13.0.0",
"@angular/cdk": "~13.0.0",
"@angular/common": "~13.0.0",
"@angular/compiler": "~13.0.0",
"@angular/core": "~13.0.0",
"@angular/forms": "~13.0.0",
"@angular/material": "~13.0.0",
"@angular/platform-browser": "~13.0.0",
"@angular/platform-browser-dynamic": "~13.0.0",
"@angular/router": "~13.0.0",
Expand All @@ -38,10 +40,8 @@
"@angular-eslint/eslint-plugin-template": "13.0.1",
"@angular-eslint/schematics": "13.0.1",
"@angular-eslint/template-parser": "13.0.1",
"@angular/cdk": "~13.0.0-next.0",
"@angular/cli": "~13.0.2",
"@angular/compiler-cli": "~13.0.0",
"@angular/material": "~13.0.1",
"@types/glob": "^7.2.0",
"@types/jasmine": "~3.10.0",
"@types/lodash-es": "^4.17.3",
Expand Down
16 changes: 16 additions & 0 deletions projects/app-state/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries

# For the full list of supported browsers by the Angular framework, please see:
# https://angular.io/guide/browser-support

# You can see what browsers were selected by your queries by running:
# npx browserslist

last 1 Chrome version
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR
4 changes: 3 additions & 1 deletion projects/app-state/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@
"@s-libs/micro-dash": "^13.0.0",
"@s-libs/rxjs-core": "^13.0.0"
},
"dependencies": { "tslib": "^2.3.0" }
"dependencies": {
"tslib": "^2.3.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
selector: 'sl-app-state-performance',
templateUrl: './app-state-performance.component.html',
styleUrls: ['./app-state-performance.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AppStatePerformanceComponent {}
16 changes: 16 additions & 0 deletions projects/js-core/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries

# For the full list of supported browsers by the Angular framework, please see:
# https://angular.io/guide/browser-support

# You can see what browsers were selected by your queries by running:
# npx browserslist

last 1 Chrome version
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR
8 changes: 6 additions & 2 deletions projects/js-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
"url": "https://github.com/simontonsoftware/s-libs.git",
"directory": "projects/js-core"
},
"peerDependencies": { "@s-libs/micro-dash": "^13.0.0" },
"dependencies": { "tslib": "^2.3.0" }
"peerDependencies": {
"@s-libs/micro-dash": "^13.0.0"
},
"dependencies": {
"tslib": "^2.3.0"
}
}
16 changes: 16 additions & 0 deletions projects/micro-dash/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries

# For the full list of supported browsers by the Angular framework, please see:
# https://angular.io/guide/browser-support

# You can see what browsers were selected by your queries by running:
# npx browserslist

last 1 Chrome version
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR
5 changes: 4 additions & 1 deletion projects/micro-dash/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@
"url": "https://github.com/simontonsoftware/s-libs.git",
"directory": "projects/micro-dash"
},
"dependencies": { "tslib": "^2.3.0", "utility-types": "^3.10.0" }
"dependencies": {
"tslib": "^2.3.0",
"utility-types": "^3.10.0"
}
}
16 changes: 16 additions & 0 deletions projects/ng-app-state/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries

# For the full list of supported browsers by the Angular framework, please see:
# https://angular.io/guide/browser-support

# You can see what browsers were selected by your queries by running:
# npx browserslist

last 1 Chrome version
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR
4 changes: 3 additions & 1 deletion projects/ng-app-state/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@
"@s-libs/ng-core": "^13.0.0",
"@s-libs/rxjs-core": "^13.0.0"
},
"dependencies": { "tslib": "^2.3.0" }
"dependencies": {
"tslib": "^2.3.0"
}
}
16 changes: 16 additions & 0 deletions projects/ng-core/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries

# For the full list of supported browsers by the Angular framework, please see:
# https://angular.io/guide/browser-support

# You can see what browsers were selected by your queries by running:
# npx browserslist

last 1 Chrome version
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR
4 changes: 2 additions & 2 deletions projects/ng-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ To quickly see what is available, see the [api documentation](https://simontonso
Install along with its peer dependencies using:

```shell script
npm install --save @s-libs/js-core @s-libs/micro-dash
npm install --save @s-libs/rxjs-core @s-libs/js-core @s-libs/micro-dash

# OR

yarn add @s-libs/js-core @s-libs/micro-dash
yarn add @s-libs/rxjs-core @s-libs/js-core @s-libs/micro-dash
```
4 changes: 3 additions & 1 deletion projects/ng-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@
"@s-libs/micro-dash": "^13.0.0",
"@s-libs/rxjs-core": "^13.0.0"
},
"dependencies": { "tslib": "^2.3.0" }
"dependencies": {
"tslib": "^2.3.0"
}
}
16 changes: 16 additions & 0 deletions projects/ng-dev/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries

# For the full list of supported browsers by the Angular framework, please see:
# https://angular.io/guide/browser-support

# You can see what browsers were selected by your queries by running:
# npx browserslist

last 1 Chrome version
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR
49 changes: 49 additions & 0 deletions projects/ng-dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,52 @@ To quickly see what is available, see the [api documentation](https://simontonso
yarn add @s-libs/ng-core @s-libs/rxjs-core @s-libs/js-core @s-libs/micro-dash @angular/cdk
yarn add -D @s-libs/ng-dev
```

## Fixing Jasmine Clock

If you are creating a library project and use [`Angular Context`](https://simontonsoftware.github.io/s-libs/ng-dev/classes/AngularContext.html) or [`Component Context`](https://simontonsoftware.github.io/s-libs/ng-dev/classes/ComponentContext.html) for its tests, you may run into this error:

```
Error: Jasmine Clock was unable to install over custom global timer functions. Is the clock already installed?
```

You can see details on Angular's issue filed [here](https://github.com/angular/angular-cli/issues/14432). To work around it, create a new file `projects/your-lib-name/src/test-polyfills.ts` with this code:

```ts
// This file can be deleted after https://github.com/angular/angular-cli/issues/14432. Be sure to delete it from `angular.json`, `tsconfig.lib.json`, and `tsconfig.spec.json`, too.
import "zone.js";
```

Add this innermost "polyfills" line to your `angular.json`:

```json
{
"projects": {
"your-lib-name": {
"architect": {
"test": {
"options": {
"polyfills": "projects/ng-mat-core/src/test-polyfills.ts"
}
}
}
}
}
}
```

Add it to the "exclude" property in your `tsconfig.lib.json`:

```json
{
"exclude": ["src/test-polyfills.ts"]
}
```

Add it to the "include" property in `tsconfig.spec.json`:

```json
{
"include": ["src/test-polyfills.ts"]
}
```
4 changes: 3 additions & 1 deletion projects/ng-dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@
"@s-libs/rxjs-core": "^13.0.0",
"jasmine-core": "^3.10.0"
},
"dependencies": { "tslib": "^2.3.0" }
"dependencies": {
"tslib": "^2.3.0"
}
}
16 changes: 16 additions & 0 deletions projects/ng-mat-core/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries

# For the full list of supported browsers by the Angular framework, please see:
# https://angular.io/guide/browser-support

# You can see what browsers were selected by your queries by running:
# npx browserslist

last 1 Chrome version
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR
21 changes: 21 additions & 0 deletions projects/ng-mat-core/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"extends": "../../.eslintrc.json",
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts"],
"parserOptions": {
"project": [
"projects/ng-mat-core/tsconfig.lib.json",
"projects/ng-mat-core/tsconfig.spec.json"
],
"createDefaultProgram": true
},
"rules": {}
},
{
"files": ["*.html"],
"rules": {}
}
]
}
Loading

0 comments on commit 91de8e6

Please sign in to comment.