@rxap/layout 19.2.6-dev.0 → 21.0.1-dev.0
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.
- package/CHANGELOG.md +35 -0
- package/compodoc/changelog.html +33 -0
- package/compodoc/components/LayoutComponent.html +23 -31
- package/compodoc/components/NavigationComponent.html +30 -36
- package/compodoc/components/NavigationItemComponent.html +31 -36
- package/compodoc/components/SettingsButtonComponent.html +46 -46
- package/compodoc/components/SidenavComponent.html +43 -44
- package/compodoc/dependencies.html +20 -20
- package/compodoc/js/search/search_index.js +2 -2
- package/compodoc/properties.html +1 -1
- package/docs/documentation.json +2065 -2005
- package/docs/html/classes/AppsButtonComponent.html +4 -4
- package/docs/html/classes/BaseLayoutComponent.html +2 -2
- package/docs/html/classes/DefaultHeaderComponent.html +2 -2
- package/docs/html/classes/DefaultHeaderService.html +5 -5
- package/docs/html/classes/ExternalAppsService.html +2 -2
- package/docs/html/classes/FooterComponent.html +2 -2
- package/docs/html/classes/FooterDirective.html +3 -3
- package/docs/html/classes/FooterService.html +5 -5
- package/docs/html/classes/HeaderComponent.html +2 -2
- package/docs/html/classes/HeaderDirective.html +3 -3
- package/docs/html/classes/HeaderService.html +5 -5
- package/docs/html/classes/LayoutComponent.html +2 -2
- package/docs/html/classes/LayoutService.html +2 -2
- package/docs/html/classes/LogoService.html +2 -2
- package/docs/html/classes/MinimalLayoutComponent.html +2 -2
- package/docs/html/classes/NavigationComponent.html +3 -3
- package/docs/html/classes/NavigationItemComponent.html +6 -6
- package/docs/html/classes/NavigationProgressBarComponent.html +2 -2
- package/docs/html/classes/NavigationService.html +3 -3
- package/docs/html/classes/ReleaseInfoComponent.html +2 -2
- package/docs/html/classes/SettingsButtonComponent.html +2 -2
- package/docs/html/classes/SidenavComponent.html +3 -3
- package/docs/html/classes/SidenavFooterDirective.html +2 -2
- package/docs/html/classes/SidenavHeaderDirective.html +2 -2
- package/docs/html/classes/SidenavToggleButtonComponent.html +2 -2
- package/docs/html/classes/UserProfileIconComponent.html +2 -2
- package/docs/html/functions/IsNavigationDividerItem.html +1 -1
- package/docs/html/functions/IsNavigationInsertItem.html +1 -1
- package/docs/html/functions/IsNavigationItem.html +1 -1
- package/docs/html/functions/provideExternalApps.html +1 -1
- package/docs/html/functions/provideLayout.html +1 -1
- package/docs/html/functions/withDefaultHeaderComponent.html +1 -1
- package/docs/html/functions/withDefaultHeaderItems.html +1 -1
- package/docs/html/functions/withFooterComponents.html +1 -1
- package/docs/html/functions/withHeaderComponents.html +1 -1
- package/docs/html/functions/withNavigationConfig.html +1 -1
- package/docs/html/functions/withNavigationInserts.html +1 -1
- package/docs/html/functions/withReleaseInfoModules.html +1 -1
- package/docs/html/functions/withSettingsMenuItems.html +1 -1
- package/docs/html/functions/withUserProfileDataSource.html +1 -1
- package/docs/html/index.html +2 -2
- package/docs/html/interfaces/NavigationDividerItem.html +2 -2
- package/docs/html/interfaces/NavigationInsertItem.html +2 -2
- package/docs/html/interfaces/NavigationItem.html +2 -2
- package/docs/html/interfaces/NavigationStatus.html +2 -2
- package/docs/html/interfaces/ReleaseInfoModule.html +2 -2
- package/docs/html/interfaces/SettingsMenuItem.html +2 -2
- package/docs/html/modules.html +1 -1
- package/docs/html/types/DefaultHeaderItemComponent.html +1 -1
- package/docs/html/types/ExternalApp.html +1 -1
- package/docs/html/types/ExtractUsernameFromProfileFn.html +1 -1
- package/docs/html/types/Navigation.html +1 -1
- package/docs/html/types/NavigationWithInserts.html +1 -1
- package/docs/html/types/SettingsMenuItemComponent.html +1 -1
- package/docs/html/variables/EXTRACT_USERNAME_FROM_PROFILE.html +1 -1
- package/docs/html/variables/RXAP_DEFAULT_HEADER_ITEM_COMPONENT.html +1 -1
- package/docs/html/variables/RXAP_EXTERNAL_APP.html +1 -1
- package/docs/html/variables/RXAP_EXTERNAL_APP_FILTER.html +1 -1
- package/docs/html/variables/RXAP_FOOTER_COMPONENT.html +1 -1
- package/docs/html/variables/RXAP_HEADER_COMPONENT.html +1 -1
- package/docs/html/variables/RXAP_LAYOUT_APPS_GRID.html +1 -1
- package/docs/html/variables/RXAP_LOGO_CONFIG.html +1 -1
- package/docs/html/variables/RXAP_LOGO_CONFIG_DEFAULTS.html +1 -1
- package/docs/html/variables/RXAP_NAVIGATION_CONFIG.html +1 -1
- package/docs/html/variables/RXAP_NAVIGATION_CONFIG_INSERTS.html +1 -1
- package/docs/html/variables/RXAP_NAVIGATION_LAYOUT_CONFIG_DEFAULTS.html +1 -1
- package/docs/html/variables/RXAP_RELEASE_INFO_MODULE.html +1 -1
- package/docs/html/variables/RXAP_SETTINGS_MENU_ITEM.html +1 -1
- package/docs/html/variables/RXAP_SETTINGS_MENU_ITEM_COMPONENT.html +1 -1
- package/docs/html/variables/RXAP_USER_PROFILE_DATA_SOURCE.html +1 -1
- package/docs/markdown/README.md +1 -1
- package/docs/markdown/classes/AppsButtonComponent.md +8 -8
- package/docs/markdown/classes/BaseLayoutComponent.md +2 -2
- package/docs/markdown/classes/DefaultHeaderComponent.md +10 -10
- package/docs/markdown/classes/DefaultHeaderService.md +6 -6
- package/docs/markdown/classes/ExternalAppsService.md +18 -18
- package/docs/markdown/classes/FooterComponent.md +5 -5
- package/docs/markdown/classes/FooterDirective.md +4 -4
- package/docs/markdown/classes/FooterService.md +6 -6
- package/docs/markdown/classes/HeaderComponent.md +6 -6
- package/docs/markdown/classes/HeaderDirective.md +4 -4
- package/docs/markdown/classes/HeaderService.md +6 -6
- package/docs/markdown/classes/LayoutComponent.md +6 -6
- package/docs/markdown/classes/LayoutService.md +17 -17
- package/docs/markdown/classes/LogoService.md +6 -6
- package/docs/markdown/classes/MinimalLayoutComponent.md +2 -2
- package/docs/markdown/classes/NavigationComponent.md +14 -14
- package/docs/markdown/classes/NavigationItemComponent.md +20 -22
- package/docs/markdown/classes/NavigationProgressBarComponent.md +4 -4
- package/docs/markdown/classes/NavigationService.md +12 -12
- package/docs/markdown/classes/ReleaseInfoComponent.md +6 -6
- package/docs/markdown/classes/SettingsButtonComponent.md +19 -19
- package/docs/markdown/classes/SidenavComponent.md +18 -18
- package/docs/markdown/classes/SidenavFooterDirective.md +4 -4
- package/docs/markdown/classes/SidenavHeaderDirective.md +4 -4
- package/docs/markdown/classes/SidenavToggleButtonComponent.md +5 -5
- package/docs/markdown/classes/UserProfileIconComponent.md +7 -7
- package/docs/markdown/functions/IsNavigationDividerItem.md +2 -2
- package/docs/markdown/functions/IsNavigationInsertItem.md +2 -2
- package/docs/markdown/functions/IsNavigationItem.md +2 -2
- package/docs/markdown/functions/provideExternalApps.md +2 -2
- package/docs/markdown/functions/provideLayout.md +2 -2
- package/docs/markdown/functions/withDefaultHeaderComponent.md +2 -2
- package/docs/markdown/functions/withDefaultHeaderItems.md +2 -2
- package/docs/markdown/functions/withFooterComponents.md +2 -2
- package/docs/markdown/functions/withHeaderComponents.md +2 -2
- package/docs/markdown/functions/withNavigationConfig.md +2 -2
- package/docs/markdown/functions/withNavigationInserts.md +2 -2
- package/docs/markdown/functions/withReleaseInfoModules.md +2 -2
- package/docs/markdown/functions/withSettingsMenuItems.md +2 -2
- package/docs/markdown/functions/withUserProfileDataSource.md +2 -2
- package/docs/markdown/globals.md +2 -2
- package/docs/markdown/interfaces/NavigationDividerItem.md +4 -4
- package/docs/markdown/interfaces/NavigationInsertItem.md +3 -3
- package/docs/markdown/interfaces/NavigationItem.md +8 -8
- package/docs/markdown/interfaces/NavigationStatus.md +3 -3
- package/docs/markdown/interfaces/ReleaseInfoModule.md +5 -5
- package/docs/markdown/interfaces/SettingsMenuItem.md +5 -5
- package/docs/markdown/type-aliases/DefaultHeaderItemComponent.md +2 -2
- package/docs/markdown/type-aliases/ExternalApp.md +2 -2
- package/docs/markdown/type-aliases/ExtractUsernameFromProfileFn.md +2 -2
- package/docs/markdown/type-aliases/Navigation.md +2 -2
- package/docs/markdown/type-aliases/NavigationWithInserts.md +2 -2
- package/docs/markdown/type-aliases/SettingsMenuItemComponent.md +2 -2
- package/docs/markdown/variables/EXTRACT_USERNAME_FROM_PROFILE.md +2 -2
- package/docs/markdown/variables/RXAP_DEFAULT_HEADER_ITEM_COMPONENT.md +2 -2
- package/docs/markdown/variables/RXAP_EXTERNAL_APP.md +2 -2
- package/docs/markdown/variables/RXAP_EXTERNAL_APP_FILTER.md +2 -2
- package/docs/markdown/variables/RXAP_FOOTER_COMPONENT.md +2 -2
- package/docs/markdown/variables/RXAP_HEADER_COMPONENT.md +2 -2
- package/docs/markdown/variables/RXAP_LAYOUT_APPS_GRID.md +2 -2
- package/docs/markdown/variables/RXAP_LOGO_CONFIG.md +2 -2
- package/docs/markdown/variables/RXAP_LOGO_CONFIG_DEFAULTS.md +2 -2
- package/docs/markdown/variables/RXAP_NAVIGATION_CONFIG.md +2 -2
- package/docs/markdown/variables/RXAP_NAVIGATION_CONFIG_INSERTS.md +2 -2
- package/docs/markdown/variables/RXAP_NAVIGATION_LAYOUT_CONFIG_DEFAULTS.md +2 -2
- package/docs/markdown/variables/RXAP_RELEASE_INFO_MODULE.md +2 -2
- package/docs/markdown/variables/RXAP_SETTINGS_MENU_ITEM.md +2 -2
- package/docs/markdown/variables/RXAP_SETTINGS_MENU_ITEM_COMPONENT.md +2 -2
- package/docs/markdown/variables/RXAP_USER_PROFILE_DATA_SOURCE.md +2 -2
- package/docs/wiki/Class.AppsButtonComponent.md +7 -7
- package/docs/wiki/Class.BaseLayoutComponent.md +1 -1
- package/docs/wiki/Class.DefaultHeaderComponent.md +9 -9
- package/docs/wiki/Class.DefaultHeaderService.md +5 -5
- package/docs/wiki/Class.ExternalAppsService.md +17 -17
- package/docs/wiki/Class.FooterComponent.md +4 -4
- package/docs/wiki/Class.FooterDirective.md +3 -3
- package/docs/wiki/Class.FooterService.md +5 -5
- package/docs/wiki/Class.HeaderComponent.md +5 -5
- package/docs/wiki/Class.HeaderDirective.md +3 -3
- package/docs/wiki/Class.HeaderService.md +5 -5
- package/docs/wiki/Class.LayoutComponent.md +5 -5
- package/docs/wiki/Class.LayoutService.md +16 -16
- package/docs/wiki/Class.LogoService.md +5 -5
- package/docs/wiki/Class.MinimalLayoutComponent.md +1 -1
- package/docs/wiki/Class.NavigationComponent.md +13 -13
- package/docs/wiki/Class.NavigationItemComponent.md +19 -21
- package/docs/wiki/Class.NavigationProgressBarComponent.md +3 -3
- package/docs/wiki/Class.NavigationService.md +11 -11
- package/docs/wiki/Class.ReleaseInfoComponent.md +5 -5
- package/docs/wiki/Class.SettingsButtonComponent.md +18 -18
- package/docs/wiki/Class.SidenavComponent.md +17 -17
- package/docs/wiki/Class.SidenavFooterDirective.md +3 -3
- package/docs/wiki/Class.SidenavHeaderDirective.md +3 -3
- package/docs/wiki/Class.SidenavToggleButtonComponent.md +4 -4
- package/docs/wiki/Class.UserProfileIconComponent.md +6 -6
- package/docs/wiki/Function.IsNavigationDividerItem.md +1 -1
- package/docs/wiki/Function.IsNavigationInsertItem.md +1 -1
- package/docs/wiki/Function.IsNavigationItem.md +1 -1
- package/docs/wiki/Function.provideExternalApps.md +1 -1
- package/docs/wiki/Function.provideLayout.md +1 -1
- package/docs/wiki/Function.withDefaultHeaderComponent.md +1 -1
- package/docs/wiki/Function.withDefaultHeaderItems.md +1 -1
- package/docs/wiki/Function.withFooterComponents.md +1 -1
- package/docs/wiki/Function.withHeaderComponents.md +1 -1
- package/docs/wiki/Function.withNavigationConfig.md +1 -1
- package/docs/wiki/Function.withNavigationInserts.md +1 -1
- package/docs/wiki/Function.withReleaseInfoModules.md +1 -1
- package/docs/wiki/Function.withSettingsMenuItems.md +1 -1
- package/docs/wiki/Function.withUserProfileDataSource.md +1 -1
- package/docs/wiki/Interface.NavigationDividerItem.md +3 -3
- package/docs/wiki/Interface.NavigationInsertItem.md +2 -2
- package/docs/wiki/Interface.NavigationItem.md +7 -7
- package/docs/wiki/Interface.NavigationStatus.md +2 -2
- package/docs/wiki/Interface.ReleaseInfoModule.md +4 -4
- package/docs/wiki/Interface.SettingsMenuItem.md +4 -4
- package/docs/wiki/TypeAlias.DefaultHeaderItemComponent.md +1 -1
- package/docs/wiki/TypeAlias.ExternalApp.md +1 -1
- package/docs/wiki/TypeAlias.ExtractUsernameFromProfileFn.md +1 -1
- package/docs/wiki/TypeAlias.Navigation.md +1 -1
- package/docs/wiki/TypeAlias.NavigationWithInserts.md +1 -1
- package/docs/wiki/TypeAlias.SettingsMenuItemComponent.md +1 -1
- package/docs/wiki/Variable.EXTRACT_USERNAME_FROM_PROFILE.md +1 -1
- package/docs/wiki/Variable.RXAP_DEFAULT_HEADER_ITEM_COMPONENT.md +1 -1
- package/docs/wiki/Variable.RXAP_EXTERNAL_APP.md +1 -1
- package/docs/wiki/Variable.RXAP_EXTERNAL_APP_FILTER.md +1 -1
- package/docs/wiki/Variable.RXAP_FOOTER_COMPONENT.md +1 -1
- package/docs/wiki/Variable.RXAP_HEADER_COMPONENT.md +1 -1
- package/docs/wiki/Variable.RXAP_LAYOUT_APPS_GRID.md +1 -1
- package/docs/wiki/Variable.RXAP_LOGO_CONFIG.md +1 -1
- package/docs/wiki/Variable.RXAP_LOGO_CONFIG_DEFAULTS.md +1 -1
- package/docs/wiki/Variable.RXAP_NAVIGATION_CONFIG.md +1 -1
- package/docs/wiki/Variable.RXAP_NAVIGATION_CONFIG_INSERTS.md +1 -1
- package/docs/wiki/Variable.RXAP_NAVIGATION_LAYOUT_CONFIG_DEFAULTS.md +1 -1
- package/docs/wiki/Variable.RXAP_RELEASE_INFO_MODULE.md +1 -1
- package/docs/wiki/Variable.RXAP_SETTINGS_MENU_ITEM.md +1 -1
- package/docs/wiki/Variable.RXAP_SETTINGS_MENU_ITEM_COMPONENT.md +1 -1
- package/docs/wiki/Variable.RXAP_USER_PROFILE_DATA_SOURCE.md +1 -1
- package/docs/wiki/globals.md +1 -1
- package/fesm2022/rxap-layout.mjs +155 -161
- package/fesm2022/rxap-layout.mjs.map +1 -1
- package/package.json +47 -46
- package/src/generators/init/generator.ts +139 -0
- package/src/generators/init/index.ts +5 -0
- package/src/generators/init/schema.d.ts +2 -0
- package/src/generators/init/schema.json +8 -0
- package/{index.d.ts → src/index.ts} +47 -0
- package/src/migrations/18.0.0/add-seperate-external-apps-provider/__snapshots__/add-seperate-external-apps-provider.spec.ts.snap +1 -1
- package/src/migrations/18.0.0/add-seperate-external-apps-provider/add-seperate-external-apps-provider.spec.ts +63 -0
- package/src/migrations/18.0.0/add-seperate-external-apps-provider/add-seperate-external-apps-provider.ts +59 -0
- package/src/migrations/18.0.0/add-theme-provider-to-app-config/__snapshots__/add-theme-provider-to-app-config.spec.ts.snap +1 -1
- package/src/migrations/18.0.0/add-theme-provider-to-app-config/add-theme-provider-to-app-config.spec.ts +61 -0
- package/src/migrations/18.0.0/add-theme-provider-to-app-config/add-theme-provider-to-app-config.ts +44 -0
- package/src/migrations/18.0.0/add-user-theme-provider-to-layout-providers/__snapshots__/add-user-theme-provider-to-layout-providers.spec.ts.snap +1 -1
- package/src/migrations/18.0.0/add-user-theme-provider-to-layout-providers/add-user-theme-provider-to-layout-providers.spec.ts +94 -0
- package/src/migrations/18.0.0/add-user-theme-provider-to-layout-providers/add-user-theme-provider-to-layout-providers.ts +51 -0
- package/src/migrations/18.0.0/add-with-user-profile-provider/__snapshots__/add-with-user-profile-provider.spec.ts.snap +1 -1
- package/src/migrations/18.0.0/add-with-user-profile-provider/add-with-user-profile-provider.spec.ts +94 -0
- package/src/migrations/18.0.0/add-with-user-profile-provider/add-with-user-profile-provider.ts +53 -0
- package/src/test-setup.ts +25 -0
- package/types/rxap-layout.d.ts +509 -0
- package/lib/base-layout/base-layout.component.d.ts +0 -5
- package/lib/default-header/apps-button/apps-button.component.d.ts +0 -16
- package/lib/default-header/default-header.component.d.ts +0 -15
- package/lib/default-header/default-header.service.d.ts +0 -36
- package/lib/default-header/settings-button/settings-button.component.d.ts +0 -33
- package/lib/default-header/sidenav-toggle-button/sidenav-toggle-button.component.d.ts +0 -9
- package/lib/default-header/user-profile-icon/user-profile-icon.component.d.ts +0 -12
- package/lib/external-apps.service.d.ts +0 -26
- package/lib/footer/footer.component.d.ts +0 -9
- package/lib/footer/footer.directive.d.ts +0 -12
- package/lib/footer.service.d.ts +0 -32
- package/lib/header/header.component.d.ts +0 -11
- package/lib/header/header.directive.d.ts +0 -12
- package/lib/header.service.d.ts +0 -34
- package/lib/layout/layout.component.d.ts +0 -11
- package/lib/layout.service.d.ts +0 -27
- package/lib/logo.service.d.ts +0 -10
- package/lib/minimal-layout/minimal-layout.component.d.ts +0 -5
- package/lib/navigation/navigation-item/navigation-item.component.d.ts +0 -28
- package/lib/navigation/navigation-item.d.ts +0 -25
- package/lib/navigation/navigation.component.d.ts +0 -21
- package/lib/navigation-progress-bar/navigation-progress-bar.component.d.ts +0 -8
- package/lib/navigation.service.d.ts +0 -36
- package/lib/provide.d.ts +0 -17
- package/lib/release-info/release-info.component.d.ts +0 -10
- package/lib/sidenav/sidenav-footer.directive.d.ts +0 -8
- package/lib/sidenav/sidenav-header.directive.d.ts +0 -8
- package/lib/sidenav/sidenav.component.d.ts +0 -31
- package/lib/tokens.d.ts +0 -22
- package/lib/types.d.ts +0 -17
package/package.json
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "
|
|
2
|
+
"version": "21.0.1-dev.0",
|
|
3
3
|
"name": "@rxap/layout",
|
|
4
4
|
"description": "This library provides a set of Angular components and services for creating consistent and configurable application layouts, including headers, footers, side navigation, and content areas. It offers features such as dynamic navigation, external application integration, and customizable themes. The library also includes directives for extending header and footer areas with custom content.\n",
|
|
5
5
|
"license": "GPL-3.0-or-later",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@nx/devkit": "
|
|
8
|
-
"@rxap/ts-morph": "^1.7.
|
|
9
|
-
"@rxap/workspace-ts-morph": "^
|
|
10
|
-
"@rxap/workspace-utilities": "^
|
|
7
|
+
"@nx/devkit": "22.7.5",
|
|
8
|
+
"@rxap/ts-morph": "^1.7.1-dev.0",
|
|
9
|
+
"@rxap/workspace-ts-morph": "^22.0.1-dev.0",
|
|
10
|
+
"@rxap/workspace-utilities": "^22.0.1-dev.0",
|
|
11
11
|
"tslib": "2.6.2"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"@angular/animations": "^
|
|
15
|
-
"@angular/cdk": "^
|
|
16
|
-
"@angular/common": "^
|
|
17
|
-
"@angular/core": "^
|
|
18
|
-
"@angular/material": "^
|
|
19
|
-
"@angular/router": "^
|
|
20
|
-
"@rxap/browser-utilities": "^1.1.
|
|
21
|
-
"@rxap/config": "^
|
|
22
|
-
"@rxap/data-source": "^
|
|
23
|
-
"@rxap/environment": "^
|
|
24
|
-
"@rxap/material-directives": "^
|
|
25
|
-
"@rxap/ngx-pub-sub": "^
|
|
26
|
-
"@rxap/ngx-theme": "^
|
|
27
|
-
"@rxap/pattern": "^1.1.
|
|
28
|
-
"@rxap/utilities": "^16.5.
|
|
29
|
-
"rxjs": "^7.8.
|
|
14
|
+
"@angular/animations": "^21.2.9",
|
|
15
|
+
"@angular/cdk": "^21.2.9",
|
|
16
|
+
"@angular/common": "^21.2.9",
|
|
17
|
+
"@angular/core": "^21.2.9",
|
|
18
|
+
"@angular/material": "^21.2.9",
|
|
19
|
+
"@angular/router": "^21.2.9",
|
|
20
|
+
"@rxap/browser-utilities": "^1.1.15-dev.0",
|
|
21
|
+
"@rxap/config": "^21.0.1-dev.0",
|
|
22
|
+
"@rxap/data-source": "^21.0.1-dev.0",
|
|
23
|
+
"@rxap/environment": "^21.0.1-dev.0",
|
|
24
|
+
"@rxap/material-directives": "^21.0.1-dev.0",
|
|
25
|
+
"@rxap/ngx-pub-sub": "^21.0.1-dev.0",
|
|
26
|
+
"@rxap/ngx-theme": "^21.0.1-dev.0",
|
|
27
|
+
"@rxap/pattern": "^1.1.16-dev.0",
|
|
28
|
+
"@rxap/utilities": "^16.5.2-dev.0",
|
|
29
|
+
"rxjs": "^7.8.2"
|
|
30
30
|
},
|
|
31
31
|
"author": {
|
|
32
32
|
"name": "Merzough Münker",
|
|
@@ -54,91 +54,91 @@
|
|
|
54
54
|
"packageGroup": [
|
|
55
55
|
{
|
|
56
56
|
"package": "@angular/animations",
|
|
57
|
-
"version": "
|
|
57
|
+
"version": "21.2.9"
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
"package": "@angular/cdk",
|
|
61
|
-
"version": "
|
|
61
|
+
"version": "21.2.9"
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
"package": "@angular/common",
|
|
65
|
-
"version": "
|
|
65
|
+
"version": "21.2.9"
|
|
66
66
|
},
|
|
67
67
|
{
|
|
68
68
|
"package": "@angular/core",
|
|
69
|
-
"version": "
|
|
69
|
+
"version": "21.2.9"
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
72
|
"package": "@angular/forms",
|
|
73
|
-
"version": "
|
|
73
|
+
"version": "21.2.9"
|
|
74
74
|
},
|
|
75
75
|
{
|
|
76
76
|
"package": "@angular/material",
|
|
77
|
-
"version": "
|
|
77
|
+
"version": "21.2.9"
|
|
78
78
|
},
|
|
79
79
|
{
|
|
80
80
|
"package": "@angular/platform-browser",
|
|
81
|
-
"version": "
|
|
81
|
+
"version": "21.2.9"
|
|
82
82
|
},
|
|
83
83
|
{
|
|
84
84
|
"package": "@angular/router",
|
|
85
|
-
"version": "
|
|
85
|
+
"version": "21.2.9"
|
|
86
86
|
},
|
|
87
87
|
{
|
|
88
88
|
"package": "@rxap/browser-utilities",
|
|
89
|
-
"version": "1.1.
|
|
89
|
+
"version": "1.1.15-dev.0"
|
|
90
90
|
},
|
|
91
91
|
{
|
|
92
92
|
"package": "@rxap/config",
|
|
93
|
-
"version": "
|
|
93
|
+
"version": "21.0.1-dev.0"
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
96
|
"package": "@rxap/data-source",
|
|
97
|
-
"version": "
|
|
97
|
+
"version": "21.0.1-dev.0"
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
100
|
"package": "@rxap/data-structure-tree",
|
|
101
|
-
"version": "1.1.
|
|
101
|
+
"version": "1.1.19-dev.0"
|
|
102
102
|
},
|
|
103
103
|
{
|
|
104
104
|
"package": "@rxap/definition",
|
|
105
|
-
"version": "
|
|
105
|
+
"version": "21.0.1-dev.0"
|
|
106
106
|
},
|
|
107
107
|
{
|
|
108
108
|
"package": "@rxap/environment",
|
|
109
|
-
"version": "
|
|
109
|
+
"version": "21.0.1-dev.0"
|
|
110
110
|
},
|
|
111
111
|
{
|
|
112
112
|
"package": "@rxap/material-directives",
|
|
113
|
-
"version": "
|
|
113
|
+
"version": "21.0.1-dev.0"
|
|
114
114
|
},
|
|
115
115
|
{
|
|
116
116
|
"package": "@rxap/ngx-memory",
|
|
117
|
-
"version": "
|
|
117
|
+
"version": "21.0.1-dev.0"
|
|
118
118
|
},
|
|
119
119
|
{
|
|
120
120
|
"package": "@rxap/ngx-pub-sub",
|
|
121
|
-
"version": "
|
|
121
|
+
"version": "21.0.1-dev.0"
|
|
122
122
|
},
|
|
123
123
|
{
|
|
124
124
|
"package": "@rxap/ngx-theme",
|
|
125
|
-
"version": "
|
|
125
|
+
"version": "21.0.1-dev.0"
|
|
126
126
|
},
|
|
127
127
|
{
|
|
128
128
|
"package": "@rxap/pattern",
|
|
129
|
-
"version": "1.1.
|
|
129
|
+
"version": "1.1.16-dev.0"
|
|
130
130
|
},
|
|
131
131
|
{
|
|
132
132
|
"package": "@rxap/reflect-metadata",
|
|
133
|
-
"version": "1.0.
|
|
133
|
+
"version": "1.0.18-dev.0"
|
|
134
134
|
},
|
|
135
135
|
{
|
|
136
136
|
"package": "@rxap/rxjs",
|
|
137
|
-
"version": "1.1.
|
|
137
|
+
"version": "1.1.18-dev.0"
|
|
138
138
|
},
|
|
139
139
|
{
|
|
140
140
|
"package": "@rxap/utilities",
|
|
141
|
-
"version": "16.5.
|
|
141
|
+
"version": "16.5.2-dev.0"
|
|
142
142
|
}
|
|
143
143
|
]
|
|
144
144
|
},
|
|
@@ -154,15 +154,16 @@
|
|
|
154
154
|
"schematics": "./generators.json",
|
|
155
155
|
"sideEffects": false,
|
|
156
156
|
"module": "fesm2022/rxap-layout.mjs",
|
|
157
|
-
"typings": "
|
|
157
|
+
"typings": "types/rxap-layout.d.ts",
|
|
158
158
|
"exports": {
|
|
159
159
|
"./package.json": {
|
|
160
160
|
"default": "./package.json"
|
|
161
161
|
},
|
|
162
162
|
".": {
|
|
163
|
-
"types": "./
|
|
163
|
+
"types": "./types/rxap-layout.d.ts",
|
|
164
164
|
"default": "./fesm2022/rxap-layout.mjs"
|
|
165
165
|
},
|
|
166
166
|
"./theme": "./theme.css"
|
|
167
|
-
}
|
|
167
|
+
},
|
|
168
|
+
"type": "module"
|
|
168
169
|
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import {
|
|
2
|
+
addDependenciesToPackageJson,
|
|
3
|
+
formatFiles,
|
|
4
|
+
installPackagesTask,
|
|
5
|
+
Tree,
|
|
6
|
+
} from '@nx/devkit';
|
|
7
|
+
import { existsSync, readFileSync } from 'fs';
|
|
8
|
+
import { join } from 'path';
|
|
9
|
+
import { InitGeneratorSchema } from './schema';
|
|
10
|
+
|
|
11
|
+
export async function initGenerator(tree: Tree, options: InitGeneratorSchema) {
|
|
12
|
+
// The package's own package.json lives on disk next to the compiled generator
|
|
13
|
+
// (inside node_modules when installed), which the virtual Tree does not track.
|
|
14
|
+
// Read it directly from the physical filesystem.
|
|
15
|
+
const packageJsonFilePath = join(__dirname, '..', '..', '..', 'package.json');
|
|
16
|
+
if (!existsSync(packageJsonFilePath)) {
|
|
17
|
+
console.error('package.json not found in: ' + packageJsonFilePath);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const { peerDependencies, name: packageName } = JSON.parse(
|
|
21
|
+
readFileSync(packageJsonFilePath, 'utf-8')
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
console.log(`Coerce peer dependencies for package: ${packageName}`);
|
|
25
|
+
if (!peerDependencies || !Object.keys(peerDependencies).length) {
|
|
26
|
+
console.log('No peer dependencies found');
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
console.log(`Peer dependencies: ${Object.keys(peerDependencies).join(', ')}`);
|
|
30
|
+
|
|
31
|
+
const rootPackageJson = JSON.parse(tree.read('package.json', 'utf-8')!);
|
|
32
|
+
|
|
33
|
+
let isDevDependency = !!rootPackageJson.devDependencies?.[packageName];
|
|
34
|
+
|
|
35
|
+
if (
|
|
36
|
+
isDevDependency &&
|
|
37
|
+
[/^@rxap\/ngx/, /^@rxap\/nest/].some((rx) => rx.test(packageName))
|
|
38
|
+
) {
|
|
39
|
+
rootPackageJson.dependencies ??= {};
|
|
40
|
+
rootPackageJson.dependencies[packageName] =
|
|
41
|
+
rootPackageJson.devDependencies[packageName];
|
|
42
|
+
delete rootPackageJson.devDependencies[packageName];
|
|
43
|
+
isDevDependency = false;
|
|
44
|
+
tree.write('package.json', JSON.stringify(rootPackageJson, null, 2));
|
|
45
|
+
}
|
|
46
|
+
if (
|
|
47
|
+
!isDevDependency &&
|
|
48
|
+
[
|
|
49
|
+
/^@rxap\/plugin/,
|
|
50
|
+
/^@rxap\/workspace/,
|
|
51
|
+
/@rxap\/schematic/,
|
|
52
|
+
].some((rx) => rx.test(packageName))
|
|
53
|
+
) {
|
|
54
|
+
rootPackageJson.devDependencies ??= {};
|
|
55
|
+
rootPackageJson.devDependencies[packageName] =
|
|
56
|
+
rootPackageJson.dependencies[packageName];
|
|
57
|
+
delete rootPackageJson.dependencies[packageName];
|
|
58
|
+
isDevDependency = true;
|
|
59
|
+
tree.write('package.json', JSON.stringify(rootPackageJson, null, 2));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const missingPeerDependencies = Object.entries(peerDependencies)
|
|
63
|
+
.filter(
|
|
64
|
+
([dep]) =>
|
|
65
|
+
!rootPackageJson.dependencies?.[dep] &&
|
|
66
|
+
!rootPackageJson.devDependencies?.[dep]
|
|
67
|
+
)
|
|
68
|
+
.reduce((acc, [dep, version]) => ({ ...acc, [dep]: version }), {});
|
|
69
|
+
|
|
70
|
+
if (!Object.keys(missingPeerDependencies).length) {
|
|
71
|
+
console.log('No missing peer dependencies');
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (isDevDependency) {
|
|
76
|
+
addDependenciesToPackageJson(tree, {}, missingPeerDependencies);
|
|
77
|
+
} else {
|
|
78
|
+
addDependenciesToPackageJson(tree, missingPeerDependencies, {});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
await formatFiles(tree);
|
|
82
|
+
|
|
83
|
+
installPackagesTask(tree);
|
|
84
|
+
|
|
85
|
+
for (const peer of Object.keys(missingPeerDependencies)) {
|
|
86
|
+
console.log(`Peer dependency ${peer} added to package.json`);
|
|
87
|
+
// node_modules is physical and excluded from the virtual Tree, so resolve
|
|
88
|
+
// peer files from disk relative to the workspace root.
|
|
89
|
+
const peerPackageDir = join(tree.root, 'node_modules', ...peer.split('/'));
|
|
90
|
+
const peerPackageJsonFilePath = join(peerPackageDir, 'package.json');
|
|
91
|
+
if (!existsSync(peerPackageJsonFilePath)) {
|
|
92
|
+
console.log(`Peer dependency ${peer} has no package.json`);
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
const { generators, schematics } = JSON.parse(
|
|
96
|
+
readFileSync(peerPackageJsonFilePath, 'utf-8')
|
|
97
|
+
);
|
|
98
|
+
if (!generators && !schematics) {
|
|
99
|
+
console.log(`Peer dependency ${peer} has no generators or schematics`);
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
const configFile = generators || schematics;
|
|
103
|
+
const configFilePath = join(peerPackageDir, configFile);
|
|
104
|
+
if (!existsSync(configFilePath)) {
|
|
105
|
+
console.log(
|
|
106
|
+
`Peer dependency ${peer} has no generators or schematics file`
|
|
107
|
+
);
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
const config = JSON.parse(readFileSync(configFilePath, 'utf-8'));
|
|
111
|
+
if (!config.generators?.init) {
|
|
112
|
+
console.log(`Peer dependency ${peer} has no init generator`);
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
const initGeneratorFilePath = config.generators.init.factory;
|
|
116
|
+
const fullInitGeneratorFilePath =
|
|
117
|
+
join(peerPackageDir, initGeneratorFilePath) + '.js';
|
|
118
|
+
if (!existsSync(fullInitGeneratorFilePath)) {
|
|
119
|
+
console.log(
|
|
120
|
+
`Peer dependency ${peer} has no init generator file: ` +
|
|
121
|
+
fullInitGeneratorFilePath
|
|
122
|
+
);
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
126
|
+
const initGenerator = require(join(
|
|
127
|
+
peerPackageDir,
|
|
128
|
+
initGeneratorFilePath
|
|
129
|
+
))?.default;
|
|
130
|
+
if (typeof initGenerator !== 'function') {
|
|
131
|
+
console.log(`Peer dependency ${peer} has no init generator function`);
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
console.log(`Run init generator for peer dependency ${peer}`);
|
|
135
|
+
await initGenerator(tree, options);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export default initGenerator;
|
|
@@ -1,24 +1,70 @@
|
|
|
1
|
+
// region sidenav
|
|
1
2
|
export * from './lib/sidenav/sidenav-footer.directive';
|
|
2
3
|
export * from './lib/sidenav/sidenav-header.directive';
|
|
3
4
|
export * from './lib/sidenav/sidenav.component';
|
|
5
|
+
// endregion
|
|
6
|
+
|
|
7
|
+
// region release-info
|
|
4
8
|
export * from './lib/release-info/release-info.component';
|
|
9
|
+
// endregion
|
|
10
|
+
|
|
11
|
+
// region navigation navigation-item
|
|
5
12
|
export * from './lib/navigation/navigation-item/navigation-item.component';
|
|
13
|
+
// endregion
|
|
14
|
+
|
|
15
|
+
// region navigation-progress-bar
|
|
6
16
|
export * from './lib/navigation-progress-bar/navigation-progress-bar.component';
|
|
17
|
+
// endregion
|
|
18
|
+
|
|
19
|
+
// region navigation
|
|
7
20
|
export * from './lib/navigation/navigation-item';
|
|
8
21
|
export * from './lib/navigation/navigation.component';
|
|
22
|
+
// endregion
|
|
23
|
+
|
|
24
|
+
// region minimal-layout
|
|
9
25
|
export * from './lib/minimal-layout/minimal-layout.component';
|
|
26
|
+
// endregion
|
|
27
|
+
|
|
28
|
+
// region layout
|
|
10
29
|
export * from './lib/layout/layout.component';
|
|
30
|
+
// endregion
|
|
31
|
+
|
|
32
|
+
// region header
|
|
11
33
|
export * from './lib/header/header.component';
|
|
12
34
|
export * from './lib/header/header.directive';
|
|
35
|
+
// endregion
|
|
36
|
+
|
|
37
|
+
// region footer
|
|
13
38
|
export * from './lib/footer/footer.component';
|
|
14
39
|
export * from './lib/footer/footer.directive';
|
|
40
|
+
// endregion
|
|
41
|
+
|
|
42
|
+
// region default-header user-profile-icon
|
|
15
43
|
export * from './lib/default-header/user-profile-icon/user-profile-icon.component';
|
|
44
|
+
// endregion
|
|
45
|
+
|
|
46
|
+
// region default-header sidenav-toggle-button
|
|
16
47
|
export * from './lib/default-header/sidenav-toggle-button/sidenav-toggle-button.component';
|
|
48
|
+
// endregion
|
|
49
|
+
|
|
50
|
+
// region default-header settings-button
|
|
17
51
|
export * from './lib/default-header/settings-button/settings-button.component';
|
|
52
|
+
// endregion
|
|
53
|
+
|
|
54
|
+
// region default-header apps-button
|
|
18
55
|
export * from './lib/default-header/apps-button/apps-button.component';
|
|
56
|
+
// endregion
|
|
57
|
+
|
|
58
|
+
// region default-header
|
|
19
59
|
export * from './lib/default-header/default-header.component';
|
|
20
60
|
export * from './lib/default-header/default-header.service';
|
|
61
|
+
// endregion
|
|
62
|
+
|
|
63
|
+
// region base-layout
|
|
21
64
|
export * from './lib/base-layout/base-layout.component';
|
|
65
|
+
// endregion
|
|
66
|
+
|
|
67
|
+
// region
|
|
22
68
|
export * from './lib/external-apps.service';
|
|
23
69
|
export * from './lib/footer.service';
|
|
24
70
|
export * from './lib/header.service';
|
|
@@ -28,3 +74,4 @@ export * from './lib/navigation.service';
|
|
|
28
74
|
export * from './lib/provide';
|
|
29
75
|
export * from './lib/tokens';
|
|
30
76
|
export * from './lib/types';
|
|
77
|
+
// endregion
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
|
2
|
+
import {
|
|
3
|
+
addProjectConfiguration,
|
|
4
|
+
Tree,
|
|
5
|
+
} from '@nx/devkit';
|
|
6
|
+
|
|
7
|
+
import update from './add-seperate-external-apps-provider';
|
|
8
|
+
|
|
9
|
+
describe('add-seperate-external-apps-provider migration', () => {
|
|
10
|
+
let tree: Tree;
|
|
11
|
+
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
|
14
|
+
addProjectConfiguration(tree, 'service', {
|
|
15
|
+
root: 'apps/service',
|
|
16
|
+
projectType: 'application',
|
|
17
|
+
sourceRoot: 'apps/service/src',
|
|
18
|
+
tags: [ 'service' ],
|
|
19
|
+
targets: {},
|
|
20
|
+
});
|
|
21
|
+
addProjectConfiguration(tree, 'angularA', {
|
|
22
|
+
root: 'apps/angularA',
|
|
23
|
+
projectType: 'application',
|
|
24
|
+
sourceRoot: 'apps/angularA/src',
|
|
25
|
+
tags: [ 'angular' ],
|
|
26
|
+
targets: {},
|
|
27
|
+
});
|
|
28
|
+
addProjectConfiguration(tree, 'angularB', {
|
|
29
|
+
root: 'apps/angularB',
|
|
30
|
+
projectType: 'application',
|
|
31
|
+
sourceRoot: 'apps/angularB/src',
|
|
32
|
+
tags: [ 'angular' ],
|
|
33
|
+
targets: {},
|
|
34
|
+
});
|
|
35
|
+
tree.write('apps/angularB/src/app/layout.routes.ts', '');
|
|
36
|
+
addProjectConfiguration(tree, 'angularC', {
|
|
37
|
+
root: 'apps/angularC',
|
|
38
|
+
projectType: 'application',
|
|
39
|
+
sourceRoot: 'apps/angularC/src',
|
|
40
|
+
tags: [ 'angular' ],
|
|
41
|
+
targets: {},
|
|
42
|
+
});
|
|
43
|
+
tree.write('apps/angularC/src/app/layout.routes.ts', '');
|
|
44
|
+
tree.write('apps/angularC/src/app/app.config.ts', '');
|
|
45
|
+
addProjectConfiguration(tree, 'angularD', {
|
|
46
|
+
root: 'apps/angularD',
|
|
47
|
+
projectType: 'application',
|
|
48
|
+
sourceRoot: 'apps/angularD/src',
|
|
49
|
+
tags: [ 'angular' ],
|
|
50
|
+
targets: {},
|
|
51
|
+
});
|
|
52
|
+
tree.write('apps/angularD/src/app/layout.routes.ts', '');
|
|
53
|
+
tree.write('apps/angularD/src/app/app.config.ts', 'export const appConfig = { providers: [] };');
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('should run successfully', async () => {
|
|
57
|
+
await update(tree);
|
|
58
|
+
expect(tree.read('apps/angularA/src/app/app.config.ts', 'utf-8')).toMatchSnapshot();
|
|
59
|
+
expect(tree.read('apps/angularB/src/app/app.config.ts', 'utf-8')).toMatchSnapshot();
|
|
60
|
+
expect(tree.read('apps/angularC/src/app/app.config.ts', 'utf-8')).toMatchSnapshot();
|
|
61
|
+
expect(tree.read('apps/angularD/src/app/app.config.ts', 'utf-8')).toMatchSnapshot();
|
|
62
|
+
});
|
|
63
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
import {
|
|
3
|
+
getProjects,
|
|
4
|
+
Tree,
|
|
5
|
+
} from '@nx/devkit';
|
|
6
|
+
import {
|
|
7
|
+
CoerceAppConfigProvider,
|
|
8
|
+
CoerceImports,
|
|
9
|
+
} from '@rxap/ts-morph';
|
|
10
|
+
import { TsMorphAngularProjectTransform } from '@rxap/workspace-ts-morph';
|
|
11
|
+
import {
|
|
12
|
+
GetProjectSourceRoot,
|
|
13
|
+
IsAngularProject,
|
|
14
|
+
IsApplicationProject,
|
|
15
|
+
} from '@rxap/workspace-utilities';
|
|
16
|
+
import { join } from 'path';
|
|
17
|
+
|
|
18
|
+
export default async function update(tree: Tree) {
|
|
19
|
+
// ...
|
|
20
|
+
|
|
21
|
+
console.log('Add separate external apps provider to app config');
|
|
22
|
+
|
|
23
|
+
for (const [projectName, project] of getProjects(tree).entries()) {
|
|
24
|
+
|
|
25
|
+
// skip all projects that are not angular application projects
|
|
26
|
+
if (!(IsAngularProject(project) && IsApplicationProject(project))) {
|
|
27
|
+
console.log(`The project ${projectName} is not an angular application project. Skip the migration!`);
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const projectSourceRoot = GetProjectSourceRoot(tree, projectName);
|
|
32
|
+
|
|
33
|
+
const layoutRoutesFilePath = join(projectSourceRoot, 'app', 'layout.routes.ts');
|
|
34
|
+
|
|
35
|
+
if (!tree.exists(join(layoutRoutesFilePath))) {
|
|
36
|
+
console.log(`The project ${projectName} does not have a layout.routes.ts file. Skip the migration!`);
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const appConfigFilePath = join(projectSourceRoot, 'app', 'app.config.ts');
|
|
41
|
+
|
|
42
|
+
if (!tree.exists(join(appConfigFilePath))) {
|
|
43
|
+
console.log(`The project ${projectName} does not have a app.config.ts file. Skip the migration!`);
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
await TsMorphAngularProjectTransform(tree, { project: projectName }, (_, [appConfig]) => {
|
|
48
|
+
CoerceAppConfigProvider(appConfig, {
|
|
49
|
+
providers: ['provideExternalApps()']
|
|
50
|
+
});
|
|
51
|
+
CoerceImports(appConfig, {
|
|
52
|
+
moduleSpecifier: '@rxap/layout',
|
|
53
|
+
namedImports: ['provideExternalApps']
|
|
54
|
+
});
|
|
55
|
+
}, [ join('app', 'app.config.ts') ]);
|
|
56
|
+
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
|
2
|
+
import {
|
|
3
|
+
addProjectConfiguration,
|
|
4
|
+
Tree,
|
|
5
|
+
} from '@nx/devkit';
|
|
6
|
+
|
|
7
|
+
import update from './add-theme-provider-to-app-config';
|
|
8
|
+
|
|
9
|
+
describe('add-theme-provider-to-app-config migration', () => {
|
|
10
|
+
let tree: Tree;
|
|
11
|
+
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
tree = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
|
14
|
+
addProjectConfiguration(tree, 'service', {
|
|
15
|
+
root: 'apps/service',
|
|
16
|
+
projectType: 'application',
|
|
17
|
+
sourceRoot: 'apps/service/src',
|
|
18
|
+
tags: [ 'service' ],
|
|
19
|
+
targets: {},
|
|
20
|
+
});
|
|
21
|
+
addProjectConfiguration(tree, 'angularA', {
|
|
22
|
+
root: 'apps/angularA',
|
|
23
|
+
projectType: 'application',
|
|
24
|
+
sourceRoot: 'apps/angularA/src',
|
|
25
|
+
tags: [ 'angular' ],
|
|
26
|
+
targets: {},
|
|
27
|
+
});
|
|
28
|
+
addProjectConfiguration(tree, 'angularB', {
|
|
29
|
+
root: 'apps/angularB',
|
|
30
|
+
projectType: 'application',
|
|
31
|
+
sourceRoot: 'apps/angularB/src',
|
|
32
|
+
tags: [ 'angular' ],
|
|
33
|
+
targets: {},
|
|
34
|
+
});
|
|
35
|
+
tree.write('apps/angularB/src/app/layout.routes.ts', '');
|
|
36
|
+
addProjectConfiguration(tree, 'angularC', {
|
|
37
|
+
root: 'apps/angularC',
|
|
38
|
+
projectType: 'application',
|
|
39
|
+
sourceRoot: 'apps/angularC/src',
|
|
40
|
+
tags: [ 'angular' ],
|
|
41
|
+
targets: {},
|
|
42
|
+
});
|
|
43
|
+
tree.write('apps/angularC/src/app/layout.routes.ts', '');
|
|
44
|
+
tree.write('apps/angularC/src/app/app.config.ts', '');
|
|
45
|
+
addProjectConfiguration(tree, 'angularD', {
|
|
46
|
+
root: 'apps/angularD',
|
|
47
|
+
projectType: 'application',
|
|
48
|
+
sourceRoot: 'apps/angularD/src',
|
|
49
|
+
tags: [ 'angular' ],
|
|
50
|
+
targets: {},
|
|
51
|
+
});
|
|
52
|
+
tree.write('apps/angularD/src/app/layout.routes.ts', '');
|
|
53
|
+
tree.write('apps/angularD/src/app/app.config.ts', 'export const appConfig = { providers: [] };');
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('should run successfully', async () => {
|
|
57
|
+
await update(tree);
|
|
58
|
+
expect(tree.read('apps/angularC/src/app/app.config.ts', 'utf-8')).toMatchSnapshot();
|
|
59
|
+
expect(tree.read('apps/angularD/src/app/app.config.ts', 'utf-8')).toMatchSnapshot();
|
|
60
|
+
});
|
|
61
|
+
});
|
package/src/migrations/18.0.0/add-theme-provider-to-app-config/add-theme-provider-to-app-config.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
import {
|
|
3
|
+
getProjects,
|
|
4
|
+
Tree,
|
|
5
|
+
} from '@nx/devkit';
|
|
6
|
+
import {
|
|
7
|
+
CoerceAppConfigProvider,
|
|
8
|
+
CoerceImports,
|
|
9
|
+
} from '@rxap/ts-morph';
|
|
10
|
+
import { TsMorphAngularProjectTransform } from '@rxap/workspace-ts-morph';
|
|
11
|
+
import {
|
|
12
|
+
GetProjectSourceRoot,
|
|
13
|
+
IsAngularProject,
|
|
14
|
+
IsApplicationProject,
|
|
15
|
+
} from '@rxap/workspace-utilities';
|
|
16
|
+
|
|
17
|
+
export default async function update(host: Tree) {
|
|
18
|
+
for (const [ projectName, project ] of getProjects(host)) {
|
|
19
|
+
if (!IsApplicationProject(project) || !IsAngularProject(project)) {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
const projectSourceRoot = GetProjectSourceRoot(host, projectName);
|
|
23
|
+
const layoutRoutesPath = `${ projectSourceRoot }/app/layout.routes.ts`;
|
|
24
|
+
if (!host.exists(layoutRoutesPath)) {
|
|
25
|
+
console.log(`The project ${ projectName } does not have a layout.routes.ts file. Skip Migration`);
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
if (!host.exists(`${ projectSourceRoot }/app/app.config.ts`)) {
|
|
29
|
+
console.log(`The project ${ projectName } does not have a app.config.ts file. Skip Migration`);
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
await TsMorphAngularProjectTransform(host, {
|
|
33
|
+
project: projectName,
|
|
34
|
+
}, (_, [ sourceFile ]) => {
|
|
35
|
+
CoerceAppConfigProvider(sourceFile, {
|
|
36
|
+
providers: [ 'provideTheme()' ],
|
|
37
|
+
});
|
|
38
|
+
CoerceImports(sourceFile, {
|
|
39
|
+
moduleSpecifier: '@rxap/ngx-theme',
|
|
40
|
+
namedImports: [ 'provideTheme' ],
|
|
41
|
+
});
|
|
42
|
+
}, [ '/app/app.config.ts' ]);
|
|
43
|
+
}
|
|
44
|
+
}
|