lefos987 / generator-ghurt

MIT License
23 stars 1 forks source link

Align folder structure with Angular styleguide even more #13

Open lefos987 opened 10 years ago

maxwellito commented 10 years ago

Just to be sure we are talking about the same things. I guess it's related to this page : https://docs.google.com/document/d/1XXMvReO8-Awi1EZXAXS4PzDzdNvV6pGcuaF4Q9821Es/mobilebasic?pli=1

I've tried in the past to update Grunt to run the task and had to face to few difficulties. Which will also be present with Gulp.

foo/                          # Foo module
    foo.js                    # The 'foo' module is defined here.
    foo-directive.js
    foo-directive_test.js
    foo-service.js
    foo-service_test.js        

Here is the structure of a module. Simple, easy to understand. But at the moment when I write these lines I think I found solution to the problems.

The first problem was to concat/uglify the scripts. The logic was to select the files with src/**/*.js, unfortunately now the tests are with the source, so we have to exclude them src/**/*.js, !src/**/*_test.js. But this is not enough. Apparently, foo-directive.js pass before foo.js in the concat. Which cause a problem when it come to execute the script, because we use a module which hasn't been defined yet. But I think src/**/[a-zA-Z0-9]*.js, src/**/*.js, !src/**/*_test.js could be a workaround. Need some tests..

The second problem was to split script files from test files in the Karma config. If I'm not wrong, the syntax to select files is less advanced as Grunt/Gulp. It might be hard.

userlogin/
    somefilter.js
    somefilter_test.js
    userlogin.js
    userlogin.css                
    userlogin.html                
    userlogin-directive.js
    userlogin-directive_test.js
    userlogin-service.js
    userlogin-service_test.js

This is a quite complex module, and some points are confusing me : to which module the somefilter is linked to? Because I need to know for the generator, or I cannot take this case in charge.

Otherwise, our app structure is quite close to this system (thanks Pete!), so it shouldn't be that complex to adapt.