klei / klei/gulp-angular-filesort

Sorting seems to break given different orderings on globs passed to gulp.src

Open
#30 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
131
Forks
47
PR merge metrics
No merged PRs in 30d

Description

Following on from my post in #12, it seems that gulp-angular-filesort is breaking given different orderings of the glob patterns passed into `gulp.src` before piping into gulp-angular-filesort, which seems like a bug. Basically, changing from this:

``` js
gulp.src([
'app/**/*.js',
'!app/bower_components/**/*.js',
'.tmp/templates.js'
]).pipe($.angularFilesort())
```

To this:

``` js
gulp.src([
'.tmp/templates.js',
'app/**/*.js',
'!app/bower_components/**/*.js'
]).pipe($.angularFilesort())
```

Gives a working script order for injection. `.tmp/templates.js` is the file output from [gulp-angular-templatecache](https://github.com/miickel/gulp-angular-templatecache), set to use the main app module (rather than create its own) and use an immediately invoked function expression wrapper (as is used in all of the other files). The contents of this file are completely as expected; no different from any of my own source files in structure. For some reason, when added to the end of the glob patterns, gulp-angular-filesort outputs the main module followed immediately by the templates file right at the top, whereas when inserted as the _first_ entry in the glob patterns, the output is as expected, with the main module and it's dependencies at the end of the injected files.

This may be an issue in [ng-dependencies](https://github.com/klei/ng-dependencies) rather than gulp-angular-filesort; I'm happy to provide more help and info given some direction.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the two gulp.src glob orderings shown in the issue and compare the output from gulp-angular-filesort. Start by tracing how gulp-angular-filesort and its ng-dependencies component consume the ordered files, then determine whether both inputs produce the same valid injection order. Done means glob ordering no longer changes the resulting AngularJS dependency order, with a regression test for both examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
angularjs, javascript
Domain
build-system, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.