Module versioning

Posted on
  • @the1laz how does node.js handle requesting certain versions? Is it
    all done via npm - or can you require("foo@1.2")?

    The issue for me at the moment is that there is no versioning on the
    modules. I'm not 100% sure there should be either as Git commits maybe
    make more sense... Someone could easily come up with a historic
    modules plugin for the Web IDE that let you choose from a list of
    modules, and then let you choose the git commit from a list (which
    could also show date and commit message) or maybe even add your own
    URL if you wanted to do some development work.

    Npm handles it all, node just uses whatever is supplied.

    Can the web IDE use local files without a http server? If it (optionally?) preferentially looked in a node_modules folder when loading modules, then people could just keep local copies of the modules they use if they want them to stay unchanged. Then they can use whatever method they wanted to manage versions (git, npm, etc.).

  • @the1laz, the IDE has already a folder - sandbox - from where it can pick modules. I do though not know the priority, whether Web or sandbox folder first. Adding a repo folder in adition to the sandbox could be the answer.

  • Local sandbox has priority over internet.

    Which is good, just don't forget about it

  • Maybe using the sandbox should be the preferred method of keeping stable code for people needing it - local backups or downloads of specific github commits.

    @Gordon - Can EspruinoTools use local files?

  • @the1laz yes - at least the sandbox keeps everything together.

    You mean via node.js?

    I'm not sure EspruinoTools can use local files yet. There should be a 'processor' type defined for getting files (and then various handlers see if they can find them by whatever means they can). If that's the case then it should be easy to add.

    If not I guess I should add it, but I'm running out of time again now :)

  • I don't need it myself, (I'm using a webserver for my own modules), but I might have a crack if I get around to it. I saw the section that it needs to work with, so I have an idea of what I have to do.

  • are you sure that the local sandbox has priority over internet?

    i tried it with the ESP8266_v25 module, i copied it to the project/module folder, but require took always the internet version, after renaming (and using that name in require) it worked

  • Hmm. That's odd - could it have been a capitalisation issue?

    I guess it's possible it does:

    • Check local for .min.js
    • Check online for .min.js
    • Check local for .js
    • Check online for .js

    You could tweak it by changing the module load order in settings to .js|.min.js

    ... that logic should probably be changed though.

  • i will check it again

    i interpret your order, that i need to put the minified version local do get the local priority?

  • Yes (or just rename the file).

    However the search order for file extensions can be specified in settings - you could even search for and prioritise *.my_version.js if you wanted.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Module versioning

Posted by Avatar for the1laz @the1laz

Actions