@rxap/layout 19.2.6 → 21.0.1-dev.1
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 +55 -0
- package/compodoc/changelog.html +53 -0
- package/compodoc/components/AppsButtonComponent.html +26 -15
- package/compodoc/components/LayoutComponent.html +23 -31
- package/compodoc/components/NavigationComponent.html +46 -89
- package/compodoc/components/NavigationItemComponent.html +98 -214
- package/compodoc/components/SettingsButtonComponent.html +46 -46
- package/compodoc/components/SidenavComponent.html +43 -44
- package/compodoc/components/SidenavToggleButtonComponent.html +15 -5
- package/compodoc/dependencies.html +20 -20
- package/compodoc/directives/SidenavFooterDirective.html +4 -74
- package/compodoc/directives/SidenavHeaderDirective.html +4 -74
- package/compodoc/injectables/LayoutService.html +24 -67
- package/compodoc/injectables/NavigationService.html +20 -72
- package/compodoc/js/search/search_index.js +2 -2
- package/compodoc/properties.html +1 -1
- package/docs/documentation.json +1916 -2607
- package/docs/html/assets/search.js +1 -1
- package/docs/html/classes/AppsButtonComponent.html +4 -10
- 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 +2 -9
- package/docs/html/classes/NavigationItemComponent.html +3 -19
- 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 +9 -33
- 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 +18 -24
- package/docs/markdown/classes/LogoService.md +6 -6
- package/docs/markdown/classes/MinimalLayoutComponent.md +2 -2
- package/docs/markdown/classes/NavigationComponent.md +16 -50
- package/docs/markdown/classes/NavigationItemComponent.md +19 -117
- package/docs/markdown/classes/NavigationProgressBarComponent.md +4 -4
- package/docs/markdown/classes/NavigationService.md +16 -26
- 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 -12
- package/docs/markdown/classes/SidenavHeaderDirective.md +4 -12
- 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 +8 -32
- 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 +17 -23
- package/docs/wiki/Class.LogoService.md +5 -5
- package/docs/wiki/Class.MinimalLayoutComponent.md +1 -1
- package/docs/wiki/Class.NavigationComponent.md +15 -49
- package/docs/wiki/Class.NavigationItemComponent.md +18 -116
- package/docs/wiki/Class.NavigationProgressBarComponent.md +3 -3
- package/docs/wiki/Class.NavigationService.md +15 -25
- 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 -11
- package/docs/wiki/Class.SidenavHeaderDirective.md +3 -11
- 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 +219 -294
- package/fesm2022/rxap-layout.mjs.map +1 -1
- package/package.json +47 -46
- package/src/generators/init/generator.spec.ts +228 -0
- 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 +507 -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
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
|
2
|
+
import {
|
|
3
|
+
addProjectConfiguration,
|
|
4
|
+
Tree,
|
|
5
|
+
} from '@nx/devkit';
|
|
6
|
+
import update from './add-user-theme-provider-to-layout-providers';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
describe('add-user-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', `export const ROUTES: Route[] = [
|
|
36
|
+
{
|
|
37
|
+
path: '',
|
|
38
|
+
component: LayoutComponent,
|
|
39
|
+
children: [],
|
|
40
|
+
providers: []
|
|
41
|
+
}
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
export default ROUTES;`);
|
|
45
|
+
addProjectConfiguration(tree, 'angularC', {
|
|
46
|
+
root: 'apps/angularC',
|
|
47
|
+
projectType: 'application',
|
|
48
|
+
sourceRoot: 'apps/angularC/src',
|
|
49
|
+
tags: [ 'angular' ],
|
|
50
|
+
targets: {},
|
|
51
|
+
});
|
|
52
|
+
tree.write('apps/angularC/src/app/layout.routes.ts', `export const ROUTES: Route[] = [
|
|
53
|
+
{
|
|
54
|
+
path: '',
|
|
55
|
+
component: LayoutComponent,
|
|
56
|
+
children: [],
|
|
57
|
+
providers: [
|
|
58
|
+
provideLayout()
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
export default ROUTES;`);
|
|
64
|
+
addProjectConfiguration(tree, 'angularD', {
|
|
65
|
+
root: 'apps/angularD',
|
|
66
|
+
projectType: 'application',
|
|
67
|
+
sourceRoot: 'apps/angularD/src',
|
|
68
|
+
tags: [ 'angular' ],
|
|
69
|
+
targets: {},
|
|
70
|
+
});
|
|
71
|
+
tree.write('apps/angularD/src/app/layout.routes.ts', `export const ROUTES: Route[] = [
|
|
72
|
+
{
|
|
73
|
+
path: '',
|
|
74
|
+
component: LayoutComponent,
|
|
75
|
+
children: [],
|
|
76
|
+
providers: [
|
|
77
|
+
provideLayout(
|
|
78
|
+
withNavigationConfig(APP_NAVIGATION),
|
|
79
|
+
withDefaultHeaderComponent()
|
|
80
|
+
)
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
];
|
|
84
|
+
|
|
85
|
+
export default ROUTES;`);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('should run successfully', async () => {
|
|
89
|
+
await update(tree);
|
|
90
|
+
expect(tree.read('apps/angularB/src/app/layout.routes.ts', 'utf-8')).toMatchSnapshot();
|
|
91
|
+
expect(tree.read('apps/angularC/src/app/layout.routes.ts', 'utf-8')).toMatchSnapshot();
|
|
92
|
+
expect(tree.read('apps/angularD/src/app/layout.routes.ts', 'utf-8')).toMatchSnapshot();
|
|
93
|
+
});
|
|
94
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getProjects,
|
|
3
|
+
Tree,
|
|
4
|
+
} from '@nx/devkit';
|
|
5
|
+
import {
|
|
6
|
+
CoerceAppConfigProvider,
|
|
7
|
+
CoerceImports,
|
|
8
|
+
} from '@rxap/ts-morph';
|
|
9
|
+
import { TsMorphAngularProjectTransform } from '@rxap/workspace-ts-morph';
|
|
10
|
+
import {
|
|
11
|
+
GetProjectSourceRoot,
|
|
12
|
+
IsAngularProject,
|
|
13
|
+
IsApplicationProject,
|
|
14
|
+
} from '@rxap/workspace-utilities';
|
|
15
|
+
|
|
16
|
+
export default async function update(host: Tree) {
|
|
17
|
+
|
|
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
|
+
let content = host.read(layoutRoutesPath, 'utf-8');
|
|
29
|
+
if (!content?.includes('provideLayout(')) {
|
|
30
|
+
console.log(`The project ${ projectName } does not have the provideLayout provider. Skip Migration`);
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (content.includes('provideUserTheme(')) {
|
|
34
|
+
console.log(`The project ${ projectName } already has the provideUserTheme provider. Skip Migration`);
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
content = content.replace('provideLayout(', 'provideUserTheme(), provideLayout(');
|
|
38
|
+
host.write(layoutRoutesPath, content);
|
|
39
|
+
await TsMorphAngularProjectTransform(host, {
|
|
40
|
+
project: projectName,
|
|
41
|
+
}, (_, [ sourceFile ]) => {
|
|
42
|
+
CoerceImports(sourceFile, [
|
|
43
|
+
{
|
|
44
|
+
moduleSpecifier: '@rxap/ngx-user',
|
|
45
|
+
namedImports: [ 'provideUserTheme' ],
|
|
46
|
+
},
|
|
47
|
+
]);
|
|
48
|
+
}, [ '/app/layout.routes.ts' ]);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
}
|
package/src/migrations/18.0.0/add-with-user-profile-provider/add-with-user-profile-provider.spec.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
|
|
2
|
+
import {
|
|
3
|
+
addProjectConfiguration,
|
|
4
|
+
Tree,
|
|
5
|
+
} from '@nx/devkit';
|
|
6
|
+
|
|
7
|
+
import update from './add-with-user-profile-provider';
|
|
8
|
+
|
|
9
|
+
describe('add-with-user-profile-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', `export const ROUTES: Route[] = [
|
|
36
|
+
{
|
|
37
|
+
path: '',
|
|
38
|
+
component: LayoutComponent,
|
|
39
|
+
children: [],
|
|
40
|
+
providers: []
|
|
41
|
+
}
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
export default ROUTES;`);
|
|
45
|
+
addProjectConfiguration(tree, 'angularC', {
|
|
46
|
+
root: 'apps/angularC',
|
|
47
|
+
projectType: 'application',
|
|
48
|
+
sourceRoot: 'apps/angularC/src',
|
|
49
|
+
tags: [ 'angular' ],
|
|
50
|
+
targets: {},
|
|
51
|
+
});
|
|
52
|
+
tree.write('apps/angularC/src/app/layout.routes.ts', `export const ROUTES: Route[] = [
|
|
53
|
+
{
|
|
54
|
+
path: '',
|
|
55
|
+
component: LayoutComponent,
|
|
56
|
+
children: [],
|
|
57
|
+
providers: [
|
|
58
|
+
provideLayout()
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
export default ROUTES;`);
|
|
64
|
+
addProjectConfiguration(tree, 'angularD', {
|
|
65
|
+
root: 'apps/angularD',
|
|
66
|
+
projectType: 'application',
|
|
67
|
+
sourceRoot: 'apps/angularD/src',
|
|
68
|
+
tags: [ 'angular' ],
|
|
69
|
+
targets: {},
|
|
70
|
+
});
|
|
71
|
+
tree.write('apps/angularD/src/app/layout.routes.ts', `export const ROUTES: Route[] = [
|
|
72
|
+
{
|
|
73
|
+
path: '',
|
|
74
|
+
component: LayoutComponent,
|
|
75
|
+
children: [],
|
|
76
|
+
providers: [
|
|
77
|
+
provideLayout(
|
|
78
|
+
withNavigationConfig(APP_NAVIGATION),
|
|
79
|
+
withDefaultHeaderComponent()
|
|
80
|
+
)
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
];
|
|
84
|
+
|
|
85
|
+
export default ROUTES;`);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('should run successfully', async () => {
|
|
89
|
+
await update(tree);
|
|
90
|
+
expect(tree.read('apps/angularB/src/app/layout.routes.ts', 'utf-8')).toMatchSnapshot();
|
|
91
|
+
expect(tree.read('apps/angularC/src/app/layout.routes.ts', 'utf-8')).toMatchSnapshot();
|
|
92
|
+
expect(tree.read('apps/angularD/src/app/layout.routes.ts', 'utf-8')).toMatchSnapshot();
|
|
93
|
+
});
|
|
94
|
+
});
|
package/src/migrations/18.0.0/add-with-user-profile-provider/add-with-user-profile-provider.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
import {
|
|
3
|
+
getProjects,
|
|
4
|
+
Tree,
|
|
5
|
+
} from '@nx/devkit';
|
|
6
|
+
import { CoerceImports } from '@rxap/ts-morph';
|
|
7
|
+
import { TsMorphAngularProjectTransform } from '@rxap/workspace-ts-morph';
|
|
8
|
+
import {
|
|
9
|
+
GetProjectSourceRoot,
|
|
10
|
+
IsAngularProject,
|
|
11
|
+
IsApplicationProject,
|
|
12
|
+
} from '@rxap/workspace-utilities';
|
|
13
|
+
|
|
14
|
+
export default async function update(host: Tree) {
|
|
15
|
+
|
|
16
|
+
for (const [ projectName, project ] of getProjects(host)) {
|
|
17
|
+
if (!IsApplicationProject(project) || !IsAngularProject(project)) {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
const projectSourceRoot = GetProjectSourceRoot(host, projectName);
|
|
21
|
+
const layoutRoutesPath = `${ projectSourceRoot }/app/layout.routes.ts`;
|
|
22
|
+
if (!host.exists(layoutRoutesPath)) {
|
|
23
|
+
console.log(`The project ${ projectName } does not have a layout.routes.ts file. Skip Migration`);
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
let content = host.read(layoutRoutesPath, 'utf-8');
|
|
27
|
+
if (!content?.includes('provideLayout(')) {
|
|
28
|
+
console.log(`The project ${ projectName } does not have the provideLayout provider. Skip Migration`);
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
if (content.includes('withUserProfileDataSource(')) {
|
|
32
|
+
console.log(`The project ${ projectName } already has the withUserProfileDataSource provider. Skip Migration`);
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
content = content.replace('provideLayout(', 'provideLayout(withUserProfileDataSource(UserProfileDataSource),');
|
|
36
|
+
host.write(layoutRoutesPath, content);
|
|
37
|
+
await TsMorphAngularProjectTransform(host, {
|
|
38
|
+
project: projectName,
|
|
39
|
+
}, (_, [ sourceFile ]) => {
|
|
40
|
+
CoerceImports(sourceFile, [
|
|
41
|
+
{
|
|
42
|
+
moduleSpecifier: '@rxap/ngx-user',
|
|
43
|
+
namedImports: [ 'UserProfileDataSource' ],
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
moduleSpecifier: '@rxap/layout',
|
|
47
|
+
namedImports: [ 'withUserProfileDataSource' ],
|
|
48
|
+
},
|
|
49
|
+
]);
|
|
50
|
+
}, [ '/app/layout.routes.ts' ]);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment
|
|
2
|
+
globalThis.ngJest = {
|
|
3
|
+
testEnvironmentOptions: {
|
|
4
|
+
errorOnUnknownElements: true,
|
|
5
|
+
errorOnUnknownProperties: true,
|
|
6
|
+
},
|
|
7
|
+
};
|
|
8
|
+
import { setupZoneTestEnv } from 'jest-preset-angular/setup-env/zone';
|
|
9
|
+
|
|
10
|
+
setupZoneTestEnv();
|
|
11
|
+
import { TextDecoder, TextEncoder } from 'util';
|
|
12
|
+
global.TextEncoder ??= TextEncoder as any;
|
|
13
|
+
global.TextDecoder ??= TextDecoder as any;
|
|
14
|
+
|
|
15
|
+
import '@angular/localize/init';
|
|
16
|
+
jest.spyOn(global as any, '$localize').mockImplementation((...args: any[]) => {
|
|
17
|
+
// This template tag function just returns the first argument with no transformations.
|
|
18
|
+
// Change this to fit your unit test needs.
|
|
19
|
+
return args[0];
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
jest.mock('prettier', () => ({
|
|
23
|
+
format: (str: string) => str,
|
|
24
|
+
resolveConfig: () => Promise.resolve({}),
|
|
25
|
+
}));
|