prepare for using with widChargingStatus
global types are not yet received correctly, but we're close! - use widChargerStatus as first example to make setup work - add github action to compile supplied types/globals on pushesmaster
parent
3cd9c39525
commit
61cc93b0b6
|
|
@ -0,0 +1,25 @@
|
||||||
|
name: Node CI
|
||||||
|
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node-version: [16.x]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node-version }}
|
||||||
|
- name: go to typescript directory
|
||||||
|
run: cd typescript
|
||||||
|
- name: npm ci
|
||||||
|
run: npm ci
|
||||||
|
- name: build types
|
||||||
|
run: npm run build:types
|
||||||
|
|
@ -0,0 +1,145 @@
|
||||||
|
// TODO all of these globals (copied from eslintrc need to be typed at some point)
|
||||||
|
/* "globals": {
|
||||||
|
// Methods and Fields at https://banglejs.com/reference
|
||||||
|
"Array": "readonly",
|
||||||
|
"ArrayBuffer": "readonly",
|
||||||
|
"ArrayBufferView": "readonly",
|
||||||
|
"Bangle": "readonly",
|
||||||
|
"BluetoothDevice": "readonly",
|
||||||
|
"BluetoothRemoteGATTCharacteristic": "readonly",
|
||||||
|
"BluetoothRemoteGATTServer": "readonly",
|
||||||
|
"BluetoothRemoteGATTService": "readonly",
|
||||||
|
"Boolean": "readonly",
|
||||||
|
"console": "readonly",
|
||||||
|
"DataView": "readonly",
|
||||||
|
"Date": "readonly",
|
||||||
|
"E": "readonly",
|
||||||
|
"Error": "readonly",
|
||||||
|
"Flash": "readonly",
|
||||||
|
"Float32Array": "readonly",
|
||||||
|
"Float64Array": "readonly",
|
||||||
|
"fs": "readonly",
|
||||||
|
"Function": "readonly",
|
||||||
|
"Graphics": "readonly",
|
||||||
|
"heatshrink": "readonly",
|
||||||
|
"I2C": "readonly",
|
||||||
|
"Int16Array": "readonly",
|
||||||
|
"Int32Array": "readonly",
|
||||||
|
"Int8Array": "readonly",
|
||||||
|
"InternalError": "readonly",
|
||||||
|
"JSON": "readonly",
|
||||||
|
"Math": "readonly",
|
||||||
|
"Modules": "readonly",
|
||||||
|
"NRF": "readonly",
|
||||||
|
"Number": "readonly",
|
||||||
|
"Object": "readonly",
|
||||||
|
"OneWire": "readonly",
|
||||||
|
"Pin": "readonly",
|
||||||
|
"process": "readonly",
|
||||||
|
"Promise": "readonly",
|
||||||
|
"ReferenceError": "readonly",
|
||||||
|
"RegExp": "readonly",
|
||||||
|
"Serial": "readonly",
|
||||||
|
"SPI": "readonly",
|
||||||
|
"Storage": "readonly",
|
||||||
|
"StorageFile": "readonly",
|
||||||
|
"String": "readonly",
|
||||||
|
"SyntaxError": "readonly",
|
||||||
|
"tensorflow": "readonly",
|
||||||
|
"TFMicroInterpreter": "readonly",
|
||||||
|
"TypeError": "readonly",
|
||||||
|
"Uint16Array": "readonly",
|
||||||
|
"Uint24Array": "readonly",
|
||||||
|
"Uint32Array": "readonly",
|
||||||
|
"Uint8Array": "readonly",
|
||||||
|
"Uint8ClampedArray": "readonly",
|
||||||
|
"Waveform": "readonly",
|
||||||
|
// Methods and Fields at https://banglejs.com/reference
|
||||||
|
"analogRead": "readonly",
|
||||||
|
"analogWrite": "readonly",
|
||||||
|
"arguments": "readonly",
|
||||||
|
"atob": "readonly",
|
||||||
|
"Bluetooth": "readonly",
|
||||||
|
"BTN": "readonly",
|
||||||
|
"BTN1": "readonly",
|
||||||
|
"BTN2": "readonly",
|
||||||
|
"BTN3": "readonly",
|
||||||
|
"BTN4": "readonly",
|
||||||
|
"BTN5": "readonly",
|
||||||
|
"btoa": "readonly",
|
||||||
|
"changeInterval": "readonly",
|
||||||
|
"clearInterval": "readonly",
|
||||||
|
"clearTimeout": "readonly",
|
||||||
|
"clearWatch": "readonly",
|
||||||
|
"decodeURIComponent": "readonly",
|
||||||
|
"digitalPulse": "readonly",
|
||||||
|
"digitalRead": "readonly",
|
||||||
|
"digitalWrite": "readonly",
|
||||||
|
"dump": "readonly",
|
||||||
|
"echo": "readonly",
|
||||||
|
"edit": "readonly",
|
||||||
|
"encodeURIComponent": "readonly",
|
||||||
|
"eval": "readonly",
|
||||||
|
"getPinMode": "readonly",
|
||||||
|
"getSerial": "readonly",
|
||||||
|
"getTime": "readonly",
|
||||||
|
"global": "readonly",
|
||||||
|
"HIGH": "readonly",
|
||||||
|
"I2C1": "readonly",
|
||||||
|
"Infinity": "readonly",
|
||||||
|
"isFinite": "readonly",
|
||||||
|
"isNaN": "readonly",
|
||||||
|
"LED": "readonly",
|
||||||
|
"LED1": "readonly",
|
||||||
|
"LED2": "readonly",
|
||||||
|
"load": "readonly",
|
||||||
|
"LoopbackA": "readonly",
|
||||||
|
"LoopbackB": "readonly",
|
||||||
|
"LOW": "readonly",
|
||||||
|
"NaN": "readonly",
|
||||||
|
"parseFloat": "readonly",
|
||||||
|
"parseInt": "readonly",
|
||||||
|
"peek16": "readonly",
|
||||||
|
"peek32": "readonly",
|
||||||
|
"peek8": "readonly",
|
||||||
|
"pinMode": "readonly",
|
||||||
|
"poke16": "readonly",
|
||||||
|
"poke32": "readonly",
|
||||||
|
"poke8": "readonly",
|
||||||
|
"print": "readonly",
|
||||||
|
"require": "readonly",
|
||||||
|
"reset": "readonly",
|
||||||
|
"save": "readonly",
|
||||||
|
"Serial1": "readonly",
|
||||||
|
"setBusyIndicator": "readonly",
|
||||||
|
"setInterval": "readonly",
|
||||||
|
"setSleepIndicator": "readonly",
|
||||||
|
"setTime": "readonly",
|
||||||
|
"setTimeout": "readonly",
|
||||||
|
"setWatch": "readonly",
|
||||||
|
"shiftOut": "readonly",
|
||||||
|
"SPI1": "readonly",
|
||||||
|
"Terminal": "readonly",
|
||||||
|
"trace": "readonly",
|
||||||
|
"VIBRATE": "readonly",
|
||||||
|
// Aliases and not defined at https://banglejs.com/reference
|
||||||
|
"g": "readonly",
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare const Bangle: {
|
||||||
|
// functions
|
||||||
|
buzz: () => void;
|
||||||
|
drawWidgets: () => void;
|
||||||
|
isCharging: () => boolean;
|
||||||
|
// events
|
||||||
|
on(event: 'charging', listener: (charging: boolean) => void): void;
|
||||||
|
// TODO add more
|
||||||
|
};
|
||||||
|
|
||||||
|
type Widget = {
|
||||||
|
area: 'tr' | 'tl';
|
||||||
|
width: number;
|
||||||
|
draw: () => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
declare const WIDGETS: { [key: string]: Widget };
|
||||||
|
|
@ -5,8 +5,8 @@
|
||||||
"main": "app.js",
|
"main": "app.js",
|
||||||
"types": "app.d.ts",
|
"types": "app.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build:testapp": "tsc ./src/app.ts --outDir ./dist",
|
"build:example": "tsc ../apps/widChargingStatus/widget.ts --outDir ../apps/widChargingStatus/dist",
|
||||||
"build:types": "tsc ./src/bangle.d.ts"
|
"build:types": "tsc ./globals.d.ts"
|
||||||
},
|
},
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Sebastian Di Luzio",
|
"name": "Sebastian Di Luzio",
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
const testString = 'test hehe';
|
|
||||||
console.log(testString);
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
"module": "es2015",
|
"module": "es2015",
|
||||||
"noImplicitAny": true,
|
"noImplicitAny": true,
|
||||||
"target": "es2015",
|
"target": "es2015",
|
||||||
"outDir": "../dist"
|
"outDir": "../dist",
|
||||||
}
|
"isolatedModules": false
|
||||||
|
},
|
||||||
|
"include": ["./globals.d.ts"]
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue