• Espruino Tools

    Hi everybody,

    Ive been working on a few npm packages and an npx tool to ease the development of espruino devices using typescript.

    currently we have

    @espruino-tools/uart

    This package is a reimplementation of the espruino-ble-uart package.

    So far this package has been edited to have an overall nicer modal and typing made in typescript.

    There are plans to revamp this to improve the syntax to conform to more current ecma script standards such as using classes

    @espruino-tools/core

    This package provides all the basic features anybody could want to get started working with an espruino device, with the ability to easily create custom devices and expand functionality.

    Some notable features include:

    • Callable device functions through a method which runs any time code is changed on the device, this then populates an object which contains all the functions present on the connected device.
    • syntax that can be easier understood by beginners such as

      import { Puck } from '@espruino-tools/core';
      
      let puck = new Puck();
      
      device.onPress(function(){
      puck.LED.toggle("red");
      })
      

    other syntax and a getting started guide can be found on the documentation site here

    @espruino-tools/peer

    This package utilises peerjs to create easy peer to peer connection between a host computer and a connector computer (such as a mobile), this is especially useful for controlling espruino devices from a mobile device or sending video feeds to determine what an espruino device can do.

    create-espruino-app

    This is probably the most exciting addition, this NPX tool allows for espruino development to be started by running a single command npx create-espruino-app myapp.

    This has some benefits:

    • by running npm start within the directory a development localhost server will be run allowing for easy development.
    • a preset build command npm build that will compile your project into a single index.html and main.js file allowing for hosting on github pages for free.

    This also incorporates some tags:

    • --template This tag allows for a default project to be made with javascript, typescript, react or vue using npx create-espruino-tools appname --template typescript
    • --clean-install remove any junk ive added to make the landing page more presentable.
    • --peer initialise an espruino app with the peer package.

    There are plans to improve these packages further, for example:

    • utilising unpkg for non node development
    • refining the npx package generated directory
    • and much more.

    You can find the code here, dont hesitate to send me a message with any feedback it would be much appreciated.

    currently there are no demos but this will change in the future

  • Hi, thanks for sharing this!

    So just so I understand, espruino-tools/core runs in the browser and allows you to control a connected Espruino device - but when you connect it's able to query it to see what functionality is available on the device and expose that? That's very cool.

    I like the peer.js connection too. So that allows you to use your espruino-tools/core API, but just remotely?

    Having a way to get up and running with a localhost server and create-espruino-app looks pretty neat too. It feels like sometimes it can be more of a hinderance than a help if it's not well documented, but it looks like you've done an amazing jobs with the docs at https://documentation-xi-liard.vercel.ap­p/ - hopefully we'll see some others getting involved using this :)

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

Espruino Tools, a set of npm packages to ease the espruino tools development

Posted by Avatar for callummclu @callummclu

Actions