feat(translatr): convert root bootstrap to standalone (bootstrapApplication) - #358
Merged
Merged
Conversation
Fourth and final layer of the apps/translatr standalone migration: AppModule/AppComponent/main.ts root bootstrap plus SidenavComponent/ SidenavModule, converting to bootstrapApplication with native NgRx/ Router provider functions. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Convert SidenavComponent to standalone: true. Delete sidenav.module.ts, updating its 8 consumers to import SidenavComponent directly. Convert SidenavTestingModule's MockSidenavComponent to standalone, renamed to mock-sidenav.component.ts, deleting the wrapper module. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Convert AppComponent to standalone: true. Delete app.module.ts and rewrite main.ts to bootstrapApplication with native NgRx/Router provider functions (provideRouter, provideStore, provideEffects, provideRouterStore, provideStoreDevtools, provideAnimations, provideHttpClient) replacing StoreModule.forRoot/EffectsModule.forRoot/ StoreRouterConnectingModule.forRoot/StoreDevtoolsModule.instrument/ RouterModule.forRoot/BrowserAnimationsModule. TranslocoRootModule and TranslatrSdkModule stay as NgModules, pulled in via importProvidersFrom. app-routing.module.ts now exports its Routes array directly instead of wrapping it in an NgModule. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ideEffects provideStore()/provideEffects() (the functional forms) don't provide the StoreRootModule/EffectsRootModule marker tokens that StoreModule.forFeature()/EffectsModule.forFeature() - used throughout every lazy page module, unchanged here - inject in their factories. Mixing them with the functional root providers threw NG0201 on every lazy route, caught by a full e2e run (unit tests mock facades and never exercise this wiring). Root store/effects registration goes back to importProvidersFrom( StoreModule.forRoot(...)) / importProvidersFrom(EffectsModule.forRoot(...)). provideRouterStore and provideStoreDevtools have no forFeature counterpart elsewhere in the app and stay as their native functional forms. Full local e2e suite: 187/187 passing. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
All groups done: SidenavComponent conversion, AppComponent standalone, bootstrapApplication root bootstrap rewrite, and final verification (159/159 unit tests, clean build, 187/187 e2e). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
apps/translatrstandalone migration (afterlibs/translatr-componentsMigrate translatr-components to standalone components #352,apps/translatr/src/app/modules/sharedMigrate translatr shared modules to standalone components #355,apps/translatr/src/app/modules/pagesfeat(translatr): convert pages layer to standalone components #356).SidenavComponenttostandalone: true, deletingsidenav.module.tsand updating its 8 consumers to import the component directly. ConvertsSidenavTestingModule's mock the same way.AppComponenttostandalone: true(its own template is only<router-outlet>— every other import on the oldAppModulewas vestigial for it specifically, sinceAppModuleonly ever declaredAppComponent).app.module.tsand rewritesmain.tsto callbootstrapApplication(AppComponent, { providers: [...] }), using native NgRx/Router provider functions (provideRouter,provideRouterStore,provideStoreDevtools,provideAnimations,provideHttpClient) plusimportProvidersFrom(StoreModule.forRoot(...))/importProvidersFrom(EffectsModule.forRoot(...))for the root store/effects — kept as the NgModule form deliberately, since every lazy page module still registers its feature state viaStoreModule.forFeature()/EffectsModule.forFeature()(unchanged, out of scope here), and those require theStoreRootModule/EffectsRootModulemarker only the NgModuleforRoot()provides.TranslocoRootModuleandTranslatrSdkModulestay as NgModules, pulled in viaimportProvidersFrom.app-routing.module.tsnow exports itsRoutesarray directly instead of wrapping it in anNgModule.Test plan
nx test translatr— 159/159 passingnx build translatr— clean buildtsc -p apps/translatr/tsconfig.app.json --noEmit— cleanprovideStore()/provideEffects()don't provide the marker tokensStoreModule.forFeature()/EffectsModule.forFeature()need, breaking every lazy route withNG0201— fixed by keeping root store/effects registration on the NgModule form viaimportProvidersFrom)/loginroute render with zero console errors beyond expected unauthenticated 401s🤖 Generated with Claude Code