Skip to content

Commit

Permalink
Update angular wrappers to ng 15 (#25857)
Browse files Browse the repository at this point in the history
Co-authored-by: Vasily Strelyaev <[email protected]>
Co-authored-by: timbset <[email protected]>
  • Loading branch information
3 people authored Oct 31, 2023
1 parent e5d17f5 commit 5ece737
Show file tree
Hide file tree
Showing 72 changed files with 4,557 additions and 14,653 deletions.
11,559 changes: 4,427 additions & 7,132 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"shx": "0.3.4",
"source-map": "0.7.4",
"ts-node": "^10.9.1",
"typescript": "~4.2.4"
"typescript": "^4.9.5"
},
"pre-commit": [
"lint-staged",
Expand Down
2 changes: 1 addition & 1 deletion packages/devextreme-angular/build.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ module.exports = {
srcFilesPattern: '**/*.ts',
tsTestSrc: ['tests/src/**/*.spec.ts', 'tests/src/**/component-names.ts'],
testsPath: 'tests/dist',
sourcesGlobs: ['src/**/*.*', './package.json'],
sourcesGlobs: ['src/**/*.*', './package.json', './ng-package.json'],
tsSourcesGlob: 'src/**/*.ts',
outputPath: 'dist'
},
Expand Down
19 changes: 15 additions & 4 deletions packages/devextreme-angular/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ gulp.task('build.ngc', function() {

return ngPackagr
.ngPackagr()
.forProject(path.join(config.outputPath, 'package.json'))
.forProject(path.join(config.outputPath, 'ng-package.json'))
.withTsConfig('tsconfig.lib.json')
.build()
});
Expand Down Expand Up @@ -160,13 +160,22 @@ gulp.task('npm.pack', gulp.series(
(cb) => {
argv.withDescriptions ? exec('npm --prefix ../../ run angular:inject-descriptions', (err) => cb(err)) : cb();
},
(cb) => { exec('npm pack', { cwd: buildConfig.npm.distPath }, (err) => cb(err)) }
(cb) => { exec('npm pack', { cwd: buildConfig.npm.distPath }, (err) => cb(err)) },
() => { return gulp.src(buildConfig.npm.distPath)
.pipe(gulp.dest('./node_modules/devextreme-angular')); }
));

gulp.task('copy.source', function() {
var npmConfig = buildConfig.npm;
return gulp.src(`${path.join(npmConfig.distPath, '/**/*.*')}`)
.pipe(gulp.dest('./node_modules/devextreme-angular'));
});

//------------Main------------

var buildTask = gulp.series(
'build.components'
'build.components',
'copy.source'
);

gulp.task('build', buildTask);
Expand Down Expand Up @@ -241,7 +250,9 @@ gulp.task('test.components.server.debug', function(done) {
new karmaServer(config, done).start();
});

gulp.task('run.tests', gulp.series('test.components.server', 'test.components.client'));
gulp.task('run.tests', gulp.series('test.components.client'));

// gulp.task('run.tests', gulp.series('test.components.client', 'test.components.server'));

gulp.task('test', gulp.series('build', 'run.tests'));

Expand Down
10 changes: 10 additions & 0 deletions packages/devextreme-angular/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "./node_modules/ng-packagr/ng-package.schema.json",
"lib": {
"entryFile": "index.ts"
},
"allowedNonPeerDependencies": [
"."
],
"dest": "../npm/dist"
}
36 changes: 13 additions & 23 deletions packages/devextreme-angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
"devextreme": "~23.2.0"
},
"devDependencies": {
"@angular/animations": "~12.2.17",
"@angular/common": "~12.2.17",
"@angular/compiler": "~12.2.17",
"@angular/compiler-cli": "~12.2.17",
"@angular/core": "~12.2.17",
"@angular/forms": "~12.2.17",
"@angular/platform-browser": "~12.2.17",
"@angular/platform-browser-dynamic": "~12.2.17",
"@angular/platform-server": "~12.2.17",
"@angular/animations": "~15.2.10",
"@angular/common": "~15.2.10",
"@angular/compiler": "~15.2.10",
"@angular/compiler-cli": "~15.2.10",
"@angular/core": "^15.2.10",
"@angular/forms": "~15.2.10",
"@angular/platform-browser": "~15.2.10",
"@angular/platform-browser-dynamic": "~15.2.10",
"@angular/platform-server": "~15.2.10",
"@types/jasmine": "2.8.19",
"@types/node": "~20.8.0",
"codelyzer": "6.0.2",
Expand All @@ -49,11 +49,11 @@
"karma-jasmine": "^5.1.0",
"karma-junit-reporter": "^2.0.1",
"karma-webpack": "^5.0.0",
"ng-packagr": "12.2.7",
"ng-packagr": "^15.2.2",
"puppeteer": "^19.11.1",
"rxjs": "^6.6.7",
"stream-browserify": "^3.0.0",
"typescript": "~4.2.3",
"typescript": "^4.9.5",
"webpack": "^5.88.2",
"yargs": "^6.6.0",
"zone.js": "^0.11.8"
Expand All @@ -65,19 +65,9 @@
"devexpress"
],
"dependencies": {
"@angular-devkit/schematics": "^12.2.18",
"@angular-devkit/schematics": "15.2.10",
"devextreme-schematics": "*",
"inferno-server": "7.4.11"
},
"schematics": "./schematics/collection.json",
"ngPackage": {
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"lib": {
"entryFile": "index.ts"
},
"dest": "../npm/dist",
"whitelistedNonPeerDependencies": [
"."
]
}
"schematics": "./schematics/collection.json"
}
5 changes: 5 additions & 0 deletions packages/devextreme-angular/src/core/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "index.ts"
}
}
7 changes: 0 additions & 7 deletions packages/devextreme-angular/src/core/package.json

This file was deleted.

5 changes: 5 additions & 0 deletions packages/devextreme-angular/src/server/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"lib": {
"entryFile": "index.ts"
}
}
7 changes: 0 additions & 7 deletions packages/devextreme-angular/src/server/package.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* tslint:disable:component-selector */

import {
Component,
ElementRef,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* tslint:disable:component-selector */

import {
Component,
ElementRef,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* tslint:disable:component-selector */

import {
Component,
ElementRef,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* tslint:disable:component-selector */

import {
Component,
ElementRef,
Expand Down
6 changes: 3 additions & 3 deletions packages/devextreme-angular/tests/src/ui/chart.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* tslint:disable:component-selector */

import {
Component,
ViewChild
Expand All @@ -14,6 +13,7 @@ import {
import {
DxChartModule, DxChartComponent, DxScrollViewModule
} from 'devextreme-angular';

import dxChart from 'devextreme/viz/chart';

@Component({
Expand All @@ -25,12 +25,12 @@ class TestContainerComponent {
label: 'label1'
}];
@ViewChild(DxChartComponent) chart: DxChartComponent;
dataSource = [];
dataSource: any[] = [];
disposed = false;
commonSeriesSettings = {
argumentField: undefined
};
seriesAsArray = [];
seriesAsArray: any[] = [];
seriesAsObject = {
valueField: undefined
};
Expand Down
11 changes: 5 additions & 6 deletions packages/devextreme-angular/tests/src/ui/data-grid.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* tslint:disable:component-selector */

import {
Component,
ViewChildren,
Expand Down Expand Up @@ -184,8 +183,8 @@ describe('DxDataGrid', () => {
if (typeof column === 'string') {
fail();
} else {
expect(column.columns.length).toBe(1);
expect(column.columns[0]['dataField']).toBe('Field');
expect(column?.columns?.length).toBe(1);
expect(column?.columns?.[0]['dataField']).toBe('Field');
}
});

Expand Down Expand Up @@ -236,11 +235,11 @@ describe('DxDataGrid', () => {
jasmine.clock().tick(101);
let testComponent = fixture.componentInstance;
const instance = testComponent.innerWidgets.last.instance;
expect(instance.option('columnChooser').enabled).toBe(true);
expect(instance?.option('columnChooser')?.enabled).toBe(true);

testComponent.showComponent = false;
fixture.detectChanges();
expect(instance.option('columnChooser').enabled).toBe(false);
expect(instance?.option('columnChooser')?.enabled).toBe(false);
jasmine.clock().uninstall();
});

Expand Down Expand Up @@ -511,7 +510,7 @@ describe('Nested DxDataGrid', () => {
setTimeout(() => {
let instance = fixture.componentInstance.innerWidgets.first.instance;
let element = instance.element().querySelector('.my-template');
expect(element.textContent).toBe('String');
expect(element?.textContent).toBe('String');
done();
}, 1000);
});
Expand Down
3 changes: 1 addition & 2 deletions packages/devextreme-angular/tests/src/ui/events.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* tslint:disable:component-selector */

import {
Component, NgZone
} from '@angular/core';
Expand Down Expand Up @@ -76,7 +75,7 @@ describe('events', () => {

const element = fixture.nativeElement.querySelector('.elem');
let counter = 0;
fixture.ngZone.runOutsideAngular(() => {
fixture?.ngZone?.runOutsideAngular(() => {
on(element, 'click', () => {
expect(NgZone.isInAngularZone()).toBe(true);
counter++;
Expand Down
3 changes: 1 addition & 2 deletions packages/devextreme-angular/tests/src/ui/form.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* tslint:disable:component-selector */

import {
Component,
ViewChild
Expand Down Expand Up @@ -134,7 +133,7 @@ describe('DxForm', () => {
let instance = getWidget(fixture);
let input = instance.element().querySelector('input');
input.value = 'test value';
input.dispatchEvent(new Event('change'));
input?.dispatchEvent(new Event('change'));

expect(document.getElementById('text').innerText.trim()).toBe('test value');
fixture.autoDetectChanges(false);
Expand Down
Loading

0 comments on commit 5ece737

Please sign in to comment.