@eui/tools 6.3.14 → 6.3.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,94 @@
1
+ import { NgModule, Injector, DoBootstrap, ApplicationRef } from '@angular/core';
2
+ import { BrowserModule } from '@angular/platform-browser';
3
+ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
4
+ import { HttpClientModule } from '@angular/common/http';
5
+ import { createCustomElement } from '@angular/elements';
6
+
7
+ import { StoreModule, USER_PROVIDED_META_REDUCERS } from '@ngrx/store';
8
+ import { EffectsModule } from '@ngrx/effects';
9
+ import { StoreRouterConnectingModule } from '@ngrx/router-store';
10
+ import { StoreDevtoolsModule } from '@ngrx/store-devtools';
11
+
12
+ import { TranslateModule } from '@ngx-translate/core';
13
+
14
+ import {
15
+ CoreModule,
16
+ CONFIG_TOKEN,
17
+ EUI_CONFIG_TOKEN,
18
+ translateConfig,
19
+ } from '@eui/core';
20
+ import {
21
+ CsdrCoreModule,
22
+ ElementStorageService,
23
+ } from '@csdr/core';
24
+
25
+ import { @root.common.module@ as RootCommonModule } from '@root.npm.pkg@';
26
+ import {
27
+ DEFAULT_MAPPED_PROVIDERS,
28
+ } from '@csdr/integration/element';
29
+ import { RoutingModule } from './routing.module';
30
+
31
+ import { TOKEN, reducerProvider, getMetaReducers } from './reducers/index';
32
+ import { CustomSerializer } from './reducers/custom-route-serializer';
33
+ import { environment } from '../environments/environment';
34
+ import { appConfig } from '../config';
35
+ import { FallbackComponent } from './fallback.component';
36
+ import { ModuleComponent } from './module.component';
37
+ import { EUI_COMPONENTS_MODULES } from './eui-components';
38
+
39
+ @NgModule({
40
+ imports: [
41
+ BrowserModule,
42
+ BrowserAnimationsModule,
43
+ HttpClientModule,
44
+ StoreRouterConnectingModule.forRoot({ stateKey: 'router', serializer: CustomSerializer }),
45
+ StoreModule.forRoot(TOKEN),
46
+ EffectsModule.forRoot([]),
47
+ StoreDevtoolsModule.instrument({ name: appConfig.global.storeName, maxAge: 150, logOnly: environment.production }),
48
+ TranslateModule.forRoot(translateConfig),
49
+
50
+ CoreModule.forRoot(),
51
+ CsdrCoreModule.forRoot(),
52
+
53
+ RootCommonModule,
54
+ RoutingModule,
55
+
56
+ ...EUI_COMPONENTS_MODULES,
57
+ ],
58
+ declarations: [
59
+ FallbackComponent,
60
+ ModuleComponent,
61
+ ],
62
+ entryComponents: [
63
+ FallbackComponent,
64
+ ModuleComponent,
65
+ ],
66
+ providers: [
67
+ reducerProvider,
68
+ {
69
+ provide: USER_PROVIDED_META_REDUCERS,
70
+ deps: [CONFIG_TOKEN, ElementStorageService],
71
+ useFactory: getMetaReducers,
72
+ },
73
+ {
74
+ provide: EUI_CONFIG_TOKEN,
75
+ useValue: { appConfig: { ...appConfig, ...environment }, environment },
76
+ },
77
+
78
+ ...DEFAULT_MAPPED_PROVIDERS,
79
+ ],
80
+ })
81
+ export class AppModule implements DoBootstrap {
82
+
83
+ constructor(private injector: Injector) {
84
+ }
85
+
86
+ ngDoBootstrap(appRef: ApplicationRef): void {
87
+ const elementSampleEui = createCustomElement(ModuleComponent, { injector: this.injector });
88
+ try {
89
+ customElements.define(appConfig.global.elementName, elementSampleEui);
90
+ } catch (e) {
91
+ console.log(e);
92
+ }
93
+ }
94
+ }
@@ -0,0 +1,34 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { RouterModule, Routes } from '@angular/router';
3
+
4
+ import { ELEMENT_ROUTES_TOKEN } from '@csdr/integration/element';
5
+
6
+ import { routes } from '@root.npm.pkg@';
7
+ // DON'T PAY ATTENTION TO IMPORT ERRORS HERE, those files are injected at serve/build time
8
+ import { appConfig } from '../config/index';
9
+ import { FallbackComponent } from './fallback.component';
10
+ import { ModuleComponent } from './module.component';
11
+
12
+ const elementRoutes: Routes = [
13
+ { path: '', component: ModuleComponent },
14
+ {
15
+ path: appConfig.global.baseUrl,
16
+ children: routes,
17
+ },
18
+ { path: '**', component: FallbackComponent },
19
+ ];
20
+
21
+ // @dynamic
22
+ @NgModule({
23
+ imports: [
24
+ RouterModule.forRoot(elementRoutes),
25
+ ],
26
+ providers: [
27
+ { provide: ELEMENT_ROUTES_TOKEN, useValue: elementRoutes },
28
+ ],
29
+ exports: [
30
+ RouterModule,
31
+ ],
32
+ })
33
+ export class RoutingModule {
34
+ }
@@ -0,0 +1,55 @@
1
+ import { registerLocaleData } from '@angular/common';
2
+
3
+ import localeEn from '@angular/common/locales/en';
4
+ import localeEnExtra from '@angular/common/locales/extra/en';
5
+ import localeFr from '@angular/common/locales/fr';
6
+ import localeFrExtra from '@angular/common/locales/extra/fr';
7
+
8
+ import { GlobalConfig, I18nConfig, LocaleServiceConfig } from '@eui/core';
9
+
10
+ /**
11
+ * import and register locales (currently MWP uses only French and English)
12
+ */
13
+ registerLocaleData(localeEn, 'en', localeEnExtra);
14
+ registerLocaleData(localeFr, 'fr', localeFrExtra);
15
+
16
+ /**
17
+ * Internationalization Configuration
18
+ */
19
+ const i18nConfig: I18nConfig = {
20
+ i18nLoader: {
21
+ i18nFolders: ['elements/@remote.name@/bundles/assets/i18n-compiled'],
22
+ i18nResources: [{
23
+ prefix: 'assets/i18n-eui/',
24
+ suffix: '.json',
25
+ }],
26
+ },
27
+ i18nService: {
28
+ languages: ['en', 'fr'],
29
+ defaultLanguage: 'en',
30
+ },
31
+ };
32
+
33
+ /**
34
+ * Locale Configuration
35
+ */
36
+ const localeConfig: LocaleServiceConfig = {
37
+ id: 'en',
38
+ available: ['en', 'fr'],
39
+ bindWithTranslate: true,
40
+ affectGlobalLocale: true,
41
+ };
42
+
43
+ /**
44
+ * Global Configuration
45
+ */
46
+ export const GLOBAL: GlobalConfig = {
47
+ /* URL that needs to be used in the appRouting of the MWP */
48
+ baseUrl: '@base.url@',
49
+ /* Element tag name that needs to be unique - make sure it doesn't collide with any other MWP element */
50
+ elementName: '@element.name@',
51
+ /* in case you are using NgRx give it a unique name (mostly for debugging) */
52
+ storeName: '@store.name@',
53
+ i18n: i18nConfig,
54
+ locale: localeConfig,
55
+ };
@@ -126,7 +126,18 @@ module.exports.generateVirtualRemote = (remoteName, cloneRemote = true) => {
126
126
  tools.logInfo(`copying full sources skeleton : ${remoteSkeletonFullPath} ==> ${remotePath}`);
127
127
  tools.copy(remoteSkeletonFullPath, remotePath);
128
128
 
129
- tools.logSuccess('OK => copy done');
129
+ tools.logInfo('Replacing skeleton config tokens');
130
+
131
+ const remoteSrcPath = path.join(remotePath, 'src');
132
+
133
+ tools.replaceInPath(remoteSrcPath, '@remote.name@', remote.name);
134
+ tools.replaceInPath(remoteSrcPath, '@base.url@', remote.skeletonConfig.baseUrl);
135
+ tools.replaceInPath(remoteSrcPath, '@element.name@', remote.skeletonConfig.elementName);
136
+ tools.replaceInPath(remoteSrcPath, '@store.name@', remote.skeletonConfig.storeName);
137
+ tools.replaceInPath(remoteSrcPath, '@root.common.module@', remote.skeletonConfig.rootCommonModule);
138
+ tools.replaceInPath(remoteSrcPath, '@root.npm.pkg@', remote.skeletonConfig.rootNpmPkg);
139
+
140
+ tools.logSuccess('OK => copy done - Tokens replaced');
130
141
  }
131
142
  })
132
143
 
@@ -1,3 +0,0 @@
1
- .example {
2
- padding: 10px;
3
- }