• I made a modified module and put this module in the "node_modules" folder on the SD card.

    When I try to download my code to the Espruino with the proper require("xxxx") a pop-up window says file "xxxx" not found ?

    STAND-ALONE ESPRUINO If you have an Espruino with an SD card (but
    you're not using the Web IDE
    ), you can copy the modules you need
    into a directory called 'node_modules' on the SD card. Now, whenever
    you write require("modulename") the module will be used.

    Are you saying I can't use the WEB-IDE with a "Stand-Alone Espruino?"

    There should a software flag in the WEB-IDE to select either the Internet or default to the local SD card using the WEB-IDE?

  • You can confuse the IDE into not looking for the module online like so:

    var modname="modulename";
    var device=require(modname).connect(...); 
    

    Also, require()'s entered on the left side of the IDE will never use the module from the internet (it's going direct to the Espruino).

    I agree that it would be a nice feature addition to be able to disable searching for modules online.

    At the same time - if you're doing much development of a module on the SD card, that's a heck of a lot of swapping around of SD cards. You can also install XAMPP and use that as a local webserver, and do:

    
    var device=require("http://localhost/modulen­ame.js");
    
    

    (unfortunately, on default settings, XAMPP-apache serves files such that they get cached, so you have to use a different file name for each revision - there's a way to change this so apache sends headers that say not to cache, but I've had a hard time figuring it out :-/ - frankly, having to change the name of the file every time is no bad thing if you're not using source control - having those old debug versions around has come in handy on a number of occasions)

  • Of course, I could do one of the following:

    Use a terminal program (Non WEB-IDE) and lose the extremely easy to use syntax checking the WEB-IDE provides.

    Just publish my new "top secret" module(s) on Github for the Internet to see and use.

    Install and use XAMPP-apache webserver but for a novice or new-bee this would be a non-starter.

    Force/fake the WEB-IDE to look at the SD card and constantly swap out the SD and wear out the transflash socket.

    There has to be a better and easier way. Like directing the WEB-IDE to a C: drive folder for modules?

  • I just realized - Why the can't the WebIDE handle file:// urls? This would be the perfect solution to this

    I can do file:///c:/module.js in URL bar of Chrome, press enter, and it loads the file. But for some reason, if I do require("file:///c:/module.js").connect(­...) in the right side of the WebIDE, it complains that it can't find the module. Since chrome can handle those URLs, I suspect (hope?) it wouldn't be that hard to get the WebIDE to support that. It would certainly make life much easier for people developing modules (which right now pretty much requires installing a local webserver)

  • Chrome apps don't support something like file://
    Only option is to define a local folder for chrome.fileSystem
    In WebIDE you have to activate projects in options.
    There is a tutorial in help how to use it.

  • That is so lame that the chrome web browser will take that URL no problem, but web apps can't.

    What do you mean "in WebIDE you have to activate projects in options"

    What are "projects" in this context? Is that something that lets you use files from the local computer with the WebIDE? Where is the tutorial???

  • Projects are a plugin for WebIDE.
    I created a pullrequest some time ago, and Gordon merged it on github.
    To be honest, I never checked the app itself from the store :-)

    Under help should be a new button for project which gives a first introduction.
    Projects support a local folder, which is assigned to the webapp.
    Subfolders for projects, modules and binaries are available.
    Projects is a simple folder to handle js-files.
    Modules are searched in local folder first, before searching in the internet.
    Binaries hold compiled assembler code

    I'm still working on this to add functions like

    • send modules from local folder to sdCard on Espruino
    • send binaries (compiled assembler) to sdCard
    • send images (bmp format) to sdCard
  • Oh, woah, that's awesome!

    Yeah, there's an option in General to enable Projects plugin, then you exit and restart the WebIDE completely, and there it is... neat! I'll have to play with it tonight!

    Those planned features for it also sound really great, fills in a gap that I've seen a number of people talking about.

  • Don't forget to assign a local directory in options ;-)

    Planned feature will take some time, it will work together with a new function to set and watch variables on Espruino in line chart in webIDE.

  • Modules are searched in local folder first, before searching in the
    internet.

    Great, now I am able to patch or modify library modules to my liking and keep
    them private from the internet.

    On another note ... there should be strict revision version control on all library modules on the internet so users can either chose between keeping their local modules or using the "default" internet modules.

  • I was going to suggest this, but @JumJum's already there :) The ability to specify the project directory for modules/etc is really handy.

    @user7114 the modules all come from GitHub so you can actually just link to specific revisions on there if you have a real need, or you can check back and see what changed.

    The issue really is that stuff that's more than skin deep doesn't really get used at the moment... If I'd spend months writing a proper package management website, and provided the ability to choose specific revisions, would you have actually read about it and used it, when you didn't even look in settings to see the checkbox marked 'allows you to use files on your local disk'.

  • when you didn't even look in settings to see the checkbox marked
    'allows you to use files on your local disk'.

    I did look but the word BETA kept me away. "Enable Projects Plugin (BETA)"

    BTW ... the online docs for modules should include this "new" option.

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

New-bee ...How to force WEB-IDE to read local SD card modules?

Posted by Avatar for user7114 @user7114

Actions