browserify with p5.serialcontrol

i’m working on the p5.serialcontrol app. one thing i’d like to fix is the way we use the p5 libraries.

currently, the app is packaged with static versions of p5, p5.dom, and p5.serial in the ‘libs’ folder.

this is not ideal. for one, we’re not pulling the most up-to-date versions of those libraries. i also got confused and was updating the p5.serialport library that comes packaged with p5.serialcontrol when i should have been working from the main p5.serialport repo.

it would be great if we could link to the live repositories in package.json. i spent some time researching this today and it seems like the way to link in the package.json, then use those modules on the client side, would require browserify or webpack. this would let us use the node require() syntax outside the node (server-side) context. i think the steps are:

  • update the package.json
  • remove the scripts from index.html

  • rewrite the existing sketch.js file with var p5 = require(‘p5’) at the top, like this
  • install and configure browserify for the project, something like this
  • compile the new electron app

this would solve several problems:

  • get rid of the entire ‘libs’ folder, which would be less confusing for development
  • make sure we always have the most up-to-date versions of those libraries

Leave a Reply