mirror of
https://github.com/valitydev/ng-core.git
synced 2024-11-06 00:05:19 +00:00
FR-623: Angular 12 (#7)
This commit is contained in:
parent
3e431ac515
commit
4303d91e96
89
.eslintrc.js
89
.eslintrc.js
@ -1,26 +1,65 @@
|
||||
module.exports = {
|
||||
env: {
|
||||
browser: true,
|
||||
es2021: true,
|
||||
node: true,
|
||||
},
|
||||
extends: ['plugin:prettier/recommended', 'eslint:recommended', 'plugin:@typescript-eslint/recommended'],
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
ecmaVersion: 12,
|
||||
sourceType: 'module',
|
||||
},
|
||||
plugins: ['@typescript-eslint'],
|
||||
rules: {
|
||||
'sort-imports': [
|
||||
'error',
|
||||
{
|
||||
ignoreCase: false,
|
||||
ignoreDeclarationSort: false,
|
||||
ignoreMemberSort: false,
|
||||
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
|
||||
allowSeparatedGroups: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
const rules = require('@rbkmoney/eslint-plugin/lib/rules');
|
||||
|
||||
const baseTsRules = {
|
||||
...rules.createImportOrderRule({
|
||||
internalPathsPattern: '@cc/**',
|
||||
}),
|
||||
// TODO: pretenders for error
|
||||
'@typescript-eslint/no-unsafe-call': 'warn',
|
||||
'@typescript-eslint/no-unsafe-member-access': 'warn',
|
||||
'@typescript-eslint/no-unsafe-assignment': 'warn',
|
||||
'@typescript-eslint/no-unsafe-return': 'warn',
|
||||
'@typescript-eslint/no-misused-promises': 'warn',
|
||||
'@typescript-eslint/unbound-method': 'warn',
|
||||
'@typescript-eslint/restrict-plus-operands': 'warn',
|
||||
'@typescript-eslint/restrict-template-expressions': 'warn',
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
root: true,
|
||||
parser: '@typescript-eslint/parser',
|
||||
overrides: [
|
||||
{
|
||||
files: ['*.ts'],
|
||||
parserOptions: {
|
||||
project: ['tsconfig.json', 'e2e/tsconfig.json'],
|
||||
createDefaultProgram: true,
|
||||
},
|
||||
extends: [
|
||||
'plugin:@rbkmoney/typescript',
|
||||
'plugin:@rbkmoney/angular',
|
||||
'plugin:@rbkmoney/lodash',
|
||||
'plugin:@rbkmoney/prettier',
|
||||
],
|
||||
rules: {
|
||||
...baseTsRules,
|
||||
...rules.createAngularSelectorRules({ prefix: 'cc' }),
|
||||
// TODO: pretenders for error
|
||||
'@typescript-eslint/no-floating-promises': 'warn',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['*.spec.ts'],
|
||||
parserOptions: {
|
||||
project: ['tsconfig.json', 'e2e/tsconfig.json'],
|
||||
createDefaultProgram: true,
|
||||
},
|
||||
extends: [
|
||||
'plugin:@rbkmoney/typescript',
|
||||
'plugin:@rbkmoney/angular',
|
||||
'plugin:@rbkmoney/jasmine',
|
||||
'plugin:@rbkmoney/lodash',
|
||||
'plugin:@rbkmoney/prettier',
|
||||
],
|
||||
rules: baseTsRules,
|
||||
},
|
||||
{
|
||||
files: ['*.html'],
|
||||
extends: ['plugin:@angular-eslint/template/recommended'],
|
||||
rules: {
|
||||
// TODO: pretenders for error
|
||||
'@angular-eslint/template/no-negated-async': 'warn',
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
2
.github/workflows/publish.yml
vendored
2
.github/workflows/publish.yml
vendored
@ -18,7 +18,7 @@ jobs:
|
||||
- name: Setup Node ${{ matrix.node_version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 15
|
||||
node-version: 16
|
||||
registry-url: https://npm.pkg.github.com/
|
||||
- name: Git Identity
|
||||
run: |
|
||||
|
9
.github/workflows/test.yaml
vendored
9
.github/workflows/test.yaml
vendored
@ -15,7 +15,8 @@ jobs:
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: jwalton/gh-find-current-pr@v1
|
||||
- name: Get current PR
|
||||
uses: jwalton/gh-find-current-pr@v1
|
||||
id: pr
|
||||
- name: Fetch with tags
|
||||
run: |
|
||||
@ -27,7 +28,7 @@ jobs:
|
||||
- name: Setup Node ${{ matrix.node_version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 15
|
||||
node-version: 16
|
||||
registry-url: https://npm.pkg.github.com/
|
||||
- name: Git Identity
|
||||
run: |
|
||||
@ -38,6 +39,10 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Install
|
||||
run: npx lerna bootstrap
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
|
||||
- name: Check
|
||||
run: npm run prettier
|
||||
- name: Build
|
||||
run: npm run build
|
||||
- name: Test
|
||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -44,3 +44,6 @@ testem.log
|
||||
# System Files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# ESLint
|
||||
.eslintcache
|
||||
|
4
.husky/commit-msg
Executable file
4
.husky/commit-msg
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
npx commitlint --edit ${HUSKY_GIT_PARAMS}
|
@ -1,3 +1,5 @@
|
||||
package.json
|
||||
package-lock.json
|
||||
node_modules
|
||||
CHANGELOG.md
|
||||
|
||||
|
82
angular.json
82
angular.json
@ -1,51 +1,39 @@
|
||||
{
|
||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||
"cli": {
|
||||
"analytics": false
|
||||
},
|
||||
"version": 1,
|
||||
"newProjectRoot": "projects",
|
||||
"projects": {
|
||||
"id-generator": {
|
||||
"projectType": "library",
|
||||
"root": "projects/id-generator",
|
||||
"sourceRoot": "projects/id-generator/src",
|
||||
"prefix": "lib",
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular-devkit/build-angular:ng-packagr",
|
||||
"options": {
|
||||
"tsConfig": "projects/id-generator/tsconfig.lib.json",
|
||||
"project": "projects/id-generator/ng-package.json"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"tsConfig": "projects/id-generator/tsconfig.lib.prod.json"
|
||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||
"cli": {
|
||||
"analytics": false
|
||||
},
|
||||
"version": 1,
|
||||
"newProjectRoot": "projects",
|
||||
"projects": {
|
||||
"id-generator": {
|
||||
"projectType": "library",
|
||||
"root": "projects/id-generator",
|
||||
"sourceRoot": "projects/id-generator/src",
|
||||
"prefix": "lib",
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular-devkit/build-angular:ng-packagr",
|
||||
"options": {
|
||||
"tsConfig": "projects/id-generator/tsconfig.lib.json",
|
||||
"project": "projects/id-generator/ng-package.json"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"tsConfig": "projects/id-generator/tsconfig.lib.prod.json"
|
||||
}
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"builder": "@angular-devkit/build-angular:karma",
|
||||
"options": {
|
||||
"main": "projects/id-generator/src/test.ts",
|
||||
"tsConfig": "projects/id-generator/tsconfig.spec.json",
|
||||
"karmaConfig": "projects/id-generator/karma.conf.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"builder": "@angular-devkit/build-angular:karma",
|
||||
"options": {
|
||||
"main": "projects/id-generator/src/test.ts",
|
||||
"tsConfig": "projects/id-generator/tsconfig.spec.json",
|
||||
"karmaConfig": "projects/id-generator/karma.conf.js"
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"builder": "@angular-devkit/build-angular:tslint",
|
||||
"options": {
|
||||
"tsConfig": [
|
||||
"projects/id-generator/tsconfig.lib.json",
|
||||
"projects/id-generator/tsconfig.spec.json"
|
||||
],
|
||||
"exclude": [
|
||||
"**/node_modules/**"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultProject": "id-generator"
|
||||
},
|
||||
"defaultProject": "id-generator"
|
||||
}
|
||||
|
24
lerna.json
24
lerna.json
@ -1,16 +1,14 @@
|
||||
{
|
||||
"useWorkspaces": true,
|
||||
"packages": [
|
||||
"projects/*"
|
||||
],
|
||||
"version": "independent",
|
||||
"command": {
|
||||
"publish": {
|
||||
"conventionalCommits": true
|
||||
"useWorkspaces": true,
|
||||
"packages": ["projects/*"],
|
||||
"version": "independent",
|
||||
"command": {
|
||||
"publish": {
|
||||
"conventionalCommits": true
|
||||
}
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"registry": "https://npm.pkg.github.com/"
|
||||
}
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"registry": "https://npm.pkg.github.com/"
|
||||
}
|
||||
}
|
||||
|
31797
package-lock.json
generated
31797
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
38
package.json
38
package.json
@ -5,7 +5,11 @@
|
||||
"prepare": "husky install",
|
||||
"build": "ng build",
|
||||
"test": "ng test --browsers=ChromeHeadless --watch=false",
|
||||
"lint": "ng lint",
|
||||
"fix": "npm run prettier-fix",
|
||||
"parallel-cmd": "concurrently --prefix-colors magenta,green",
|
||||
"prettier-cmd": "prettier \"**/*.{html,js,ts,css,scss,md,json,prettierrc,svg}\"",
|
||||
"prettier": "npm run prettier-cmd -- --check",
|
||||
"prettier-fix": "npm run prettier-cmd -- --write",
|
||||
"versionup": "lerna version --no-commit-hooks --conventional-prerelease --no-changelog --preid pr --yes",
|
||||
"release": "run-s release-versionup build release-publish",
|
||||
"release-versionup": "lerna version --no-commit-hooks --conventional-graduate --yes",
|
||||
@ -20,40 +24,42 @@
|
||||
"projects/*"
|
||||
],
|
||||
"dependencies": {
|
||||
"@angular/animations": "~11.2.14",
|
||||
"@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/animations": "~12.1.4",
|
||||
"@angular/common": "~12.1.4",
|
||||
"@angular/compiler": "~12.1.4",
|
||||
"@angular/core": "~12.1.4",
|
||||
"@angular/forms": "~12.1.4",
|
||||
"@angular/platform-browser": "~12.1.4",
|
||||
"@angular/platform-browser-dynamic": "~12.1.4",
|
||||
"@angular/router": "~12.1.4",
|
||||
"puppeteer": "^10.0.0",
|
||||
"rxjs": "~6.6.0",
|
||||
"tslib": "^2.0.0",
|
||||
"zone.js": "~0.11.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "~0.1102.13",
|
||||
"@angular/cli": "~11.2.13",
|
||||
"@angular/compiler-cli": "~11.2.14",
|
||||
"@angular-devkit/build-angular": "~12.1.4",
|
||||
"@angular-eslint/eslint-plugin": "^12.3.1",
|
||||
"@angular/cli": "~12.1.4",
|
||||
"@angular/compiler-cli": "~12.1.4",
|
||||
"@types/jasmine": "~3.6.0",
|
||||
"@types/node": "^12.11.1",
|
||||
"codelyzer": "^6.0.0",
|
||||
"concurrently": "^6.2.0",
|
||||
"husky": "^6.0.0",
|
||||
"jasmine-core": "~3.6.0",
|
||||
"jasmine-spec-reporter": "~5.0.0",
|
||||
"karma": "~6.1.0",
|
||||
"karma": "~6.3.4",
|
||||
"karma-chrome-launcher": "~3.1.0",
|
||||
"karma-coverage": "~2.0.3",
|
||||
"karma-jasmine": "~4.0.0",
|
||||
"karma-jasmine-html-reporter": "~1.5.0",
|
||||
"lerna": "^4.0.0",
|
||||
"ng-packagr": "^11.0.0",
|
||||
"ng-packagr": "^12.1.2",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.3.2",
|
||||
"protractor": "~7.0.0",
|
||||
"ts-node": "~8.3.0",
|
||||
"tslint": "~6.1.0",
|
||||
"typescript": "~4.1.5"
|
||||
"typescript": "~4.3.5"
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
# ID Generator
|
||||
# Id Generator
|
||||
|
||||
**The library for ID generation.**
|
||||
|
||||
@ -30,4 +30,4 @@ const shortUuid = this.idGenerator.shortUuid();
|
||||
|
||||
## Contributing
|
||||
|
||||
Full details in the [monorepo root README.md](https://github.com/rbkmoney/ng-core#contributing)
|
||||
Full details in the [monorepo root README.md](https://github.com/rbkmoney/ng-core#contributing)
|
||||
|
@ -2,43 +2,40 @@
|
||||
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
||||
|
||||
module.exports = function (config) {
|
||||
config.set({
|
||||
basePath: '',
|
||||
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
||||
plugins: [
|
||||
require('karma-jasmine'),
|
||||
require('karma-chrome-launcher'),
|
||||
require('karma-jasmine-html-reporter'),
|
||||
require('karma-coverage'),
|
||||
require('@angular-devkit/build-angular/plugins/karma')
|
||||
],
|
||||
client: {
|
||||
jasmine: {
|
||||
// you can add configuration options for Jasmine here
|
||||
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
|
||||
// for example, you can disable the random execution with `random: false`
|
||||
// or set a specific seed with `seed: 4321`
|
||||
},
|
||||
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
||||
},
|
||||
jasmineHtmlReporter: {
|
||||
suppressAll: true // removes the duplicated traces
|
||||
},
|
||||
coverageReporter: {
|
||||
dir: require('path').join(__dirname, '../../coverage/id-generator'),
|
||||
subdir: '.',
|
||||
reporters: [
|
||||
{ type: 'html' },
|
||||
{ type: 'text-summary' }
|
||||
]
|
||||
},
|
||||
reporters: ['progress', 'kjhtml'],
|
||||
port: 9876,
|
||||
colors: true,
|
||||
logLevel: config.LOG_INFO,
|
||||
autoWatch: true,
|
||||
browsers: ['ChromeHeadless'],
|
||||
singleRun: false,
|
||||
restartOnFileChange: true
|
||||
});
|
||||
config.set({
|
||||
basePath: '',
|
||||
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
||||
plugins: [
|
||||
require('karma-jasmine'),
|
||||
require('karma-chrome-launcher'),
|
||||
require('karma-jasmine-html-reporter'),
|
||||
require('karma-coverage'),
|
||||
require('@angular-devkit/build-angular/plugins/karma'),
|
||||
],
|
||||
client: {
|
||||
jasmine: {
|
||||
// you can add configuration options for Jasmine here
|
||||
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
|
||||
// for example, you can disable the random execution with `random: false`
|
||||
// or set a specific seed with `seed: 4321`
|
||||
},
|
||||
clearContext: false, // leave Jasmine Spec Runner output visible in browser
|
||||
},
|
||||
jasmineHtmlReporter: {
|
||||
suppressAll: true, // removes the duplicated traces
|
||||
},
|
||||
coverageReporter: {
|
||||
dir: require('path').join(__dirname, '../../coverage/id-generator'),
|
||||
subdir: '.',
|
||||
reporters: [{ type: 'html' }, { type: 'text-summary' }],
|
||||
},
|
||||
reporters: ['progress', 'kjhtml'],
|
||||
port: 9876,
|
||||
colors: true,
|
||||
logLevel: config.LOG_INFO,
|
||||
autoWatch: true,
|
||||
browsers: ['ChromeHeadless'],
|
||||
singleRun: false,
|
||||
restartOnFileChange: true,
|
||||
});
|
||||
};
|
||||
|
@ -1,10 +1,8 @@
|
||||
{
|
||||
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
|
||||
"dest": "dist",
|
||||
"allowedNonPeerDependencies": [
|
||||
"short-uuid"
|
||||
],
|
||||
"lib": {
|
||||
"entryFile": "src/public-api.ts"
|
||||
}
|
||||
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
|
||||
"dest": "dist",
|
||||
"allowedNonPeerDependencies": ["short-uuid"],
|
||||
"lib": {
|
||||
"entryFile": "src/public-api.ts"
|
||||
}
|
||||
}
|
||||
|
32
projects/id-generator/package-lock.json
generated
32
projects/id-generator/package-lock.json
generated
@ -1,32 +0,0 @@
|
||||
{
|
||||
"name": "@rbkmoney/id-generator",
|
||||
"version": "0.1.3",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
"any-base": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/any-base/-/any-base-1.1.0.tgz",
|
||||
"integrity": "sha512-uMgjozySS8adZZYePpaWs8cxB9/kdzmpX6SgJZ+wbz1K5eYk5QMYDVJaZKhxyIHUdnnJkfR7SVgStgH7LkGUyg=="
|
||||
},
|
||||
"short-uuid": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/short-uuid/-/short-uuid-4.2.0.tgz",
|
||||
"integrity": "sha512-r3cxuPPZSuF0QkKsK9bBR7u+7cwuCRzWzgjPh07F5N2iIUNgblnMHepBY16xgj5t1lG9iOP9k/TEafY1qhRzaw==",
|
||||
"requires": {
|
||||
"any-base": "^1.1.0",
|
||||
"uuid": "^8.3.2"
|
||||
}
|
||||
},
|
||||
"tslib": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.2.0.tgz",
|
||||
"integrity": "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w=="
|
||||
},
|
||||
"uuid": {
|
||||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@rbkmoney/id-generator",
|
||||
"version": "0.1.3",
|
||||
"version": "0.2.0-pr7.0",
|
||||
"description": "ID generator",
|
||||
"author": "rbkmoney",
|
||||
"scripts": {
|
||||
@ -15,11 +15,11 @@
|
||||
"registry": "https://npm.pkg.github.com/@rbkmoney"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@angular/common": "^11.2.14",
|
||||
"@angular/core": "^11.2.14"
|
||||
"@angular/common": "^12.1.0",
|
||||
"@angular/core": "^12.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"short-uuid": "^4.2.0",
|
||||
"tslib": "^2.0.0"
|
||||
"tslib": "^2.2.0"
|
||||
}
|
||||
}
|
||||
|
@ -1,39 +1,38 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { IdGeneratorService } from './id-generator.service';
|
||||
import {TestBed} from "@angular/core/testing";
|
||||
|
||||
describe('IdGeneratorService', () => {
|
||||
let service: IdGeneratorService;
|
||||
let service: IdGeneratorService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
IdGeneratorService
|
||||
]
|
||||
});
|
||||
service = TestBed.inject(IdGeneratorService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
|
||||
describe('generateUUID', () => {
|
||||
it('should generate uuid', () => {
|
||||
expect(service.uuid()).toBeTruthy();
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [IdGeneratorService],
|
||||
});
|
||||
service = TestBed.inject(IdGeneratorService);
|
||||
});
|
||||
|
||||
it('new generated uuid should be not like it was before', () => {
|
||||
expect(service.uuid()).not.toBe(service.uuid());
|
||||
});
|
||||
});
|
||||
|
||||
describe('generateShortUUID', () => {
|
||||
it('should generate short uuid', () => {
|
||||
expect(service.shortUuid()).toBeTruthy();
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
|
||||
it('new generated short uuid should be not like it was before', () => {
|
||||
expect(service.shortUuid()).not.toBe(service.shortUuid());
|
||||
describe('generateUUID', () => {
|
||||
it('should generate uuid', () => {
|
||||
expect(service.uuid()).toBeTruthy();
|
||||
});
|
||||
|
||||
it('new generated uuid should be not like it was before', () => {
|
||||
expect(service.uuid()).not.toBe(service.uuid());
|
||||
});
|
||||
});
|
||||
|
||||
describe('generateShortUUID', () => {
|
||||
it('should generate short uuid', () => {
|
||||
expect(service.shortUuid()).toBeTruthy();
|
||||
});
|
||||
|
||||
it('new generated short uuid should be not like it was before', () => {
|
||||
expect(service.shortUuid()).not.toBe(service.shortUuid());
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -3,11 +3,11 @@ import * as short from 'short-uuid';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class IdGeneratorService {
|
||||
uuid(): string {
|
||||
return short().uuid();
|
||||
}
|
||||
uuid(): string {
|
||||
return short().uuid();
|
||||
}
|
||||
|
||||
shortUuid(): string {
|
||||
return short().generate();
|
||||
}
|
||||
shortUuid(): string {
|
||||
return short().generate();
|
||||
}
|
||||
}
|
||||
|
@ -3,23 +3,22 @@
|
||||
import 'zone.js/dist/zone';
|
||||
import 'zone.js/dist/zone-testing';
|
||||
import { getTestBed } from '@angular/core/testing';
|
||||
import {
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting
|
||||
} from '@angular/platform-browser-dynamic/testing';
|
||||
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
declare const require: {
|
||||
context(path: string, deep?: boolean, filter?: RegExp): {
|
||||
keys(): string[];
|
||||
<T>(id: string): T;
|
||||
};
|
||||
context(
|
||||
path: string,
|
||||
deep?: boolean,
|
||||
filter?: RegExp
|
||||
): {
|
||||
keys(): string[];
|
||||
<T>(id: string): T;
|
||||
};
|
||||
};
|
||||
|
||||
// First, initialize the Angular testing environment.
|
||||
getTestBed().initTestEnvironment(
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting()
|
||||
);
|
||||
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
|
||||
// Then we find all the tests.
|
||||
const context = require.context('./', true, /\.spec\.ts$/);
|
||||
// And load the modules.
|
||||
|
@ -1,25 +1,19 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../out-tsc/lib",
|
||||
"target": "es2015",
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"inlineSources": true,
|
||||
"types": [],
|
||||
"lib": [
|
||||
"dom",
|
||||
"es2018"
|
||||
]
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"skipTemplateCodegen": true,
|
||||
"strictMetadataEmit": true,
|
||||
"enableResourceInlining": true
|
||||
},
|
||||
"exclude": [
|
||||
"src/test.ts",
|
||||
"**/*.spec.ts"
|
||||
]
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../out-tsc/lib",
|
||||
"target": "es2015",
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"inlineSources": true,
|
||||
"types": [],
|
||||
"lib": ["dom", "es2018"]
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"skipTemplateCodegen": true,
|
||||
"strictMetadataEmit": true,
|
||||
"enableResourceInlining": true
|
||||
},
|
||||
"exclude": ["src/test.ts", "**/*.spec.ts"]
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "./tsconfig.lib.json",
|
||||
"compilerOptions": {
|
||||
"declarationMap": false
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"enableIvy": false
|
||||
}
|
||||
"extends": "./tsconfig.lib.json",
|
||||
"compilerOptions": {
|
||||
"declarationMap": false
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"enableIvy": false
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,10 @@
|
||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../out-tsc/spec",
|
||||
"types": [
|
||||
"jasmine"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"src/test.ts"
|
||||
],
|
||||
"include": [
|
||||
"**/*.spec.ts",
|
||||
"**/*.d.ts"
|
||||
]
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../out-tsc/spec",
|
||||
"types": ["jasmine"]
|
||||
},
|
||||
"files": ["src/test.ts"],
|
||||
"include": ["**/*.spec.ts", "**/*.d.ts"]
|
||||
}
|
||||
|
@ -1,28 +1,22 @@
|
||||
{
|
||||
"compileOnSave": false,
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"outDir": "./dist/out-tsc",
|
||||
"sourceMap": true,
|
||||
"declaration": false,
|
||||
"paths": {
|
||||
"id-generator": [
|
||||
"dist/id-generator/id-generator",
|
||||
"dist/id-generator"
|
||||
]
|
||||
"compileOnSave": false,
|
||||
"compilerOptions": {
|
||||
"baseUrl": "./",
|
||||
"outDir": "./dist/out-tsc",
|
||||
"sourceMap": true,
|
||||
"declaration": false,
|
||||
"paths": {
|
||||
"id-generator": ["dist/id-generator/id-generator", "dist/id-generator"]
|
||||
},
|
||||
"downlevelIteration": true,
|
||||
"experimentalDecorators": true,
|
||||
"moduleResolution": "node",
|
||||
"importHelpers": true,
|
||||
"target": "es2015",
|
||||
"module": "es2020",
|
||||
"lib": ["es2018", "dom"]
|
||||
},
|
||||
"downlevelIteration": true,
|
||||
"experimentalDecorators": true,
|
||||
"moduleResolution": "node",
|
||||
"importHelpers": true,
|
||||
"target": "es2015",
|
||||
"module": "es2020",
|
||||
"lib": [
|
||||
"es2018",
|
||||
"dom"
|
||||
]
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"enableI18nLegacyMessageIdFormat": false
|
||||
}
|
||||
"angularCompilerOptions": {
|
||||
"enableI18nLegacyMessageIdFormat": false
|
||||
}
|
||||
}
|
||||
|
140
tslint.json
140
tslint.json
@ -1,140 +0,0 @@
|
||||
{
|
||||
"extends": "tslint:recommended",
|
||||
"rulesDirectory": [
|
||||
"codelyzer"
|
||||
],
|
||||
"rules": {
|
||||
"align": {
|
||||
"options": [
|
||||
"parameters",
|
||||
"statements"
|
||||
]
|
||||
},
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": true,
|
||||
"curly": true,
|
||||
"deprecation": {
|
||||
"severity": "warning"
|
||||
},
|
||||
"eofline": true,
|
||||
"import-blacklist": [
|
||||
true,
|
||||
"rxjs/Rx"
|
||||
],
|
||||
"import-spacing": true,
|
||||
"indent": {
|
||||
"options": [
|
||||
"spaces"
|
||||
]
|
||||
},
|
||||
"max-classes-per-file": false,
|
||||
"max-line-length": [
|
||||
true,
|
||||
140
|
||||
],
|
||||
"member-ordering": [
|
||||
true,
|
||||
{
|
||||
"order": [
|
||||
"static-field",
|
||||
"instance-field",
|
||||
"static-method",
|
||||
"instance-method"
|
||||
]
|
||||
}
|
||||
],
|
||||
"no-console": [
|
||||
true,
|
||||
"debug",
|
||||
"info",
|
||||
"time",
|
||||
"timeEnd",
|
||||
"trace"
|
||||
],
|
||||
"no-empty": false,
|
||||
"no-inferrable-types": [
|
||||
true,
|
||||
"ignore-params"
|
||||
],
|
||||
"no-non-null-assertion": true,
|
||||
"no-redundant-jsdoc": true,
|
||||
"no-switch-case-fall-through": true,
|
||||
"no-var-requires": false,
|
||||
"object-literal-key-quotes": [
|
||||
true,
|
||||
"as-needed"
|
||||
],
|
||||
"quotemark": [
|
||||
true,
|
||||
"single"
|
||||
],
|
||||
"semicolon": {
|
||||
"options": [
|
||||
"always"
|
||||
]
|
||||
},
|
||||
"space-before-function-paren": {
|
||||
"options": {
|
||||
"anonymous": "never",
|
||||
"asyncArrow": "always",
|
||||
"constructor": "never",
|
||||
"method": "never",
|
||||
"named": "never"
|
||||
}
|
||||
},
|
||||
"typedef": [
|
||||
true,
|
||||
"call-signature"
|
||||
],
|
||||
"typedef-whitespace": {
|
||||
"options": [
|
||||
{
|
||||
"call-signature": "nospace",
|
||||
"index-signature": "nospace",
|
||||
"parameter": "nospace",
|
||||
"property-declaration": "nospace",
|
||||
"variable-declaration": "nospace"
|
||||
},
|
||||
{
|
||||
"call-signature": "onespace",
|
||||
"index-signature": "onespace",
|
||||
"parameter": "onespace",
|
||||
"property-declaration": "onespace",
|
||||
"variable-declaration": "onespace"
|
||||
}
|
||||
]
|
||||
},
|
||||
"variable-name": {
|
||||
"options": [
|
||||
"ban-keywords",
|
||||
"check-format",
|
||||
"allow-pascal-case"
|
||||
]
|
||||
},
|
||||
"whitespace": {
|
||||
"options": [
|
||||
"check-branch",
|
||||
"check-decl",
|
||||
"check-operator",
|
||||
"check-separator",
|
||||
"check-type",
|
||||
"check-typecast"
|
||||
]
|
||||
},
|
||||
"component-class-suffix": true,
|
||||
"contextual-lifecycle": true,
|
||||
"directive-class-suffix": true,
|
||||
"no-conflicting-lifecycle": true,
|
||||
"no-host-metadata-property": true,
|
||||
"no-input-rename": true,
|
||||
"no-inputs-metadata-property": true,
|
||||
"no-output-native": true,
|
||||
"no-output-on-prefix": true,
|
||||
"no-output-rename": true,
|
||||
"no-outputs-metadata-property": true,
|
||||
"template-banana-in-box": true,
|
||||
"template-no-negated-async": true,
|
||||
"use-lifecycle-interface": true,
|
||||
"use-pipe-transform-interface": true
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user