bevry-archive / lazy-require

Sponsor this project to keep it maintained, or use Deno instead.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add version support

balupton opened this issue · comments

Add version support

Used lazy-require for a thing:
https://github.com/jstransformers/jstransformer-cli

Well done on this, Ben! 👍

+1 version support would be great!

@balupton I just read over your code. If you could write up how you would like the API to be, I could implement this and submit a Pull Request for you to review 😃 . I was thinking that there be a version option or something similar.

@Glavin001 cool give me a moment, I'll move it from coffeescript to es6, then you can add your thing

have version as a properties of opts would be the way to go

Also I noticed one of the tests failed, "incomplete". Is that just me?

@Glavin001 es6 version released, so good for your pull request, tests passing for me

We're also on slack at https://slack.bevry.me

I like the idea to have version support.

One potential issue to navigate would be if a package was requested with two different versions, how the node_modules folder would look.

One potential issue to navigate would be if a package was requested with two different versions, how the node_modules folder would look.

It would only allow one. I suppose if the version of the most recent request was incompatible with the previously installed version then npm would trigger a fresh install of the currently requested version.

This is all backed by calling npm install <package> ( see https://github.com/bevry/lazy-require/blob/master/es6/lib/lazy-require.js#L238 ) so you could test the expected behaviour by running the commands in your Terminal.

is there any update on this feature?