Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schematics Core: Add ability to add providers to bootstrapApplication function #3536

Closed
2 tasks
brandonroberts opened this issue Aug 16, 2022 · 10 comments · Fixed by #3874
Closed
2 tasks

Schematics Core: Add ability to add providers to bootstrapApplication function #3536

brandonroberts opened this issue Aug 16, 2022 · 10 comments · Fixed by #3874
Assignees
Labels
Accepting PRs community watch Someone from the community is working this issue/PR enhancement Project: Schematics

Comments

@brandonroberts
Copy link
Member

Information

Support adding providers to the bootstrapApplication function in preparation for NgRx APIs for Angular apps using standalone components for bootstrapping.

This will be added to the ng-add schematic for each library with a --standalone flag

Before:

bootstrapApplication(AppComponent)

After

bootstrapApplication (AppComponent, {
  providers: [
    provideStore(),
    provideStoreDevtools(),
    provideEffects(),
    // router-store, data, etc
  ]
})

Describe any alternatives/workarounds you're currently using

Manual

I would be willing to submit a PR to fix this issue

  • Yes
  • No
@DMezhenskyi
Copy link
Contributor

Hey :) Is it something I could help you with?

@markostanimirovic
Copy link
Member

Hey @DMezhenskyi 👋

That would be great! Do you want to work on this feature? 😎

@brandonroberts
Copy link
Member Author

brandonroberts commented Apr 13, 2023

Also wanted to note that in Angular v16, for standalone apps there will be a src/app/app.config.ts that will get updated also in addition to the main.ts. I'm not sure if there is a migration provided by the Angular team to introduce this file.

It may only be for newly generated apps

@DMezhenskyi
Copy link
Contributor

Hey @DMezhenskyi 👋

That would be great! Do you want to work on this feature? 😎

Yeah, this is exactly what I would like to suggest :) My only concern is when you plan to deliver this feature because definitely I won't be able to work full-time on it. If it is not something urgent I would be happy to implement it.

@brandonroberts Thank you for the info, Brandon :) I will keep it in mind.

@markostanimirovic
Copy link
Member

It would be great if we publish this feature in the v16.0 release (~1 month), but it's not urgent.

@markostanimirovic markostanimirovic added the community watch Someone from the community is working this issue/PR label Apr 17, 2023
@DMezhenskyi
Copy link
Contributor

1 month... ok, I will try my best :)

@brandonroberts
Copy link
Member Author

brandonroberts commented Apr 21, 2023

I think to keep the scope down we should only target using ng add with the file structure for standalone projects.

ng add @ngrx/store

Would modify the src/app/app.config.ts and add provideStore() to the providers array in the bootstrap call, along with generating an initial feature state if requested.

@DMezhenskyi
Copy link
Contributor

Thank you all for your reviews, feedback and for accepting my PR 🙏

I think in my free time I could also help with other packages that need the support of the --standalone flag like effects, router-store, etc. My only question is if I have to create separate issues per package or how would it be better to organize that?

@brandonroberts
Copy link
Member Author

Thanks for working on this! I fixed our issue with syncing the schematics-core across packages and updated the remaining packages except for NgRx Data to support standalone with ng add.

#3881

If you would review it that would help also 🙂

@DMezhenskyi
Copy link
Contributor

Awesome! it was so fast :D Sure, I will be glad to review it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepting PRs community watch Someone from the community is working this issue/PR enhancement Project: Schematics
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants