Espruino command-line and NPM module #102
Replies: 22 comments
-
Posted at 2015-11-18 by UliMerkel just a little typo on the npm text: ?? when I'm using WinXP how do I get the specification of the port for: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-18 by @gfwilliams Thanks! It should just be |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-19 by the1laz Thanks @gordon! Looks great, nice readme! Looking through the to-do section, I'm not sure if it's worth adding a file watching feature, since people will have their own that they use (maybe with gulp/grunt and their own development environment). Something that could be useful would be to write to a file instead of to the espruino board. As in, it grabs all the modules from the espruino website, assembles the "addcached" call, minifies, and then writes all these commands into a js file for someone to be able to upload later, or keep a copy of, or to debug. Basically, to act like browserify. :P |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-19 by @gfwilliams Thanks! Yes, writing to a file would be a good one - especially where the compiled/assembled code comes in. With the watch, it looks like it's just a few lines of code... For people that want it to 'just work' it might be a good idea to have built in - but yes, if it's more complex than that it'd make more sense to use something built for it. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-19 by @gfwilliams Ok, there's now |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-19 by the1laz Awesome! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-19 by Ollie I think the watch feature would be cool and useful. Keeps everything self contained and easy start. In the go version it was a very simple thing to implement as someone had provided a package. Same appears to be true for Node.js https://www.npmjs.com/package/filewatcher @gordon I noticed you gave Espruingo a mention - thanks very much- but you know now I'll have to maintain it ;) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-23 by stephaneAG pretty cool ;) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-12-11 by Tobbe Ohh, too bad I didn't know about this earlier. https://github.com/Tobbe/robotgame/blob/master/nodejs/app.js |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-12-11 by Tobbe Hmm, I'd still need serialport to do the port scanning, right? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-12-11 by @gfwilliams Yes, it uses the serialport - if you're uploading code it does things like scanning for modules though. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-12-11 by Tobbe I mean "serialport" as in the npm module :) https://github.com/voodootikigod/node-serialport I guess my real question was if https://www.npmjs.com/package/espruino would automatically find my espruino if I just plugged it in, or if I had to first figure out what port it was connected to (for example by scanning all ports with node-serialport, looking for something that looks like an espruino) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-12-11 by @gfwilliams
Yes, sorry - typo on my part. That's the lib it uses.
No, if there are >0 ports, it'll pick the first one. It isn't able to test to see if an Espruino is on that port - although if it were possible (reported back by the OS?) that'd be really cool. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-12-11 by Tobbe In the script I posted above I just loop over the ports doing
Not very clever and I know for a fact that it doesn't work on my coworker's Ubuntu install (the same board reports manufacturer as "STMicroelectronics", i.e. without the dot at the end). Could try some ducktyping after that I guess by sending some commands and see if the reply looks like it comes from an Espruino :) |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-12-11 by @gfwilliams Ahh, great! - I reckon you could probably check the USB Product and Vendor IDs pretty reliably, and presumably they are available in a similar way. If you did do it, it'd be great if you could submit it as a change for: https://github.com/espruino/EspruinoTools/blob/gh-pages/bin/espruino-cli.js#L273 |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-01-11 by CrashingDutchman When I do a npm install -g espruino, I see the folder coming up in my node_modules folder for a while and then it is getting removed. The installation ends with a message to consult the log file. See attachement.Attachments: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-01-13 by @gfwilliams I'm afraid I'm not much of a node.js guru, but looking at the error messages it seems to be a problem installing contextify - presumably Maybe you could post up on the contextify issues page - or perhaps someone else has some ideas here? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-01-13 by CrashingDutchman Yes, contextify also fails. Error is:
That probably explains it. I am on a Windows machine and didn't have Python installed. After installating Python I still get errors, so I better head over there... Thanks @gordon |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-01-13 by @gfwilliams Ok, glad you're getting somewhere... When I get time, I have plans to try and reduce some of the dependencies the Web IDE has - and hopefully that'll make the installation easier on all platforms. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-01-13 by CrashingDutchman For future reference, he is some information for people who want to try running the Espruino command line version on Windows (10). The requirements are pretty well described here: http://www.serverpals.com/blog/building-using-node-gyp-with-visual-studio-express-2015-on-windows-10-pro-x64 I had to install Python 2.7(.11). The latest version of Python did NOT work so get version 2.7. I already had Visual Studio 2015 Community Edition installed. Make sure you select the Visual C++ option during your install. Other requirements for me were:
After make sure everything was installed correctly I was able to use NPM install -g Espruino for a successful install. Unfortunately, I don't have an Espruino (or ESP8266) with me to test if it works. If nothing is connected to a serial port, then starting Espruino comes up with an error:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-01-17 by conor Works fine for me on Windows 10, Visual Studio Community 2015 and Node 4.2.3. Happily talking to Espruino. Very useful! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-01-17 by CrashingDutchman @conor Thank you for the update. Visual Studio is what I am planning to use it with too! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-11-18 by @gfwilliams
Hi,
Just to say that I finally got around to creating a NPM module for Espruino.
If you have node.js and NPM installed you can just do:
and you'll get the command-line tool.
Instructions here
You can also use it to do things from node.js on your PC:
It still needs a bit of work, but hopefully this will be a good start.
Beta Was this translation helpful? Give feedback.
All reactions