Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Heatmanofurioso committed Feb 14, 2022
2 parents 436f769 + d5c2dda commit 902c5ca
Show file tree
Hide file tree
Showing 16 changed files with 4,744 additions and 2,788 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
118 changes: 118 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
{
"root": true,
"ignorePatterns": [
"!**/*"
],
"overrides": [
{
"files": [
"*.ts"
],
"parserOptions": {
"project": [
"src/tsconfig.app.json"
],
"createDefaultProgram": true
},
"extends": [
"plugin:@angular-eslint/ng-cli-compat",
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates",
"plugin:@angular-eslint/recommended--extra"
],
"rules": {
"no-shadow": "off",
"@typescript-eslint/no-shadow": [
"error"
],
"prefer-arrow/prefer-arrow-functions": [
"warn",
{
"disallowPrototype": true,
"singleReturnOnly": false,
"classPropertiesAllowed": false
}
],
"@angular-eslint/directive-selector": [
"warn",
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"warn",
{
"type": "element",
"prefix": "",
"style": "kebab-case"
}
],
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/dot-notation": "off",
"@typescript-eslint/explicit-member-accessibility": [
"off",
{
"accessibility": "explicit"
}
],
"@typescript-eslint/naming-convention": [
"warn",
{
"selector": "variable",
"format": [
"camelCase"
]
}
],
"@typescript-eslint/ban-types": [
"error",
{
"types": {
"String": false,
"Boolean": false,
"Number": false,
"Symbol": false,
"{}": false,
"Object": false,
"object": false,
"Function": false
},
"extendDefaults": true
}
],
"@typescript-eslint/no-use-before-define": "error",
"brace-style": [
"error",
"1tbs"
],
"id-blacklist": "off",
"id-match": "off",
"max-len": [
"error",
{
"code": 240
}
],
"no-underscore-dangle": "off"
}
},
{
"files": [
"*.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended"
],
"rules": {
"@angular-eslint/template/eqeqeq": [
"error",
{
"allowNullOrUndefined": true
}
]
}
}
]
}
5 changes: 5 additions & 0 deletions .huskyrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"hooks": {
"pre-commit": "npm run lint"
}
}
17 changes: 17 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

# [1.3.1] - 2022-02-14
- Update Angular to 13.2.2
- Update ESLint
- Update Jest
- Update TSLint and types

# [1.3.0] - 2022-01-24
- Added ability to disable src cache
- Added missing postinstall hook for Husky in package.json

# [1.2.1] - 2022-01-24
- Add Husky Git Hooks
- Migrate from TSLint to ESLint
#Fixed
- Updated several dependencies
- Update Angular minor version

## [1.2.0] - 2021-11-07
### Fixed
- Migrate Angular to V13.
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
[![Angular Style Guide](https://mgechev.github.io/angular2-style-guide/images/badge.svg)](https://angular.io/styleguide)
![size](https://img.shields.io/bundlephobia/minzip/ngx-avatars.svg)

## NPM Project
[ngx-avatars](https://www.npmjs.com/package/ngx-avatars)

## Warning
Do not confuse with [ngx-avatar](https://github.com/HaithemMosbahi/ngx-avatar) This project is it's spiritual successor, and all credit goes to HaithemMosbahi and his fellow contributors which
will remain in this project's contributing list.
Expand Down Expand Up @@ -258,6 +261,9 @@ export class AppModule { }
```

## Release Notes & History
* 1.3.1: Update dependencies
* 1.3.0: Added ability to disable src cache.
* 1.2.1: Updated several dependencies. Update Angular minor version. Add Husky Git Hooks. Migrate from TSLint to ESLint
* 1.2.0: Migrate Angular to V13. Migrate RXJS to V7.4.0
* 1.1.3: Fix package versioning in release
* 1.1.2: Fixed build issues.
Expand Down
19 changes: 19 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": 1,
"cli": {
"analytics": "1c209c8f-e553-45c3-b475-c1943e1d601f",
"defaultCollection": "@angular-eslint/schematics",
"packageManager": "yarn"
},
"newProjectRoot": "projects",
Expand Down Expand Up @@ -116,6 +117,15 @@
],
"watch": false
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"src/**/*.ts",
"src/**/*.html"
]
}
}
}
},
Expand Down Expand Up @@ -163,6 +173,15 @@
"polyfills": ["src/polyfills.ts"],
"tsConfig": "src/tsconfig.spec.json"
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"src/**/*.ts",
"src/**/*.html"
]
}
}
}
}
Expand Down
61 changes: 36 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,45 +19,57 @@
"start": "ng serve",
"build": "ng build --configuration production",
"postbuild": "node scripts/copy-artifacts.js",
"postinstall": "ngcc && husky install",
"deploy": "cd dist/ngx-avatars && npm publish",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": false,
"dependencies": {
"@angular/animations": "^13.0.0",
"@angular/common": "^13.0.0",
"@angular/compiler": "^13.0.0",
"@angular/core": "^13.0.0",
"@angular/forms": "^13.0.0",
"@angular/platform-browser": "^13.0.0",
"@angular/platform-browser-dynamic": "^13.0.0",
"@angular/router": "^13.0.0",
"@angular/animations": "^13.2.2",
"@angular/common": "^13.2.2",
"@angular/compiler": "^13.2.2",
"@angular/core": "^13.2.2",
"@angular/forms": "^13.2.2",
"@angular/platform-browser": "^13.2.2",
"@angular/platform-browser-dynamic": "^13.2.2",
"@angular/router": "^13.2.2",
"rxjs": "^7.4.0",
"ts-md5": "^1.2.9",
"ts-md5": "^1.2.11",
"tslib": "^2.3.1",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-builders/jest": "12.1.2",
"@angular-devkit/build-angular": "~13.0.1",
"@angular-builders/jest": "13.0.3",
"@angular-devkit/build-angular": "~13.2.3",
"@angular-devkit/build-ng-packagr": "~0.1002.0",
"@angular/cli": "~13.0.1",
"@angular/compiler-cli": "^13.0.0",
"@angular/language-service": "^13.0.0",
"@angular-eslint/builder": "13.1.0",
"@angular-eslint/eslint-plugin": "13.1.0",
"@angular-eslint/eslint-plugin-template": "13.1.0",
"@angular-eslint/schematics": "13.1.0",
"@angular-eslint/template-parser": "13.1.0",
"@angular/cli": "~13.2.3",
"@angular/compiler-cli": "^13.2.2",
"@angular/language-service": "^13.2.2",
"@testing-library/jest-dom": "5.16.2",
"@types/jest": "27.4.0",
"@types/node": "^17.0.18",
"@typescript-eslint/eslint-plugin": "5.12.0",
"@typescript-eslint/parser": "5.12.0",
"codelyzer": "^6.0.2",
"@testing-library/jest-dom": "5.15.0",
"@types/node": "^16.11.6",
"@types/jest": "27.0.2",
"jest": "27.3.1",
"jest-preset-angular": "11.0.0-rc.1",
"ng-packagr": "^13.0.2",
"eslint": "8.9.0",
"eslint-plugin-import": "2.25.4",
"eslint-plugin-jsdoc": "37.9.1",
"eslint-plugin-prefer-arrow": "1.2.3",
"husky": "^7.0.4",
"jest": "27.5.1",
"jest-preset-angular": "11.1.1",
"ng-packagr": "^13.2.1",
"protractor": "~7.0.0",
"ts-jest": "27.0.7",
"ts-node": "~10.4.0",
"tslint": "~6.1.3",
"typescript": "~4.4.4"
"ts-jest": "27.1.3",
"ts-node": "~10.5.0",
"typescript": "~4.5.4"
},
"jest": {
"preset": "jest-preset-angular",
Expand All @@ -80,4 +92,3 @@
}
}
}

16 changes: 12 additions & 4 deletions projects/ngx-avatars/package.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
{
"name": "ngx-avatars",
"description": "A universal avatar component for Angular applications that fetches / generates avatar based on the information you have about the user.",
"version": "1.2.0",
"version": "1.3.1",
"keywords": [
"angular",
"avatar",
"avatars",
"badge",
"gravatar",
"component",
"initials"
],
"author": {
"name": "Heatmanofurioso",
"url": "https://github.com/Heatmanofurioso",
"email": "[email protected]"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/Heatmanofurioso/ngx-avatars"
},
"sideEffects": false,
"dependencies": {
"ts-md5": "^1.2.9",
"ts-md5": "^1.2.11",
"tslib": "^2.3.1"
},
"peerDependencies": {
"@angular/common": "^13.0.0",
"@angular/core": "^13.0.0"
"@angular/common": "^13.2.2",
"@angular/core": "^13.2.2"
}
}
25 changes: 24 additions & 1 deletion projects/ngx-avatars/src/lib/avatar-config.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AvatarConfigService } from './avatar-config.service';
import { AvatarSource } from './sources/avatar-source.enum';
import { AvatarConfig } from './avatar-config';
import { defaultSources, defaultColors } from './avatar.service';
import { defaultSources, defaultColors, defaultDisableSrcCache } from './avatar.service';

describe('AvatarConfigService', () => {
describe('AvatarSources', () => {
Expand Down Expand Up @@ -105,3 +105,26 @@ describe('AvatarConfigService', () => {
});
});
});

describe('AvatarDisableCache', () => {
it('should return the user\'s disable custom source cache settings when provided in the avatar configuration', () => {
const userDisableSrcCache = true;
const userConfig: AvatarConfig = {
disableSrcCache: userDisableSrcCache
};

const avatarConfigService = new AvatarConfigService(userConfig);

expect(avatarConfigService.getDisableSrcCache(defaultDisableSrcCache)).toBe(
userDisableSrcCache
);
});

it('should return the default disable custom source cache settings when no settings are provided in the avatar configuration', () => {
const avatarConfigService = new AvatarConfigService({});

expect(avatarConfigService.getDisableSrcCache(defaultDisableSrcCache)).toBe(
defaultDisableSrcCache
);
});
});
10 changes: 9 additions & 1 deletion projects/ngx-avatars/src/lib/avatar-config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { AvatarSource } from './sources/avatar-source.enum';
import { AVATAR_CONFIG } from './avatar-config.token';
import { AvatarConfig } from './avatar-config';

@Injectable()
@Injectable({providedIn: 'root'})
export class AvatarConfigService {
constructor(
@Optional()
Expand Down Expand Up @@ -39,4 +39,12 @@ export class AvatarConfigService {
defaultColors
);
}

public getDisableSrcCache(defaultDisableSrcCache: boolean): boolean {
if (this.userConfig == null || this.userConfig.disableSrcCache == null) {
return defaultDisableSrcCache;
} else {
return this.userConfig.disableSrcCache;
}
}
}
Loading

0 comments on commit 902c5ca

Please sign in to comment.