Skip to content

Publish native modules independently. #2729

Description

@mohsen1

Can you publish and maintain latest iojs native modules in npm? If we want to support all active versions of Node then we can't simply require(<native module>) since it has different behaviors in different versions of Node.

For example, breaking changes in url module caused an issue for our test here. So now it's not safe to require url module anymore since you don't know what you are going to get back.

Activity

  1. mscdex commented on Sep 7, 2015

    @mscdex
    Contributor

    Typically this is handled by explicitly specifying engines in your package.json and/or branching on process.version when you need to smooth over differences between major node.js/io.js versions that you're supporting for a particular (major) version of your project/module.

  2. added
    questionIssues asking questions about Node.js.
    on Sep 7, 2015
  3. Fishrock123 commented on Sep 7, 2015

    @Fishrock123
    Contributor

    Version-checking in your code will be the most robust for backwards-compat. Otherwise, to send warnings, use the engines field.

    Another option if you really need to maintain versions against node major releases, would be: module-node.version.numbers

  4. mohsen1 commented on Sep 7, 2015

    @mohsen1
    Author

    If a package is usually used as a dependency engines is not really helpful. I can't tell don't depend on it if you're running a different version of node. Using process.version works but it requires unnecessary work on my side. The new url module in iojs has a bug fix in resolve method. I wish I could use the new and fixed url module in all engines.

  5. mscdex commented on Sep 8, 2015

    @mscdex
    Contributor

    @mohsen1 Why not just extract url.js from here and use it in your project then?

  6. brody2consult commented on Sep 8, 2015

    @brody2consult

    On Tuesday, September 8, 2015, Brian White notifications@github.com wrote:

    @mohsen1 https://github.com/mohsen1 Why not just extract url.js from
    here and use it in your project then?

    +1 for your idea @mohsen1. The Cordova project did this starting with 3.0.

    Sent from my mobile

  7. mohsen1 commented on Sep 8, 2015

    @mohsen1
    Author

    I did use url.js from this repo here but copying over files is never a good idea!

  8. seishun commented on Oct 15, 2015

    @seishun
    Contributor

    I can't tell don't depend on it if you're running a different version of node.

    Why not? Surely you don't expect people to use your module with e.g. Node.js 0.4? That's why READMEs usually mention which Node.js versions are supported.

  9. jasnell commented on Mar 22, 2016

    @jasnell
    Member

    Closing since no discussion since october last year

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionIssues asking questions about Node.js.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions