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 fails to attach to modules outside of apps dir #1512

Closed
emilio-martinez opened this issue Jan 14, 2019 · 3 comments · Fixed by #1518
Closed

Schematics fails to attach to modules outside of apps dir #1512

emilio-martinez opened this issue Jan 14, 2019 · 3 comments · Fixed by #1518

Comments

@emilio-martinez
Copy link
Contributor

Minimal reproduction of the bug/regression with instructions:

Bumped into this issue in a project following the Nrwl Nx Schematics project structure. The project contains a lib "my-lib", and when running ngrx schematics with the "module" param I get the following output.

$ ng generate @ngrx/schematics:feature my-feature --module=libs/my-lib/src/lib/my-lib.module.ts --dry-run

Specified module path /apps/my-app/src/app/libs/my-lib/src/lib/my-lib.module.tsdoes not exist

The schematics seem to be only pointing to the first project in the angular.json. I also tried changing the defaultProject temporarily, but there was no change.

Expected behavior:

Schematics should be able to generate in projects other than the main app. Perhaps a --project param is needed?

Versions of NgRx, Angular, Node, affected browser(s) and operating system(s):

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.12.1
@angular-devkit/build-angular     0.12.1
@angular-devkit/build-optimizer   0.12.1
@angular-devkit/build-webpack     0.12.1
@angular-devkit/core              7.2.1
@angular-devkit/schematics        7.2.1
@angular/cli                      7.2.1
@ngtools/webpack                  7.2.1
@schematics/angular               7.2.1
@schematics/update                0.12.1
rxjs                              6.3.3
typescript                        3.1.6
webpack                           4.23.1
@ngrx/*                           7.0.0

Other information:

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

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

@timdeschryver
Copy link
Member

Have you tried using the --project flag?
It should be available via #1477.

@emilio-martinez
Copy link
Contributor Author

I hadn't. Although it's kind of hard to know it's there because it doesn't appear via --help:

$ ng generate @ngrx/schematics:entity --help                
Generates and/or modifies files based on a schematic.
usage: ng generate @ngrx/schematics:entity <name> [options]

arguments:
  schematic
    The schematic or collection:schematic to generate.

options:
  --defaults 
    When true, disables interactive input prompts for options with a default.
  --dry-run (-d)
    When true, runs through and reports activity without writing out results.
  --force (-f)
    When true, forces overwriting of existing files.
  --help 
    Shows a help message for this command in the console.
  --interactive 
    When false, disables interactive input prompts.

Help for schematic @ngrx/schematics:entity

arguments:
  name
    The name of the entity.

options:
  --flat 
    Flag to indicate if a dir is created.
  --group (-g)
    Group actions, reducers and effects within relative subfolders
  --module (-m)
    Specifies the declaring module.
  --reducers (-r)
    Specifies the reducers file.
  --spec 
    Specifies if a spec file is generated.

Seems like the schema declaration has it set to be invisible? Is there any reason for that?

@emilio-martinez
Copy link
Contributor Author

Added a PR to make the flag visible—if helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants