Skip to content

blockarchitech/pebble-typescript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pebble Typescript

A somewhat foolproof way to write Pebble apps with TypeScript.

Usage

  • Clone this repository
  • Run npm install to install dependencies
  • Edit bundler.sh to point to your pebble tool location.
    • If you installed the SDK locally, this is probably somewhere in ~/pebble-dev.
  • Run npm run build
    • This will build your Pebble project, build your TypeScript files, and chuck the TS files into PBW.

You can also run npm run clean, which will remove all build artifacts as well as run pebble build.

How it works

The Pebble SDK natively supports JavaScript, thru PebbleKit JS. This is great, however there's a few issues:

  • The SDK uses an ancient JavaScript version, almost ES5 but missing some features.
  • The SDK doesn't support TypeScript, which is a superset of JavaScript that adds types and other features.
  • The SDK doesn't allow you to customize Webpack settings.
  • The SDK doesn't allow you to use many popular npm packages.

This project aims to solve these issues by providing a way to write TypeScript code, and telling the Pebble SDK to only build the C code. We then take the compiled C code, as well as our Webpack-compiled TypeScript code, and chuck it into a PBW file. However, this is not a perfect solution, and there is one major caveat:

  • This only works on Android1. The iOS Pebble app does not support the modern versions of JavaScript that we use. This is a limitation of the Pebble app, and there's nothing we can do about it as we cannot update the Pebble app.

Footnotes

  1. FWIW, I've never actually tried. However, when others in the community have attempted to use modern JS on the iOS app, explosions occur. You could try to get around this by setting Webpack's target to ES5, however then you're missing out on newer JS features at the runtime.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published