Application Structure with Modules #7094
Replies: 1 comment
-
Posted at 2018-06-04 by Ollie You can host modules externally and they will be required. So you could use a Git provider and load the module directly using it's URI. Only downside is you obviously need connectivity. Posted at 2018-06-04 by chrsbvr What about just a config file with environment variables? I'd like to export an object that pulls in local environment variables from a file in my .gitignore that holds my Wifi name/password. How can I load a file locally to accomplish this? I don't want to have to put a config file in the ./modules folder, is there a way around this? Posted at 2018-06-04 by @gfwilliams You could use the command-line tools? https://www.npmjs.com/package/espruino Sounds like with multiple files you're probably not going to be using the IDE editor much anyway. Use your favourite editor and then use the I believe the CLI will pull modules out of Posted at 2018-06-04 by chrsbvr Thanks Gordon! I didn't realize I could build from the CLI package. I do like the Chrome extension, however I am finding a problem with hovering over text and a tooltip will popup and not go away. I keep having to close the IDE and open it again, but the one file is also a problem. I think I'll move over to Visual Studio Code and build like you mentioned. Posted at 2018-06-06 by @gfwilliams
I have had this once or twice too - I'm finding it very hard to track down though as it doesn't seem to happen reliably. Posted at 2018-06-06 by chrsbvr
I'm working from Ubuntu Linux. I don't know if that info will help with tracking down the bug or not. Posted at 2018-06-06 by Wilberforce See this thread: http://forum.espruino.com/conversations/298523 Is there a way of tying the build into visual studio Code? Posted at 2018-06-06 by Wilberforce I've also looked at the parcel package for building code - although that does not intergrate with the sending to espruino part. Posted at 2018-06-06 by chrsbvr Thanks @wilberforce for pointing me to that thread. I am familiar with rollup. I will check it out. I'm doing an Ionic app in VS Code. For tying the build into VS Code I just run npm from the internal terminal. I'm sure you can find some nice plugins with it. I like it so I can use TypeScript and ES6 stuff with IDE styles and formatting and linting. Posted at 2018-06-07 by Wilberforce There's a bug in the plugin that has been pushed to npm - lodash forEach - you have to edit that to get it to build which is a real pain. There has also been some changes to the espruino (confusing name - the npm code that talks to a connected board) that allows you to specify the port as "tcp://1.2.3.4" where 1.2.3.4 is your ip - this sends over tcp rather than serial ansis about a million times quicker. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2018-06-03 by chrsbvr
I'm looking at building an application for my ESP32 with Espruino, and I'd like to organize my code in different javascript modules. I see that if I want to use a require() on a local file, it looks in whatever folder is assigned to my projects in the IDE. Then there is a modules subfolder there for including local js modules.
My problem is I want to maintain code in different files, and also host it in a git repository. How can I do this without having to include the Espruino IDE project folder and all of the contents with it?
Ultimately I'd like to have a folder anywhere on my local drive and that the require() statement would search inside the local folder holding my code rather than putting modules for all of my projects in the same folder. Can I do this?
Beta Was this translation helpful? Give feedback.
All reactions