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

Order packages by name #22

Open
binarykitchen opened this issue Feb 19, 2015 · 12 comments
Open

Order packages by name #22

binarykitchen opened this issue Feb 19, 2015 · 12 comments

Comments

@binarykitchen
Copy link

Currently when you do a direct npm install, it sorts the dependencies by name in the package.json. Do you think you could do the same here? That would be great. Thanks

@RyanMcG
Copy link
Owner

RyanMcG commented Feb 19, 2015

Do you mean to say that package.json is modified by npm install?

@binarykitchen
Copy link
Author

Yes. Every npm install reorders the list alphabetically. Check it out yourself. Would be good to have the same behavior here for the project.clj :)

@RyanMcG
Copy link
Owner

RyanMcG commented Feb 19, 2015

Generating a package.json with the dependencies in order seems like a good idea (not sure if we do that already). However, I'd prefer not to modify a source file without making that action explicit. Leiningen does not, why should we?

@binarykitchen
Copy link
Author

Well, having the package list sorted alphabetically is very nice for the developer's eyes. In our project we have over 40 npm packages. Scanning through these when not sorted is a pain.

If that list were sorted, we would save some seconds looking for packages. Makes it easier to visually parse the file.

In regards to modifying a source, I do not see a problem here because adding a new npm package requires a new line in the project.clj and that file has to be modified anyway.

@RyanMcG
Copy link
Owner

RyanMcG commented Feb 20, 2015

For all users who aren't adding a new dependency, this would modify their
project.clj next time they run npm install. There are other ways to sort
this list without adding unnecessary complexity to lein-npm.

On Thu, Feb 19, 2015 at 3:22 PM, Michael Heuberger <[email protected]

wrote:

Well, having the package list sorted alphabetically is very nice for the
developer's eyes. In our project we have over 40 npm packages. Scanning
through these when not sorted is a pain.

If that list were sorted, we would save some seconds looking for packages.
Makes it easier to visually parse the file.

In regards to modifying a source, I do not see a problem here because
adding a new npm package requires a new line in the project.clj and that
file has to be modified anyway.


Reply to this email directly or view it on GitHub
#22 (comment).

@binarykitchen
Copy link
Author

Not entirely correct. package.json is only modified when you append the --save flag. We could do this here too. Modify project.clj only on lein npm install --save. IMO this is fine and a clear indication from the user to add a new dependency on the list and this implies that reordering the list alphabetically afterwards should be fine too.

@RyanMcG
Copy link
Owner

RyanMcG commented Feb 20, 2015

I'm OK with that. It was not clear to me from your description that an implicit flag was necessary for modifying the file.

On Fri, Feb 20, 2015 at 2:25 PM, Michael Heuberger
[email protected] wrote:

Not entirely correct. package.json is only modified when you append the --save flag. We could do this here too. Modify project.clj only on lein npm install --save. IMO this is fine and a clear indication from the user to add a new dependency on the list and this implies that reordering the list alphabetically afterwards should be fine too.

Reply to this email directly or view it on GitHub:
#22 (comment)

@binarykitchen
Copy link
Author

Great. Sorry for not mentioning the --save flag earlier. Ok, looking forward to see this auto-sorting functionality in the next version ;)

@RyanMcG
Copy link
Owner

RyanMcG commented Feb 21, 2015

You are more than welcome to contribute a pull request. Unfortunately, I
feel like this might be harder to implement than it is with npm.
project.clj is not just data, it is a Clojure code. Perhaps something like
rewrite-clj would be helpful, of course that means unnecessary
dependencies.

On Fri, Feb 20, 2015 at 4:06 PM, Michael Heuberger <[email protected]

wrote:

Great. Sorry for not mentioning the --save flag earlier. Ok, looking
forward to see this auto-sorting functionality in the next version ;)


Reply to this email directly or view it on GitHub
#22 (comment).

@binarykitchen
Copy link
Author

Thanks man. I am afraid I do not know any Clojure. Writing all the code in JavaScript here at work.

Take your time to implement this. There is no rush. I'd say, low priority ;)

@RyanMcG
Copy link
Owner

RyanMcG commented Feb 21, 2015

Well Michael, despite being OK with the interface, unless there is higher demand for this feature I'd rather not implement it.

On Fri, Feb 20, 2015 at 10:13 PM, Michael Heuberger
[email protected] wrote:

Thanks man. I am afraid I do not know any Clojure. Writing all the code in JavaScript here at work.

Take your time to implement this. There is no rush. I'd say, low priority ;)

Reply to this email directly or view it on GitHub:
#22 (comment)

@binarykitchen
Copy link
Author

that's fine - as i said before: low priority for now.

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

No branches or pull requests

2 participants