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(schematics): add component store schematics #2886

Merged

Conversation

stefanoww
Copy link
Contributor

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?

Closes #2570

What is the new behavior?

Does this PR introduce a breaking change?

[ ] Yes
[X] No

Other information

@stefanoww stefanoww marked this pull request as ready for review January 17, 2021 15:23
@ngrxbot
Copy link
Collaborator

ngrxbot commented Jan 17, 2021

Preview docs changes for 7fc3766 at https://previews.ngrx.io/pr2886-7fc3766a/

@stefanoww stefanoww force-pushed the add-component-store-schematics branch from a81b3db to 1d1caae Compare January 17, 2021 20:37
@brandonroberts
Copy link
Member

You need to run yarn copy:schematics to copy the schematics-core into the other libraries. That should fix the CI error

@va-stefanek
Copy link
Contributor

va-stefanek commented Jan 18, 2021

You need to run yarn copy:schematics to copy the schematics-core into the other libraries. That should fix the CI error

@brandonroberts It cause newly added methods disappearing from the ast-utils.ts. Is that expected?

@brandonroberts
Copy link
Member

Yes. You need to add the changes to modules/schematics-core first, then run the command to sync the changes in all the libraries. We do it this way because it's not currently a standalone package

@stefanoww stefanoww force-pushed the add-component-store-schematics branch 4 times, most recently from 3442390 to 4044362 Compare January 20, 2021 18:58
@va-stefanek
Copy link
Contributor

@brandonroberts seems to be fine now despite of Labeler which probably fail for the forks.

@brandonroberts
Copy link
Member

One request would be to change the test scaffolding to not use the TestBed, and just create a new instance of the ComponentStore

cc: @alex-okrushko

@stefanoww stefanoww force-pushed the add-component-store-schematics branch from 4044362 to 67e4d4e Compare February 7, 2021 20:00
@stefanoww
Copy link
Contributor Author

@brandonroberts done.

@stefanoww stefanoww force-pushed the add-component-store-schematics branch from 67e4d4e to 7fc3766 Compare February 7, 2021 22:06
@fgoulet
Copy link

fgoulet commented Feb 20, 2021

While waiting for the PR to be reviewed, is there a sample of a spec file generated with this schematic somewhere ? I'm looking for something to help me with unit testing in component store.

@brandonroberts
Copy link
Member

The spec is pretty minimal. The <% references are just placeholders

import { <%= classify(name) %>Store } from './<%= dasherize(name) %>.store';

describe('<%= classify(name) %>Store', () => {
  const componentStore = new <%= classify(name) %>Store();

  it('should be created', () => {
    expect(componentStore).toBeTruthy();
  });
});

@brandonroberts brandonroberts merged commit f086f80 into ngrx:master Mar 8, 2021
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: add schematic for component store
5 participants