nathangrove / ng-snow

Angular2+ starter application for ServiceNow integration
25 stars 23 forks source link

Angular CLI puts generated services in the e2e directory #10

Open dpatino2 opened 5 years ago

dpatino2 commented 5 years ago

When I use bash to generate a service, the corresponding service gets generated in the wrong directory. Instead of project/src/app is goes to project/e2e

To reproduce:

  1. open Bash to project directory
  2. type ng g s org-node --skipTests=true
  3. notice where the files are generated

Workaround:

  1. navigate to angular.json in project directory
  2. remove the additional project starting at line 92

I don't know enough about why that e2e project is there to create a PR

nathangrove commented 5 years ago

What version of the angular-cli are you using (the project default should be 6.0.8)? You can run ./node_modules/.bin/ng --version to see the installed version for the project. I cannot reproduce this using a fresh copy of the repo.

The e2e portion of the project is angular's integration with protractor (its testing framework). In angular-cli 6.x version you need to say --spec false in order to have it skip creating spec files.

dpatino2 commented 5 years ago

Thanks for the info and the tip for skipping tests. Here are the results you asked for

DANs-Air:fs-org-chart dan$ ./node_modules/.bin/ng --version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/

Angular CLI: 6.0.8
Node: 10.15.3
OS: darwin x64
Angular: 6.0.7
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.8
@angular-devkit/build-angular     0.13.8
@angular-devkit/build-optimizer   0.13.8
@angular-devkit/build-webpack     0.13.8
@angular-devkit/core              0.6.8
@angular-devkit/schematics        0.6.8
@angular/cli                      6.0.8
@ngtools/webpack                  7.3.8
@schematics/angular               0.6.8
@schematics/update                0.6.8
rxjs                              6.0.0
typescript                        2.7.2
webpack                           4.29.0
dpatino2 commented 5 years ago

However, whenever I just run ng --version, I get this. I'll try to figure out how to rollback my global CLI version.

DANs-Air:fs-org-chart dan$ ng --version
Your global Angular CLI version (7.3.8) is greater than your local
version (6.0.8). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/

Angular CLI: 6.0.8
Node: 10.15.3
OS: darwin x64
Angular: 6.0.7
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.8
@angular-devkit/build-angular     0.13.8
@angular-devkit/build-optimizer   0.13.8
@angular-devkit/build-webpack     0.13.8
@angular-devkit/core              0.6.8
@angular-devkit/schematics        0.6.8
@angular/cli                      6.0.8
@ngtools/webpack                  7.3.8
@schematics/angular               0.6.8
@schematics/update                0.6.8
rxjs                              6.0.0
typescript                        2.7.2
webpack                           4.29.0
dpatino2 commented 5 years ago

I rolled back my global version of angular cli using: DANs-Air:fs-org-chart dan$ sudo npm install -g @angular/cli@6.0.8 When I run ng --version I no longer get the version mismatch warning.

I then plugged the e2e project back in the angular.json config. I get the same results when I use schematics to generate a service (it gets put in the wrong directory).

Honestly I think this seems like a pretty minor bug with a reasonable workaround. I just wanted to put it out there in case someone else experiences something similar.