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

feat(store): add support of standalone API for ng-add store #3874

Merged
merged 2 commits into from
May 7, 2023
Merged

feat(store): add support of standalone API for ng-add store #3874

merged 2 commits into from
May 7, 2023

Conversation

DMezhenskyi
Copy link
Contributor

@DMezhenskyi DMezhenskyi commented May 5, 2023

allow to set up the store for the standalone application when ng-add schematic is executed to improve DX

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

The execution of ng add @ngrx/store fails for the standalone angular application

Closes #3536

What is the new behavior?

The execution of ng add @ngrx/store will configure the store for a standalone application if the --standalone flag is provided

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

allow to set up store for the standalone application when ng-add schematic is executed to improve DX

Closes #3536
@netlify
Copy link

netlify bot commented May 5, 2023

Deploy Preview for ngrx-io ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 4720baf
🔍 Latest deploy log https://app.netlify.com/sites/ngrx-io/deploys/64567857dbc4590008a067d7
😎 Deploy Preview https://deploy-preview-3874--ngrx-io.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@DMezhenskyi
Copy link
Contributor Author

I hope I am on time :) I was proud to contribute to NgRx and looking forward to your feedback. I hope I didn't forget anything important.

@@ -52,3 +56,20 @@ export function isLib(

return project.projectType === 'library';
}

export function getProjectMainFile(
Copy link
Member

@brandonroberts brandonroberts May 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We keep our schematics-core synced across packages for consistency. This should be moved to

https://github.com/ngrx/platform/blob/master/modules/schematics-core/utility/project.ts

And then run

yarn copy:schematics

To copy it to schematics-core folder in the other packages.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... I just tried to do the steps you described but it seems like the yarn copy:schematics does nothing in my case. I expect the code under module/schematics-core will be propagated to store/schematics-core/..., however, I see no changes after running this command. Am I missing something?
P.S. The output of yarn copy:schematics shows that the task was successfully executed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm maybe it's an operating system path issue in our script. To not hold this up, if everything is good, we'll merge it and I'll follow up with the schematics-core move.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, so from my side no actions are needed anymore? :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right :)

@@ -50,6 +50,13 @@ export async function createWorkspace(
appTree
);

appTree = await schematicRunner.runExternalSchematic(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as other comment about schematics-core

@brandonroberts
Copy link
Member

Great work @DMezhenskyi! Only change is moving the schematics-core changes so we can reuse them.

Copy link
Member

@brandonroberts brandonroberts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving for functional changes

Co-authored-by: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com>
@brandonroberts brandonroberts changed the title feat(schematics) add support of standalone API for ng-add store feat(store): add support of standalone API for ng-add store May 7, 2023
Copy link
Member

@markostanimirovic markostanimirovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@brandonroberts brandonroberts merged commit 7aec84d into ngrx:master May 7, 2023
@brandonroberts
Copy link
Member

Thanks @DMezhenskyi! 🥳

@DMezhenskyi DMezhenskyi deleted the ng-add-for-standalone-api branch May 7, 2023 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Schematics Core: Add ability to add providers to bootstrapApplication function
4 participants