Skip to content

Commit

Permalink
migrate to Standalone components
Browse files Browse the repository at this point in the history
  • Loading branch information
mohsen77sk committed Mar 21, 2024
1 parent 24b5aa3 commit 0651f88
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 253 deletions.
19 changes: 12 additions & 7 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
"outputPath": "dist/angular-material-date-fns-adapter",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"polyfills": [
"zone.js"
],
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
Expand Down Expand Up @@ -86,10 +88,11 @@
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"polyfills": [
"zone.js",
"zone.js/testing"
],
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
Expand Down Expand Up @@ -127,9 +130,11 @@
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/ngx-material-date-fns-adapter/src/test.ts",
"tsConfig": "projects/ngx-material-date-fns-adapter/tsconfig.spec.json",
"karmaConfig": "projects/ngx-material-date-fns-adapter/karma.conf.js"
"polyfills": [
"zone.js",
"zone.js/testing"
],
"tsConfig": "projects/ngx-material-date-fns-adapter/tsconfig.spec.json"
}
}
}
Expand Down
44 changes: 0 additions & 44 deletions karma.conf.js

This file was deleted.

44 changes: 0 additions & 44 deletions projects/ngx-material-date-fns-adapter/karma.conf.js

This file was deleted.

15 changes: 0 additions & 15 deletions projects/ngx-material-date-fns-adapter/src/test.ts

This file was deleted.

3 changes: 0 additions & 3 deletions projects/ngx-material-date-fns-adapter/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
"jasmine"
]
},
"files": [
"src/test.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
Expand Down
24 changes: 3 additions & 21 deletions src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,13 @@
import { TestBed } from '@angular/core/testing';
import { MatIconModule } from '@angular/material/icon';
import { MatCardModule } from '@angular/material/card';
import { MatInputModule } from '@angular/material/input';
import { MatButtonModule } from '@angular/material/button';
import { MatTooltipModule } from '@angular/material/tooltip';
import { MatToolbarModule } from '@angular/material/toolbar';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatDatepickerModule } from '@angular/material/datepicker';

import { AppComponent } from './app.component';
import { NgxMatDateFnsModule } from 'ngx-material-date-fns-adapter';
import { provideDateFnsAdapter } from 'ngx-material-date-fns-adapter';

describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
MatIconModule,
MatCardModule,
MatInputModule,
MatButtonModule,
MatTooltipModule,
MatToolbarModule,
MatFormFieldModule,
MatDatepickerModule,
NgxMatDateFnsModule,
],
declarations: [AppComponent],
imports: [AppComponent],
providers: [provideDateFnsAdapter()],
}).compileComponents();
});

Expand Down
19 changes: 19 additions & 0 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
import { Component, Inject, ViewEncapsulation } from '@angular/core';
import { DateAdapter, MAT_DATE_LOCALE } from '@angular/material/core';
import { MatIconModule } from '@angular/material/icon';
import { MatCardModule } from '@angular/material/card';
import { MatInputModule } from '@angular/material/input';
import { MatButtonModule } from '@angular/material/button';
import { MatTooltipModule } from '@angular/material/tooltip';
import { MatToolbarModule } from '@angular/material/toolbar';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatDatepickerModule } from '@angular/material/datepicker';
import packageJson from '../../projects/ngx-material-date-fns-adapter/package.json';

import { enUS, faIR, ar, fr, ja, ru } from 'date-fns/locale';

@Component({
standalone: true,
imports: [
MatIconModule,
MatCardModule,
MatInputModule,
MatButtonModule,
MatTooltipModule,
MatToolbarModule,
MatFormFieldModule,
MatDatepickerModule,
],
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
Expand Down
7 changes: 7 additions & 0 deletions src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { ApplicationConfig } from '@angular/core';
import { provideAnimations } from '@angular/platform-browser/animations';
import { provideDateFnsAdapter } from 'ngx-material-date-fns-adapter';

export const appConfig: ApplicationConfig = {
providers: [provideAnimations(), provideDateFnsAdapter()],
};
35 changes: 0 additions & 35 deletions src/app/app.module.ts

This file was deleted.

17 changes: 6 additions & 11 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app/app.component';
import { appConfig } from './app/app.config';

import { AppModule } from './app/app.module';
import { environment } from './environments/environment';

if (environment.production) {
enableProdMode();
}

platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));
bootstrapApplication(AppComponent, appConfig).catch((err) =>
console.error(err)
);
53 changes: 0 additions & 53 deletions src/polyfills.ts

This file was deleted.

14 changes: 0 additions & 14 deletions src/test.ts

This file was deleted.

3 changes: 1 addition & 2 deletions tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"types": []
},
"files": [
"src/main.ts",
"src/polyfills.ts"
"src/main.ts"
],
"include": [
"src/**/*.d.ts"
Expand Down
4 changes: 0 additions & 4 deletions tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
"jasmine"
]
},
"files": [
"src/test.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.spec.ts",
"src/**/*.d.ts"
Expand Down

0 comments on commit 0651f88

Please sign in to comment.