cgross / generator-cg-angular

Yeoman generator for Enterprise Angular projects.
MIT License
592 stars 198 forks source link

Fixed several gulp script problems so that i will work out-of-box #91

Closed fobbyal closed 9 years ago

fobbyal commented 9 years ago

The gulp script does not work out-of-box. I made the modifications below so that it would work out of box. The changes are tested with the ui-router option selected.

Problems found

  1. html not defined in config
  2. Modified JS config to include all JS files other than test-results and bower files
  3. added missing app.js to karma config
  4. added code to app.js template so that $rootScope.$state and $rootScope.$stateParams are set when ui-router are selected
  5. Modified partial/index.js line 52 to remove '/' concat after this.dir. This was cause double slashes '//' for ui-routers. Not sure if it is the same for angualr-router. (will be testing later)
  6. The template implementation was not working with karma. All script references on index.html has to be valid when karma runs. However test:unit only gets run under apps folder which does not utilized the htmljs results. But at the same time both index.html and app.js reference the templates module. This gives error running gulp default task as well as running unit test on karma. Implemented comments <!— template-holder —> , /\ template-holder **/ on index.html and app.js respectively. modified gulpfile.js to replace the comments with templates module initialization code when running build:dist.

    Remaining Problem

I could not figure out why browswersync stops under the serve:dist task. The server stops as soon as test:unit is done with Karma. I have removed the build:dist dependency so i can at least serve it after i manually run build:dist. Sorry I am new to the javascript scene so i don't know enough about this to fix it. Please let me know why so I can learn. Another question I have is if watch functionality should be implemented for build:dist.

Quesitonable scaffolding (Not sure if this should be accepted)

  1. Questionable scaffolding modified in partial/index.js. Running sub generator partial on modules creates file in app/modules/[module-name]/modules/partial/[partial-name] directory. I removed the extra modules so that the files are created in app/modules/[module-name]/partial/[partial-name] directory

    Future work

Based on reading google’s doc via https://docs.google.com/document/d/1XXMvReO8-Awi1EZXAXS4PzDzdNvV6pGcuaF4 Q9821Es/pub. It seems that this is not a word to word scaffolding implementation. I am thinking about extending this project to utilize the components and sub-section organization as well as adding -directive -factory -service -controller suffix to all js file names that are generated through the sub generators.

fobbyal commented 9 years ago

Sorry I am git hub newbbie. this is actually for cg-gas and not for this. Sorry for the inconvenience.

blackotruck commented 9 years ago

There is a minor error on line 10

var ngHtml2js = require("gulp-ng-html2js");

note the double quotes, it should use single quotes to avoid conflict with jshint (all other requiere sentences are using single quotes)