Skip to content

Commit

Permalink
Merge pull request #676 from geonetwork/export-as-npm-package
Browse files Browse the repository at this point in the history
Export all libs as NPM package
  • Loading branch information
jahow authored Nov 22, 2023
2 parents 326ef4b + 894d1e0 commit bd29f62
Show file tree
Hide file tree
Showing 53 changed files with 1,750 additions and 224 deletions.
8 changes: 1 addition & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,7 @@ You'll need manual configuration to make the application running:
// ...
// provide API url and proxy path
providers: [
{
provide: Configuration,
useFactory: () =>
new Configuration({
basePath: getGlobalConfig().GN4_API_URL,
}),
},
provideRepositoryUrl(() => getGlobalConfig().GN4_API_URL),
{
provide: PROXY_PATH,
useFactory: () => getGlobalConfig().PROXY_PATH,
Expand Down
28 changes: 13 additions & 15 deletions apps/datahub/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@ import { importProvidersFrom, Inject, NgModule } from '@angular/core'
import { MatIconModule } from '@angular/material/icon'
import { BrowserModule } from '@angular/platform-browser'
import { Router, RouterModule } from '@angular/router'
import { Configuration } from '@geonetwork-ui/data-access/gn4'
import {
FeatureCatalogModule,
ORGANIZATION_URL_TOKEN,
} from '@geonetwork-ui/feature/catalog'
import { FeatureRecordModule } from '@geonetwork-ui/feature/record'
import {
FeatureRecordModule,
GN_UI_VERSION,
WEB_COMPONENT_EMBEDDER_URL,
} from '@geonetwork-ui/feature/record'
import {
DefaultRouterModule,
ROUTE_PARAMS,
ROUTER_ROUTE_DATASET,
ROUTER_ROUTE_SEARCH,
ROUTE_PARAMS,
RouterService,
} from '@geonetwork-ui/feature/router'
import {
Expand All @@ -36,10 +39,10 @@ import {
} from '@geonetwork-ui/util/app-config'
import { UtilI18nModule } from '@geonetwork-ui/util/i18n'
import {
getGeometryFromGeoJSON,
PROXY_PATH,
ThemeService,
UtilSharedModule,
getGeometryFromGeoJSON,
} from '@geonetwork-ui/util/shared'
import { FeatureAuthModule } from '@geonetwork-ui/feature/auth'
import { EffectsModule } from '@ngrx/effects'
Expand All @@ -64,11 +67,12 @@ import { DatahubRouterService } from './router/datahub-router.service'
import { NavigationMenuComponent } from './home/navigation-menu/navigation-menu.component'
import { FormsModule } from '@angular/forms'
import { UiDatavizModule } from '@geonetwork-ui/ui/dataviz'
import { WEB_COMPONENT_EMBEDDER_URL } from '@geonetwork-ui/feature/record'
import { LANGUAGES_LIST, UiCatalogModule } from '@geonetwork-ui/ui/catalog'
import { METADATA_LANGUAGE } from '@geonetwork-ui/api/repository'
import {
METADATA_LANGUAGE,
provideRepositoryUrl,
} from '@geonetwork-ui/api/repository'
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'
import { GN_UI_VERSION } from '@geonetwork-ui/feature/record'
import { LOGIN_URL } from '@geonetwork-ui/api/repository/gn4'
import { RecordRelatedRecordsComponent } from './record/record-related-records/record-related-records.component'
import { RecordMetadataComponent } from './record/record-metadata/record-metadata.component'
Expand Down Expand Up @@ -142,16 +146,10 @@ export const metaReducers: MetaReducer[] = !environment.production ? [] : []
MatTabsModule,
],
providers: [
{ provide: RouterService, useClass: DatahubRouterService },
importProvidersFrom(FeatureAuthModule),
provideRepositoryUrl(() => getGlobalConfig().GN4_API_URL),
{ provide: RouterService, useClass: DatahubRouterService },
{ provide: GN_UI_VERSION, useValue: environment.version },
{
provide: Configuration,
useFactory: () =>
new Configuration({
basePath: getGlobalConfig().GN4_API_URL,
}),
},
{
provide: PROXY_PATH,
useFactory: () => getGlobalConfig().PROXY_PATH,
Expand Down
12 changes: 2 additions & 10 deletions apps/map-viewer/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { StoreDevtoolsModule } from '@ngrx/store-devtools'
import { EffectsModule } from '@ngrx/effects'
import { storeFreeze } from 'ngrx-store-freeze'
import { environment } from '../environments/environment'
import { Configuration } from '@geonetwork-ui/data-access/gn4'
import { provideRepositoryUrl } from '@geonetwork-ui/api/repository'

export const metaReducers: MetaReducer<any>[] = !environment.production
? [storeFreeze]
Expand All @@ -31,15 +31,7 @@ export const metaReducers: MetaReducer<any>[] = !environment.production
StoreDevtoolsModule.instrument(),
EffectsModule.forRoot(),
],
providers: [
{
provide: Configuration,
useFactory: () =>
new Configuration({
basePath: '/geonetwork/srv/api',
}),
},
],
providers: [provideRepositoryUrl('/geonetwork/srv/api')],
bootstrap: [AppComponent],
})
export class AppModule {
Expand Down
10 changes: 2 additions & 8 deletions apps/metadata-editor/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
DefaultRouterModule,
RouterService,
} from '@geonetwork-ui/feature/router'
import { Configuration } from '@geonetwork-ui/data-access/gn4'
import { getGlobalConfig, getThemeConfig } from '@geonetwork-ui/util/app-config'
import { ThemeService } from '@geonetwork-ui/util/shared'
import {
Expand All @@ -25,6 +24,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations'
import { extModules } from './build-specifics'
import { DashboardPageComponent } from './dashboard/dashboard-page.component'
import { EditorRouterService } from './router.service'
import { provideRepositoryUrl } from '@geonetwork-ui/api/repository'

@NgModule({
declarations: [AppComponent],
Expand Down Expand Up @@ -56,13 +56,7 @@ import { EditorRouterService } from './router.service'
importProvidersFrom(FeatureRecordModule),
importProvidersFrom(UtilI18nModule),
importProvidersFrom(TranslateModule.forRoot(TRANSLATE_DEFAULT_CONFIG)),
{
provide: Configuration,
useFactory: () =>
new Configuration({
basePath: getGlobalConfig().GN4_API_URL,
}),
},
provideRepositoryUrl(() => getGlobalConfig().GN4_API_URL),
importProvidersFrom(EffectsModule.forRoot()),
],
bootstrap: [AppComponent],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import { StoreModule } from '@ngrx/store'
import { EffectsModule } from '@ngrx/effects'
import { TranslateModule } from '@ngx-translate/core'
import { TRANSLATE_DEFAULT_CONFIG } from '@geonetwork-ui/util/i18n'
import { Configuration } from '@geonetwork-ui/data-access/gn4'
import { OrganizationsServiceInterface } from '@geonetwork-ui/common/domain/organizations.service.interface'
import { SearchFacade, SearchService } from '@geonetwork-ui/feature/search'
import {
AuthService,
AvatarServiceInterface,
} from '@geonetwork-ui/api/repository/gn4'
import { provideRepositoryUrl } from '@geonetwork-ui/api/repository'

const user = USER_FIXTURE()
class AuthServiceMock {
Expand Down Expand Up @@ -63,15 +63,12 @@ describe('SearchHeaderComponent', () => {
],
schemas: [NO_ERRORS_SCHEMA],
providers: [
provideRepositoryUrl('/geonetwork/srv/api'),
{ provide: AuthService, useClass: AuthServiceMock },
{
provide: AvatarServiceInterface,
useClass: AvatarServiceInterfaceMock,
},
{
provide: Configuration,
useValue: new Configuration({ basePath: '/geonetwork/srv/api' }),
},
{
provide: OrganizationsServiceInterface,
useClass: OrganisationsServiceMock,
Expand Down
13 changes: 3 additions & 10 deletions apps/search/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ import { FeatureMapModule } from '@geonetwork-ui/feature/map'
import { UiLayoutModule } from '@geonetwork-ui/ui/layout'
import { UiMapModule } from '@geonetwork-ui/ui/map'
import {
UtilI18nModule,
TRANSLATE_DEFAULT_CONFIG,
UtilI18nModule,
} from '@geonetwork-ui/util/i18n'
import { Configuration } from '@geonetwork-ui/data-access/gn4'
import { FeatureSearchModule } from '@geonetwork-ui/feature/search'
import { EffectsModule } from '@ngrx/effects'
import { MetaReducer, StoreModule } from '@ngrx/store'
Expand All @@ -22,6 +21,7 @@ import { AppRoutingModule } from './app-routing.module'
import { AppComponent } from './app.component'
import { MainSearchComponent } from './main-search/main-search.component'
import { NoopAnimationsModule } from '@angular/platform-browser/animations'
import { provideRepositoryUrl } from '@geonetwork-ui/api/repository'

export const metaReducers: MetaReducer<any>[] = !environment.production
? [storeFreeze]
Expand All @@ -46,14 +46,7 @@ export const metaReducers: MetaReducer<any>[] = !environment.production
EffectsModule.forRoot(),
NoopAnimationsModule,
],
providers: [
{
provide: Configuration,
useValue: new Configuration({
basePath: environment.API_BASE_PATH,
}),
},
],
providers: [provideRepositoryUrl(environment.API_BASE_PATH)],
bootstrap: [AppComponent],
})
export class AppModule {}
2 changes: 2 additions & 0 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ function sidebarGuide() {
{ text: 'Prerequisites', link: '/guide/prerequisites' },
{ text: 'Configure', link: '/guide/configure' },
{ text: 'Deploy', link: '/guide/deploy' },
{ text: 'Theming', link: '/guide/theming' },
{ text: 'Web components', link: '/guide/webcomponents' },
{ text: 'Custom Applications', link: '/guide/custom-app' },
{ text: 'Troubleshooting', link: '/guide/troubleshooting' },
{ text: 'FAQ', link: '/guide/faq' },
],
Expand Down
Loading

0 comments on commit bd29f62

Please sign in to comment.