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: Support --project flag to specify apps or libs #1455

Closed
rafa-suagu opened this issue Dec 7, 2018 · 5 comments · Fixed by #1477
Closed

Schematics: Support --project flag to specify apps or libs #1455

rafa-suagu opened this issue Dec 7, 2018 · 5 comments · Fixed by #1477
Assignees
Labels
community watch Someone from the community is working this issue/PR enhancement Project: Schematics

Comments

@rafa-suagu
Copy link
Contributor

Describe any alternatives/workarounds you're currently using

Now it's impossible to generate a feature, store, reducer, entity, action and effect in a specific app or lib. To do this very common task we should create it in the default app and move it to the correct app.

Only container, because generates a component, supports the project flag.

Other information:

Angular CLI accepts this flag since version 6.

If accepted, I would be willing to submit a PR for this feature

[x] Yes (Assistance is provided if you need help submitting a pull request)
[ ] No

@duard
Copy link

duard commented Dec 9, 2018

I need the same thing

@brandonroberts
Copy link
Member

Sounds good to me. The workaround today is to change the defaultProject in your angular.json file before running the generate commands.

@rafa-suagu
Copy link
Contributor Author

Sounds good to me. The workaround today is to change the defaultProject in your angular.json file before running the generate commands.

@brandonroberts the workaround make sense but doesn't works for me with Angular/CLI 7. I had already tried before post the issue.

I will work on it this week to make the PR. Some tip to work on it?

@brandonroberts
Copy link
Member

brandonroberts commented Dec 10, 2018

@rafa-as Thanks for working on this! Each schematic has a schema that is represented through JSON and TypeScript. I'll use the container as an example, because the other schematics will follow the same structure.

Container schema JSON:
https://github.com/ngrx/platform/blob/master/modules/schematics/src/container/schema.json

Container schema TypeScript
https://github.com/ngrx/platform/blob/master/modules/schematics/src/container/schema.ts

The project is defined in the JSON and TypeScript files for schema validation and for types support when imported. Schematics already use a utility function that checks for the provided project. If the project is not provided, it uses the first one.

Once you add the project definition to the schema for the other schematics (action, effect, ...), it will pick up the provided project option when you run the generate command.

Here is an example test with a specified project you can reference to add tests to each schematic:
https://github.com/ngrx/platform/blob/master/modules/schematics/src/store/index.spec.ts#L88

If you need more assistance, just let us know.

@brandonroberts brandonroberts added enhancement Project: Schematics community watch Someone from the community is working this issue/PR labels Dec 10, 2018
rafa-suagu pushed a commit to rafa-suagu/platform that referenced this issue Dec 19, 2018
Now its possible to specify the project when generate actions, effects,
entities, features, reducers and stores.
The new flag is --project and his alias -p
Upgrade the documentation to add the new flag and his alias

Closes ngrx#1455
@rafa-suagu
Copy link
Contributor Author

@brandonroberts PR done! :)

brandonroberts pushed a commit that referenced this issue Dec 20, 2018
…1477)

Now its possible to specify the project when generate actions, effects,
entities, features, reducers and stores.
The new flag is --project and his alias -p
Upgrade the documentation to add the new flag and his alias

Closes #1455
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

3 participants