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

Ordering files "by glob" #3

Closed
asgerhallas opened this issue Oct 1, 2015 · 9 comments
Closed

Ordering files "by glob" #3

asgerhallas opened this issue Oct 1, 2015 · 9 comments

Comments

@asgerhallas
Copy link

I wonder if it is possible to populate the files-array , so the files is in the same order as the glob-matches, like if I do:

filesGlob: [ "/a/*.ts", "/b/*.ts" ]

it would result in:

files: [ "/a/1.ts", "/a/2.ts", "/b/1.ts" ]

and so on.

That would be very useful for making sure dependencies got emitted in the right order when using --out.

@wjohnsto
Copy link
Owner

wjohnsto commented Oct 7, 2015

This is definitely possible. I'm working on getting some tests up, and I would want to finish that before I add this feature.

@henryptung
Copy link

+1 to this. Because the tsconfig.json is checked in for us, there's a lot of churn in that file any time something changes (and sometimes when nothing changes), so the Git history for that file is basically useless until we have a consistent ordering.

@brahms brahms mentioned this issue Nov 12, 2015
@brahms
Copy link

brahms commented Nov 12, 2015

Hey, I made a quick PR for this fix, it still keeps files sorted by their file type, but makes sure before entering that function they are already sorted by alpha.

@wjohnsto
Copy link
Owner

Fixed in v0.3.0

@asgerhallas
Copy link
Author

Sorry for going silent on this one. That is great news. I'll check it out!

@ajaegle
Copy link

ajaegle commented Mar 16, 2016

I'm using version 4.1.0 and having some issues concerning the order - especially as this behaves differently to the way the atom-typescript plugin does the rewriting.

    "filesGlob": [
        "./app/**/*.ts",
        "./typings/browser.d.ts",
        "!./node_modules/**/*"
    ],

Results in:

       "files": [
          "./typings/browser.d.ts",
           "./app/base/first.ts",
           "./app/base/second.ts",
           ...
         ]

If I correctly understand this issue, this should have been fixed to behave deterministicly, right?

@henryptung
Copy link

@ajaegle The sort order priority is something like this:

  1. tsd.d.ts
  2. All other *.d.ts files (sorted)
  3. All other files (sorted)

The order you gave does seem consistent with this; do you need a different order?

@wjohnsto
Copy link
Owner

I'm not sure about the behavior of atom-typescript. The initial thought with sorting the .d.ts files was because earlier versions of TS read the files in-order and wouldn't get the typings unless they were at the top. I think this has been resolved.

Another benefit of sorting was to prevent the tsconfig.json from changing unless it has to. This helps with commits so that you are not constantly finding merge conflicts with the tsconfig.json.

It does appear as though it is possible to stop sorting .d.ts files to the top of the list, so if this is what people want then I can make it happen.

@wjohnsto wjohnsto reopened this Mar 21, 2016
@fernandomora
Copy link

+1 to use same sorting that atom-typescript.
When some people use atom-typescript and others tsconfig-glob, each time a team member updates tsconfig.json, files order is changed and git history gets dirty.

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

No branches or pull requests

6 participants