feat(core): updated version up to angular 14 and nx 14 (#1205)

* feat(chore): updated version up to angular 13 and nx 13

* version fixies

* chore(bump): updated version up to angular, nx 14

* check key

* fix(ci): fixed yml files

* fix(ci): fix build commands

* fix(ci): fix build commands

* fix(ci): fix build commands

* fix(ci): fix build commands

* fix(chore): fixed peerdependencies

* fix(test): deleted ts-ignore from .spec files

* fix(test): little cleaning

* fix(chore): deleted unnecessery command
This commit was merged in pull request #1205.
This commit is contained in:
SvetlanaMuravlova
2022-09-28 12:05:37 +03:00
committed by GitHub
parent 6608960cec
commit ad01e31cf8
26 changed files with 9803 additions and 16577 deletions

View File

@@ -8,12 +8,7 @@
],
"overrides": [
{
"files": [
"*.ts",
"*.tsx",
"*.js",
"*.jsx"
],
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"error",
@@ -21,39 +16,25 @@
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": [
"*"
]
}
{ "sourceTag": "*", "onlyDependOnLibsWithTags": ["*"] }
]
}
]
}
},
{
"files": [
"*.ts",
"*.tsx"
],
"extends": [
"plugin:@nrwl/nx/typescript"
],
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nrwl/nx/typescript"],
"parserOptions": { "project": "./tsconfig.*?.json" },
"rules": {
"semi": "off",
"@typescript-eslint/semi": ["error"]
"@typescript-eslint/semi": ["error"],
"@typescript-eslint/ban-ts-comment": "off"
}
},
{
"files": [
"*.js",
"*.jsx"
],
"extends": [
"plugin:@nrwl/nx/javascript"
],
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nrwl/nx/javascript"],
"rules": {}
}
]

View File

@@ -50,7 +50,7 @@ jobs:
path: |
dist
key: dist-${{ github.run_id }}
- run: npx ng build --prod
- run: npx nx run ng2-file-upload-demo:build
# update release notes in github
update_release_draft:

View File

@@ -59,7 +59,7 @@ jobs:
with:
path: ${{ env.CACHE_DIST_PATH }}
key: dist-${{ github.run_id }}
- run: npx ng build --prod
- run: npx nx run ng2-file-upload-demo:build
# run unit tests
unit_tests_with_coverage:

View File

@@ -2,7 +2,6 @@
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"defaultProject": "ng2-file-upload-demo",
"projects": {
"ng2-file-upload": {
"root": "libs/ng2-file-upload",
@@ -30,7 +29,10 @@
"lintFilePatterns": [
"libs/ng2-file-upload/**/*.ts"
]
}
},
"outputs": [
"{options.outputFile}"
]
},
"test": {
"builder": "@nrwl/jest:jest",
@@ -38,14 +40,13 @@
"coverage/libs/ng2-file-upload"
],
"options": {
"jestConfig": "libs/ng2-file-upload/jest.config.js",
"jestConfig": "libs/ng2-file-upload/jest.config.ts",
"passWithNoTests": true
}
},
"version": {
"builder": "@nrwl/workspace:run-commands",
"outputs": [
],
"outputs": [],
"options": {
"commands": [
"ts-node ./scripts/set-version.ts",
@@ -59,7 +60,10 @@
"production": {}
}
}
}
},
"tags": [
"lib"
]
},
"ng2-file-upload-demo": {
"root": "apps/demo",
@@ -110,16 +114,16 @@
]
}
},
"defaultConfiguration": ""
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "ng2-file-upload-demo:build"
"browserTarget": "ng2-file-upload-demo:build:production"
},
"configurations": {
"production": {
"browserTarget": "ng2-file-upload-demo:build:production"
"browserTarget": "ng2-file-upload-demo:build"
}
}
},
@@ -129,18 +133,16 @@
"lintFilePatterns": [
"apps/demo/**/*.ts"
]
}
},
"outputs": [
"{options.outputFile}"
]
}
}
}
},
"schematics": {
"@schematics/angular:component": {
"prefix": "",
"styleext": "css"
},
"@schematics/angular:directive": {
"prefix": ""
},
"tags": [],
"implicitDependencies": [
"ng2-file-upload"
]
}
}
}

View File

@@ -1,20 +1,28 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"extends": [
"../../.eslintrc.json"
],
"ignorePatterns": [
"!**/*"
],
"overrides": [
{
"files": ["*.ts"],
"files": [
"*.ts"
],
"extends": [
"plugin:@nrwl/nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
],
"parserOptions": { "project": ["src/accordion/tsconfig.*?.json"] },
"rules": {
}
"rules": {}
},
{
"files": ["*.html"],
"extends": ["plugin:@nrwl/nx/angular-template"],
"files": [
"*.html"
],
"extends": [
"plugin:@nrwl/nx/angular-template"
],
"rules": {}
}
]

View File

@@ -3,9 +3,7 @@
<tabset>
<tab *ngFor="let desc of tabs" heading="{{desc.heading}}" (select)="select($event)">
<div class="card card-block p-3 border-top-0">
<simple-demo></simple-demo>
<br>
<div class="container p-0">
<div class="row" style="margin: 0px;">

View File

@@ -1,10 +1,12 @@
{
"extends": "../../tsconfig.base.json",
"files": [
"./src/main.ts",
"../../scripts/polyfills.ts"
"./src/main.ts",
"../../scripts/polyfills.ts"
],
"include": [
"./src/typings.d.ts"
],
"include": ["./src/typings.d.ts"],
"references": [
{
"path": "./tsconfig.app.json"
@@ -16,5 +18,10 @@
"path": "./tsconfig.editor.json"
}
],
"exclude": ["**/*.spec.ts"]
"exclude": [
"**/*.spec.ts"
],
"compilerOptions": {
"target": "es2020"
}
}

View File

@@ -1,5 +0,0 @@
module.exports = {
projects: [
'<rootDir>/libs/ng2-file-upload'
]
};

3
jest.config.ts Normal file
View File

@@ -0,0 +1,3 @@
const { getJestProjects } = require('@nrwl/jest');
export default {"projects": getJestProjects()};

View File

@@ -1,4 +1,4 @@
const nxPreset = require('@nrwl/jest/preset');
const nxPreset = require('@nrwl/jest/preset').default;
module.exports = {
...nxPreset,
...{

View File

@@ -1,20 +1,28 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"extends": [
"../../.eslintrc.json"
],
"ignorePatterns": [
"!**/*"
],
"overrides": [
{
"files": ["*.ts"],
"files": [
"*.ts"
],
"extends": [
"plugin:@nrwl/nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
],
"parserOptions": { "project": ["src/accordion/tsconfig.*?.json"] },
"rules": {
}
"rules": {}
},
{
"files": ["*.html"],
"extends": ["plugin:@nrwl/nx/angular-template"],
"files": [
"*.html"
],
"extends": [
"plugin:@nrwl/nx/angular-template"
],
"rules": {}
}
]

View File

@@ -3,6 +3,8 @@ import { NgModule } from '@angular/core';
import { FileDropDirective } from './file-drop.directive';
import { FileSelectDirective } from './file-select.directive';
export { FileDropDirective } from './file-drop.directive';
export { FileSelectDirective } from './file-select.directive';
@NgModule({
imports: [ CommonModule ],

View File

@@ -1,26 +0,0 @@
module.exports = {
displayName: 'ng2-file-upload',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/testing/test-setup.ts'],
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
astTransformers: {
before: [
'jest-preset-angular/build/InlineFilesTransformer',
'jest-preset-angular/build/StripStylesTransformer',
]
}
}
},
transform: {
'^.+\\.[tj]sx?$': 'ts-jest'
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/libs/ng2-file-upload',
snapshotSerializers: [
'jest-preset-angular/build/AngularNoNgAttributesSnapshotSerializer.js',
'jest-preset-angular/build/AngularSnapshotSerializer.js',
'jest-preset-angular/build/HTMLCommentSerializer.js',
]
};

View File

@@ -0,0 +1,21 @@
/* eslint-disable */
export default {
displayName: 'ng2-file-upload',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/testing/test-setup.ts'],
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
}
},
coverageDirectory: '../../coverage/libs/ng2-file-upload',
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|mjs|js|html)$': 'jest-preset-angular' },
transformIgnorePatterns: ['node_modules/(?!.*.mjs$)'],
moduleFileExtensions: ['mjs', 'ts', 'js', 'html']
};

View File

@@ -5,8 +5,8 @@
"author": "Dmitriy Shekhovtsov <valorkin@gmail.com>",
"license": "MIT",
"peerDependencies": {
"@angular/core": "^13.0.0",
"@angular/common": "^13.0.0"
"@angular/core": "^14.0.0",
"@angular/common": "^14.0.0"
},
"sideEffects": false,
"publishConfig": {

View File

@@ -1,6 +1,6 @@
import { Component, DebugElement } from '@angular/core';
import { By } from '@angular/platform-browser';
import { inject, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { FileUploader } from '../../file-upload/file-uploader.class';
import { FileUploadModule } from '../../file-upload/file-upload.module';
@@ -28,7 +28,7 @@ describe('Directive: FileDropDirective', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [ FileUploadModule ],
declarations: [ ContainerComponent ],
declarations: [ ContainerComponent, FileDropDirective ],
providers: [ ContainerComponent ]
});
});
@@ -72,19 +72,21 @@ describe('Directive: FileDropDirective', () => {
const filters = fileDropDirective.getFilters();
// TODO: Update test once implemented
expect(filters).toEqual({});
expect(filters).toBeFalsy();
});
it('handles drop event', () => {
spyOn(fileDropDirective, 'onDrop');
const drop = jest.spyOn(fileDropDirective, 'onDrop');
directiveElement.triggerEventHandler('drop', getFakeEventData());
expect(fileDropDirective.onDrop).toHaveBeenCalled();
expect(drop).toHaveBeenCalled();
});
it('adds file to upload', () => {
spyOn(fileDropDirective.uploader, 'addToQueue');
let addToQueue;
if (fileDropDirective.uploader?.addToQueue) {
addToQueue = jest.spyOn(fileDropDirective.uploader, 'addToQueue');
}
let fileOverData;
fileDropDirective.fileOver.subscribe((data: any) => fileOverData = data);
@@ -96,13 +98,13 @@ describe('Directive: FileDropDirective', () => {
const uploadedFiles = getFakeEventData().dataTransfer.files;
expect(fileDropDirective.uploader.addToQueue).toHaveBeenCalledWith(uploadedFiles, fileDropDirective.getOptions(), fileDropDirective.getFilters());
expect(addToQueue).toHaveBeenCalledWith(uploadedFiles, fileDropDirective.getOptions(), fileDropDirective.getFilters());
expect(fileOverData).toBeFalsy();
expect(fileDropData).toEqual(uploadedFiles);
});
it('handles dragover event', () => {
spyOn(fileDropDirective, 'onDragOver');
jest.spyOn(fileDropDirective, 'onDragOver');
directiveElement.triggerEventHandler('dragover', getFakeEventData());
@@ -119,7 +121,7 @@ describe('Directive: FileDropDirective', () => {
});
it('handles dragleave event', () => {
spyOn(fileDropDirective, 'onDragLeave');
jest.spyOn(fileDropDirective, 'onDragLeave');
directiveElement.triggerEventHandler('dragleave', getFakeEventData());

View File

@@ -72,7 +72,7 @@ describe('Directive: FileSelectDirective', () => {
const filters = fileSelectDirective.getFilters();
// TODO: Update test once implemented
expect(filters).toEqual({});
expect(filters).toEqual('');
});
it('can check if element is empty', () => {
@@ -82,18 +82,20 @@ describe('Directive: FileSelectDirective', () => {
});
it('can listed on change event', () => {
spyOn(fileSelectDirective, 'onChange');
const change = jest.spyOn(fileSelectDirective, 'onChange');
directiveElement.triggerEventHandler('change', {});
expect(fileSelectDirective.onChange).toHaveBeenCalled();
expect(change).toHaveBeenCalled();
});
it('handles change event', () => {
spyOn(fileSelectDirective.uploader, 'addToQueue');
let addToQueue;
if (fileSelectDirective.uploader?.addToQueue) {
addToQueue = jest.spyOn(fileSelectDirective.uploader, 'addToQueue');
}
fileSelectDirective.onChange();
expect(fileSelectDirective.uploader.addToQueue).toHaveBeenCalledWith(directiveElement.nativeElement.files, fileSelectDirective.getOptions(), fileSelectDirective.getFilters());
expect(addToQueue).toHaveBeenCalledWith(directiveElement.nativeElement.files, fileSelectDirective.getOptions(), fileSelectDirective.getFilters());
});
});

View File

@@ -1 +1 @@
import 'jest-preset-angular';
import 'jest-preset-angular/setup-jest';

View File

@@ -17,7 +17,8 @@
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
"noFallthroughCasesInSwitch": true,
"target": "es2020"
},
"angularCompilerOptions": {
"strictInjectionParameters": true,
@@ -25,4 +26,3 @@
"fullTemplateTypeCheck": true
}
}

View File

@@ -2,12 +2,15 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"target": "es2015",
"target": "es2020",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": [],
"lib": ["dom", "es2018"]
"lib": [
"dom",
"es2018"
]
},
"angularCompilerOptions": {
"skipTemplateCodegen": true,
@@ -18,6 +21,8 @@
"**/*.ts"
],
"exclude": [
"**/*.spec.ts"
"**/*.spec.ts",
"**/*.test.ts",
"jest.config.ts"
]
}

View File

@@ -1,10 +1,12 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.lib.json",
"compilerOptions": {
"declarationMap": false
},
"angularCompilerOptions": {
"enableIvy": false
}
"compilationMode": "partial"
},
"exclude": [
"jest.config.ts"
]
}

View File

@@ -3,10 +3,18 @@
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
"types": [
"jest",
"node"
]
},
"files": [
"testing/test-setup.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
"**/*.test.ts",
"**/*.d.ts",
"jest.config.ts"
]
}

35
nx.json
View File

@@ -8,31 +8,32 @@
".eslintrc.json": "*",
"nx.json": "*"
},
"projects": {
"ng2-file-upload": {
"tags": [
"lib"
]
},
"ng2-file-upload-demo": {
"tags": [],
"implicitDependencies": [
"ng2-file-upload"
]
}
},
"tasksRunnerOptions": {
"default": {
"runner": "@nrwl/workspace/tasks-runners/default",
"runner": "nx/tasks-runners/default",
"options": {
"cacheableOperations": [
"build",
"lint",
"test",
"e2e"
]
],
"parallel": 1
}
}
}
},
"affected": {
"defaultBase": "master"
},
"defaultProject": "ng2-file-upload-demo",
"generators": {
"@schematics/angular:component": {
"prefix": "",
"styleext": "css"
},
"@schematics/angular:directive": {
"prefix": ""
}
},
"$schema": "./node_modules/nx/schemas/nx-schema.json"
}

25958
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,23 +1,22 @@
{
"name": "ng2-file-upload-base",
"version": "3.0.0",
"version": "2.0.0-3",
"private": true,
"description": "Angular file upload directives",
"scripts": {
"ng": "nx",
"start": "ng serve",
"demo.build": "ng build",
"demo.build-prod": "ng build --configuration production",
"demo.build-prod": "ng build",
"build": "nx run ng2-file-upload:build",
"build-prod": "nx run ng2-file-upload:build:production",
"build.watch": "nx run ng2-file-upload:build --watch",
"test": "nx run-many --all --target=test",
"build-prod": "nx run ng2-file-upload:build",
"lint": "nx run-many --target=lint --all",
"test": "nx run-many --target=test --all",
"version": "nx run ng2-file-upload:version",
"lint": "nx run-many --all --target=lint",
"pretest": "run-s lint build",
"test-coverage": "nx run-many --all --target=test --codeCoverage",
"demo.gh-pages": "run-s build demo.build demo.deploy",
"demo.deploy": "gh-pages -d dist/apps/ng2-file-upload",
"demo.deploy": "gh-pages -d dist/apps/demo",
"postinstall": "node ./decorate-angular-cli.js",
"flow.github-release": "conventional-github-releaser -p angular"
},
@@ -40,62 +39,63 @@
"homepage": "https://github.com/valor-software/ng2-file-upload#readme",
"peerDependencies": {},
"devDependencies": {
"@angular-devkit/build-angular": "~13.3.0",
"@angular-devkit/build-ng-packagr": "^0.1002.0",
"@angular/animations": "~13.3.0",
"@angular/cli": "~13.3.0",
"@angular/common": "~13.3.0",
"@angular/compiler": "~13.3.0",
"@angular/compiler-cli": "~13.3.0",
"@angular/core": "~13.3.0",
"@angular/forms": "~13.3.0",
"@angular/platform-browser": "~13.3.0",
"@angular/platform-browser-dynamic": "~13.3.0",
"@angular-eslint/eslint-plugin": "13.1.0",
"@angular-eslint/eslint-plugin-template": "13.1.0",
"@angular-eslint/template-parser": "13.1.0",
"@nrwl/angular": "13.9.4",
"@nrwl/cli": "11.2.12",
"@nrwl/node": "13.9.4",
"@nrwl/eslint-plugin-nx": "13.9.4",
"@nrwl/jest": "13.9.4",
"@nrwl/linter": "13.9.4",
"@angular-devkit/build-angular": "14.2.3",
"@angular-eslint/eslint-plugin": "14.0.4",
"@angular-eslint/eslint-plugin-template": "14.0.4",
"@angular-eslint/template-parser": "14.0.4",
"@angular/animations": "14.2.2",
"@angular/cli": "~14.2.0",
"@angular/common": "14.2.2",
"@angular/compiler": "14.2.2",
"@angular/compiler-cli": "14.2.2",
"@angular/core": "14.2.2",
"@angular/forms": "14.2.2",
"@angular/platform-browser": "14.2.2",
"@angular/platform-browser-dynamic": "14.2.2",
"@nrwl/angular": "14.7.5",
"@nrwl/cli": "14.7.5",
"@nrwl/eslint-plugin-nx": "14.7.5",
"@nrwl/jest": "14.7.5",
"@nrwl/linter": "14.7.5",
"@nrwl/node": "14.7.5",
"@types/fs-extra": "9.0.7",
"@types/jest": "26.0.20",
"@types/node": "^12.11.1",
"@types/jest": "28.1.8",
"@types/node": "18.7.1",
"@types/webpack": "^5.0.0",
"@typescript-eslint/eslint-plugin": "~4.28.3",
"@typescript-eslint/parser": "~4.28.3",
"@typescript-eslint/eslint-plugin": "5.33.1",
"@typescript-eslint/parser": "5.33.1",
"bootstrap": "3.3.7",
"classlist-polyfill": "1.2.0",
"codecov": "3.8.2",
"codelyzer": "^6.0.0",
"conventional-changelog-cli": "2.1.1",
"conventional-github-releaser": "3.1.5",
"core-js": "^3.14.0",
"eslint": "8.11.0",
"eslint-config-prettier": "8.5.0",
"eslint": "8.15.0",
"eslint-config-prettier": "8.1.0",
"fs-extra": "9.1.0",
"gh-pages": "3.2.2",
"google-code-prettify": "1.0.5",
"html-loader": "^1.3.2",
"jest": "26.6.3",
"jest": "28.1.3",
"jest-createspyobj": "2.0.0",
"jest-preset-angular": "8.3.2",
"jest-environment-jsdom": "28.1.1",
"jest-preset-angular": "12.2.2",
"markdown-loader": "^6.0.0",
"ng-packagr": "^13.3.0",
"ngx-bootstrap": "7.1.0",
"ng-packagr": "14.2.1",
"ngx-bootstrap": "8.0.0",
"npm-run-all": "^4.1.5",
"postcss": "^8.3.9",
"postcss-import": "14.1.0",
"postcss-preset-env": "7.5.0",
"postcss-url": "10.1.3",
"protractor": "~7.0.0",
"raw-loader": "^4.0.2",
"rxjs": "^6.6.0",
"ts-helpers": "^1.1.2",
"ts-jest": "26.5.1",
"ts-node": "8.3.0",
"tslint": "^6.1.0",
"tslint-config-valorsoft": "^2.2.1",
"typescript": "4.6.3",
"zone.js": "~0.11.4"
"ts-jest": "28.0.8",
"ts-node": "10.9.1",
"typescript": "4.7.4",
"zone.js": "0.11.5"
},
"contributors": [
{
@@ -120,7 +120,8 @@
}
],
"dependencies": {
"@nrwl/workspace": "^12.8.0",
"tslib": "^2.3.1"
"@nrwl/workspace": "14.7.5",
"nx": "14.7.5",
"tslib": "^2.0.0"
}
}

View File

@@ -1,12 +0,0 @@
{
"extends": "tslint-config-valorsoft",
"rulesDirectory": "./node_modules/codelyzer",
"rules": {
"no-forward-ref": false,
"no-null-keyword": false,
"only-arrow-functions": false,
"no-access-missing-member": false,
"directive-selector": false,
"component-selector": false
}
}