From 3880ab3d7470e2f55a1798e36da749d99e4480c7 Mon Sep 17 00:00:00 2001 From: Dmitry Nehaychik <4dmitr@gmail.com> Date: Fri, 4 Aug 2017 19:27:16 +0300 Subject: [PATCH] refactor(app): remove shared module, export dependencies through --- src/app/@theme/theme.module.ts | 6 ++++- src/app/app.module.ts | 4 ++- src/app/pages/charts/charts.module.ts | 4 +-- src/app/pages/components/components.module.ts | 7 ++--- src/app/pages/dashboard/dashboard.module.ts | 8 +++--- src/app/pages/editors/editors.module.ts | 2 -- src/app/pages/forms/forms.module.ts | 9 ++----- src/app/pages/maps/maps.module.ts | 4 +-- src/app/pages/tables/tables.module.ts | 5 ++-- .../ui-features/buttons/buttons.module.ts | 9 ++----- .../pages/ui-features/ui-features.module.ts | 10 ++----- src/app/shared.module.ts | 19 -------------- src/tsconfig.app.json | 26 ++----------------- 13 files changed, 27 insertions(+), 86 deletions(-) delete mode 100644 src/app/shared.module.ts diff --git a/src/app/@theme/theme.module.ts b/src/app/@theme/theme.module.ts index cbb52845..2a4f1577 100644 --- a/src/app/@theme/theme.module.ts +++ b/src/app/@theme/theme.module.ts @@ -1,6 +1,7 @@ import { ModuleWithProviders, NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; import { NbActionsModule, @@ -13,6 +14,7 @@ import { NbTabsetModule, NbThemeModule, NbUserModule, + NbCheckboxModule, } from '@nebular/theme'; import { @@ -44,6 +46,8 @@ const NB_MODULES = [ NbActionsModule, NbSearchModule, NbSidebarModule, + NbCheckboxModule, + NgbModule, ]; const COMPONENTS = [ @@ -65,7 +69,7 @@ const NB_THEME_PROVIDERS = [ { name: 'default', }, - [DEFAULT_THEME, COSMIC_THEME], + [ DEFAULT_THEME, COSMIC_THEME ], ).providers, ...NbSidebarModule.forRoot().providers, ...NbMenuModule.forRoot().providers, diff --git a/src/app/app.module.ts b/src/app/app.module.ts index da03e45b..67cf380c 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -13,6 +13,7 @@ import { CoreModule } from './@core/core.module'; import { AppComponent } from './app.component'; import { AppRoutingModule } from './app-routing.module'; import { ThemeModule } from './@theme/theme.module'; +import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; @NgModule({ declarations: [AppComponent], @@ -21,7 +22,8 @@ import { ThemeModule } from './@theme/theme.module'; BrowserAnimationsModule, HttpModule, AppRoutingModule, - CoreModule, + + NgbModule.forRoot(), ThemeModule.forRoot(), CoreModule.forRoot(), ], diff --git a/src/app/pages/charts/charts.module.ts b/src/app/pages/charts/charts.module.ts index 402e5fd9..baff5c43 100644 --- a/src/app/pages/charts/charts.module.ts +++ b/src/app/pages/charts/charts.module.ts @@ -2,8 +2,8 @@ import { NgModule } from '@angular/core'; import { AngularEchartsModule } from 'ngx-echarts'; import { NgxChartsModule } from '@swimlane/ngx-charts'; import { ChartsModule as Ng2Charts } from 'ng2-charts/ng2-charts'; +import { ThemeModule } from '../../@theme/theme.module'; -import { SharedModule } from '../../shared.module'; import { ChartsRoutingModule, routedComponents } from './charts-routing.module'; import { ChartjsBarComponent } from './chartjs/chartjs-bar.component'; import { ChartjsLineComponent } from './chartjs/chartjs-line.component'; @@ -48,7 +48,7 @@ const components = [ ]; @NgModule({ - imports: [SharedModule, ChartsRoutingModule, AngularEchartsModule, NgxChartsModule, Ng2Charts], + imports: [ThemeModule, ChartsRoutingModule, AngularEchartsModule, NgxChartsModule, Ng2Charts], declarations: [...routedComponents, ...components], }) export class ChartsModule {} diff --git a/src/app/pages/components/components.module.ts b/src/app/pages/components/components.module.ts index 39797481..38a5882a 100644 --- a/src/app/pages/components/components.module.ts +++ b/src/app/pages/components/components.module.ts @@ -1,20 +1,17 @@ import { NgModule } from '@angular/core'; -import { NbCheckboxModule } from '@nebular/theme'; import { TreeModule } from 'ng2-tree'; import { ToasterModule } from 'angular2-toaster'; -import { SharedModule } from '../../shared.module'; - +import { ThemeModule } from '../../@theme/theme.module'; import { ComponentsRoutingModule, routedComponents } from './components-routing.module'; @NgModule({ imports: [ - SharedModule, + ThemeModule, ComponentsRoutingModule, TreeModule, ToasterModule, - NbCheckboxModule, ], declarations: [ ...routedComponents, diff --git a/src/app/pages/dashboard/dashboard.module.ts b/src/app/pages/dashboard/dashboard.module.ts index 014271c7..f45d5a1b 100644 --- a/src/app/pages/dashboard/dashboard.module.ts +++ b/src/app/pages/dashboard/dashboard.module.ts @@ -1,8 +1,7 @@ import { NgModule } from '@angular/core'; -import { NbTabsetModule, NbUserModule } from '@nebular/theme'; import { AngularEchartsModule } from 'ngx-echarts'; -import { SharedModule } from '../../shared.module'; +import { ThemeModule } from '../../@theme/theme.module'; import { DashboardComponent } from './dashboard.component'; import { StatusCardComponent } from './status-card/status-card.component'; import { ContactsComponent } from './contacts/contacts.component'; @@ -20,11 +19,10 @@ import { PlayerComponent } from './player/player.component'; import { TrafficComponent } from './traffic/traffic.component'; import { TrafficChartComponent } from './traffic/traffic-chart.component'; + @NgModule({ imports: [ - NbTabsetModule, - NbUserModule, - SharedModule, + ThemeModule, AngularEchartsModule, ], declarations: [ diff --git a/src/app/pages/editors/editors.module.ts b/src/app/pages/editors/editors.module.ts index a342545c..2fe4c433 100644 --- a/src/app/pages/editors/editors.module.ts +++ b/src/app/pages/editors/editors.module.ts @@ -1,14 +1,12 @@ import { NgModule } from '@angular/core'; import { CKEditorModule } from 'ng2-ckeditor'; -import { SharedModule } from '../../shared.module'; import { ThemeModule } from '../../@theme/theme.module'; import { EditorsRoutingModule, routedComponents } from './editors-routing.module'; @NgModule({ imports: [ - SharedModule, ThemeModule, EditorsRoutingModule, CKEditorModule, diff --git a/src/app/pages/forms/forms.module.ts b/src/app/pages/forms/forms.module.ts index 1565f456..f0a2f4eb 100644 --- a/src/app/pages/forms/forms.module.ts +++ b/src/app/pages/forms/forms.module.ts @@ -1,17 +1,12 @@ import { NgModule } from '@angular/core'; -import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; -import { NbCheckboxModule } from '@nebular/theme'; - -import { SharedModule } from '../../shared.module'; +import { ThemeModule } from '../../@theme/theme.module'; import { FormsRoutingModule, routedComponents } from './forms-routing.module'; @NgModule({ imports: [ - SharedModule, + ThemeModule, FormsRoutingModule, - NgbModule, - NbCheckboxModule, ], declarations: [ ...routedComponents, diff --git a/src/app/pages/maps/maps.module.ts b/src/app/pages/maps/maps.module.ts index 5af32871..82435d5d 100644 --- a/src/app/pages/maps/maps.module.ts +++ b/src/app/pages/maps/maps.module.ts @@ -3,12 +3,12 @@ import { AgmCoreModule } from '@agm/core'; import { LeafletModule } from '@asymmetrik/angular2-leaflet'; import { AngularEchartsModule } from 'ngx-echarts'; -import { SharedModule } from '../../shared.module'; +import { ThemeModule } from '../../@theme/theme.module'; import { MapsRoutingModule, routedComponents } from './maps-routing.module'; @NgModule({ imports: [ - SharedModule, + ThemeModule, AgmCoreModule.forRoot(), LeafletModule.forRoot(), MapsRoutingModule, diff --git a/src/app/pages/tables/tables.module.ts b/src/app/pages/tables/tables.module.ts index c2c30671..77cf23ac 100644 --- a/src/app/pages/tables/tables.module.ts +++ b/src/app/pages/tables/tables.module.ts @@ -1,14 +1,13 @@ import { NgModule } from '@angular/core'; import { Ng2SmartTableModule } from 'ng2-smart-table'; -import { SharedModule } from '../../shared.module'; - +import { ThemeModule } from '../../@theme/theme.module'; import { TablesRoutingModule, routedComponents } from './tables-routing.module'; import { SmartTableService } from '../../@core/data/smart-table.service'; @NgModule({ imports: [ - SharedModule, + ThemeModule, TablesRoutingModule, Ng2SmartTableModule, ], diff --git a/src/app/pages/ui-features/buttons/buttons.module.ts b/src/app/pages/ui-features/buttons/buttons.module.ts index f2ce5587..ba34dc54 100644 --- a/src/app/pages/ui-features/buttons/buttons.module.ts +++ b/src/app/pages/ui-features/buttons/buttons.module.ts @@ -1,8 +1,6 @@ import { NgModule } from '@angular/core'; -import { NbActionsModule, NbSearchModule, NbUserModule } from '@nebular/theme'; - -import { SharedModule } from '../../../shared.module'; +import { ThemeModule } from '../../../@theme/theme.module'; import { DefaultButtonsComponent } from './default-buttons/default-buttons.component'; import { HeroButtonComponent } from './hero-buttons/hero-buttons.component'; import { ShapeButtonsComponent } from './shape-buttons/shape-buttons.component'; @@ -31,10 +29,7 @@ const components = [ @NgModule({ imports: [ - SharedModule, - NbActionsModule, - NbSearchModule, - NbUserModule, + ThemeModule, ], exports: [ ...components, diff --git a/src/app/pages/ui-features/ui-features.module.ts b/src/app/pages/ui-features/ui-features.module.ts index d125941c..5f337d57 100644 --- a/src/app/pages/ui-features/ui-features.module.ts +++ b/src/app/pages/ui-features/ui-features.module.ts @@ -1,10 +1,7 @@ import { NgModule } from '@angular/core'; -import { NbTabsetModule, NbRouteTabsetModule, NbSearchModule } from '@nebular/theme'; - -import { SharedModule } from '../../shared.module'; +import { ThemeModule } from '../../@theme/theme.module'; import { ButtonsModule } from './buttons/buttons.module'; - import { UiFeaturesRoutingModule } from './ui-features-routing.module'; import { UiFeaturesComponent } from './ui-features.component'; import { GridComponent } from './grid/grid.component'; @@ -30,11 +27,8 @@ const components = [ @NgModule({ imports: [ - SharedModule, + ThemeModule, UiFeaturesRoutingModule, - NbTabsetModule, - NbRouteTabsetModule, - NbSearchModule, ButtonsModule, ], declarations: [ diff --git a/src/app/shared.module.ts b/src/app/shared.module.ts deleted file mode 100644 index 512ca2a3..00000000 --- a/src/app/shared.module.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { RouterModule } from '@angular/router'; -import { NbCardModule, NbThemeModule } from '@nebular/theme'; -import { ThemeModule } from './@theme/theme.module'; - -@NgModule({ - exports: [ - CommonModule, - FormsModule, - ReactiveFormsModule, - RouterModule, - NbCardModule, - NbThemeModule, - ThemeModule, - ], -}) -export class SharedModule { } diff --git a/src/tsconfig.app.json b/src/tsconfig.app.json index d68fe7f0..3c671745 100644 --- a/src/tsconfig.app.json +++ b/src/tsconfig.app.json @@ -9,34 +9,12 @@ "@angular/*": [ "../node_modules/@angular/*" ], - "@akveo/*": [ - "../node_modules/@akveo/*" - ], - "@ng-bootstrap/*": [ - "../node_modules/@ng-bootstrap/*" - ], - "bootstrap/*": [ - "../node_modules/bootstrap/*" - ], - "font-awesome/*": [ - "../node_modules/font-awesome/*" + "@nebular/*": [ + "../node_modules/@nebular/*" ], "immutable/*": [ "../node_modules/immutable/*" - ], - "ionicons/*": [ - "../node_modules/ionicons/*" - ], - "normalize.css/*": [ - "../node_modules/normalize.css/*" - ], - "segoe-fonts/*": [ - "../node_modules/segoe-fonts/*" - ], - "typeface-exo/*": [ - "../node_modules/typeface-exo/*" ] - } }, "exclude": [