npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

espruino-create-project

v0.1.2

Published

Easily create & flash Espruino projects from templates

Downloads

4

Readme

Espruino Create Project

Easily create boilerplates that can flash Espruino firmware and upload an embedded JavaScript program to either ESP8266 or ESP32.

Prerequisites

Install esptool.py from:

https://github.com/espressif/esptool

Connect esp32 or esp8266 using a serial/usb port and find out the name of the port.

Demo

Demo

Installation

npm install -g espruino-create-project

Usage

Create a boilerplate using globally installed espruino-create-project library

espruino-create-project init my-esp8266-project --chip esp8266 --baud 115200 --port PORT1 --author 'Cuneyt Aliustaoglu'

Then

cd  my-esp8266-project

Erase the existing firmware

npm run erase
$ npm run erase

> [email protected] erase /Development/my-esp8266-project
> esptool.py --port /dev/cu.SLAB_USBtoUART erase_flash

esptool.py v2.5.0
Serial port /dev/cu.SLAB_USBtoUART
Connecting........_
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: 80:7d:3a:5b:b2:17
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...
Chip erase completed successfully in 6.8s
Hard resetting via RTS pin...

Write Espruino firmware into your chip:

npm run flash
$ npm run flash

> [email protected] flash /Development/my-esp8266-project
> esptool.py --port /dev/cu.SLAB_USBtoUART --baud 115200 write_flash --flash_freq 80m  -fm dio --flash_size 4MB 0x0000 firmware/bo

esptool.py v2.5.0
Serial port /dev/cu.SLAB_USBtoUART
Connecting........_
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: 80:7d:3a:5b:b2:17
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Flash params set to 0x024f
Compressed 3856 bytes to 2763...
Wrote 3856 bytes (2763 compressed) at 0x00000000 in 0.2 seconds (effective 125.2 kbit/s)...
Hash of data verified.
Compressed 459684 bytes to 320164...
Wrote 459684 bytes (320164 compressed) at 0x00001000 in 28.2 seconds (effective 130.5 kbit/s)...
Hash of data verified.
Compressed 128 bytes to 75...
Wrote 128 bytes (75 compressed) at 0x003fc000 in 0.0 seconds (effective 92.1 kbit/s)...
Hash of data verified.
Compressed 4096 bytes to 26...
Wrote 4096 bytes (26 compressed) at 0x003fe000 in 0.0 seconds (effective 5234.6 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

Empty project file is located under src/main.js. Change this file as you wish

E.on('init', function() {
  digitalWrite(2, 0);
})

and just use below command to upload it to the chip:

npm run upload
$ npm run upload

> [email protected] upload /Development/my-esp8266-project
> npm run uglify && espruino -p /dev/cu.SLAB_USBtoUART -b 115200 --board boards/ESP8266_4MB.json -e 'save()' index.js


> [email protected] uglify /Development/my-esp8266-project
> uglifyjs src/* --compress --mangle -o ./index.js 

Espruino Command-line Tool 0.1.20
-----------------------------------

Explicit board JSON supplied: "boards/ESP8266_4MB.json"
Connecting to '/dev/cu.SLAB_USBtoUART'
Connected
--] 
--]  ____                 _ 
--] |  __|___ ___ ___ _ _|_|___ ___ 
--] |  __|_ -| . |  _| | | |   | . |
--] |____|___|  _|_| |___|_|_|_|___|
--]          |_| espruino.com
--]  2v04 (c) 2019 G.Williams
--] 
--] Espruino is Open Source. Our work is supported
--] only by sales of official boards and donations:
--] http://espruino.com/Donate
--] Flash map 4MB:512/512, manuf 0xef chip 0x4016
--] 
--] >
--] Compacting Flash...
--] Calculating Size...
--] Writing..

If you created the boilerplate with wrong parameters you can update parameters using update command. You need to be inside your project when you execute this.

espruino-create-project update --chip esp32 --baud 9600 --port PORT2 --author 'My Name'

Commands

npm run

erase: erase flash in ESP8266 flash: flash new firmware reset erase then flash reupload: erase flash, flash new firmware, uglify javascript code and then upload uglify: just uglify the code and bundle in index.js upload: upload the bundled code to ESP8266 screen: serial monitor your device

Notes

All files under /src will be merged into a single file, uglified and then uploaded into the chip.