BangleApps/typescript/README.md

34 lines
1.2 KiB
Markdown
Raw Normal View History

2022-07-20 14:23:38 +00:00
# Bangle.ts
2022-07-20 14:23:38 +00:00
A generic project setup for compiling apps from Typescript to Bangle.js ready, readable JavaScript.
2022-07-21 10:30:15 +00:00
The types are now automatically generated by a script (see below), although they are still a work-in-progress.
## Compilation
Install [npm](https://www.npmjs.com/get-npm) and node.js if you haven't already. We recommend using a version manager like nvm, which is also referenced in the linked documentation.
Make sure you are using node version 16 by running `nvm use 16` and npm version ^8 by running `npm -v`. If the latter version is incorrect, run `npm i -g npm@^8`.
2021-12-10 19:52:17 +00:00
After having installed npm for your platform, open a terminal, and navigate into the `/typescript` folder. Then run:
```
npm ci
```
to install the project's build tools, and:
```
npm run build
```
2022-07-20 14:23:38 +00:00
To build all Typescript apps and widgets. The last command will generate the `app.js` files containing the transpiled code for the Bangle.js.
2022-07-21 10:30:15 +00:00
## Generating types
To generate the types, ensure this repository and [Espruino](https://github.com/espruino/Espruino) are in the same folder. From the Espruino folder run:
2022-07-20 14:23:38 +00:00
```
2022-07-21 10:30:15 +00:00
node scripts/build_types.js
2022-07-20 14:23:38 +00:00
```
2022-07-21 10:30:15 +00:00
This will update the file in `types/main.d.ts`.