first draft: does not export to correct path yet

pull/1052/head
Sebastian Di Luzio 2021-12-07 21:38:09 +01:00
parent a599c0400c
commit 39c3a11d9f
6 changed files with 96 additions and 0 deletions

2
typescript/sharedLib/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
node_modules/
!package-lock.json

View File

@ -0,0 +1,27 @@
# BangleTS
A generic project setup for compiling apps from Typescript to Bangle.js ready, readable Javascript.
It includes types for *some* of the modules and globals that are exposed for apps to use.
The goal is to have types for everything, but that will take some time. Feel free to help out by contributing!
## Using the types
TODO
## Compilation
Install [npm](https://www.npmjs.com/get-npm) if you haven't already.
Make sure you are using version ^8 by running `npm -v`. If the version is incorrect, run `npm i -g npm@^8`.
After having installed npm for your platform, open a terminal, and navigate into the `/typescript/sharedLib` folder. Then run:
```
npm ci
```
to install the project's build tools, and:
```
npm run build:app pathToYourApp.ts
```
To build your app. The last command will generate the `app.js` file containing the transpiled code for the BangleJS.

37
typescript/sharedLib/package-lock.json generated Normal file
View File

@ -0,0 +1,37 @@
{
"name": "banglets",
"version": "0.1.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "banglets",
"version": "0.1.0",
"license": "MIT",
"devDependencies": {
"typescript": "^4.5.2"
}
},
"node_modules/typescript": {
"version": "4.5.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.2.tgz",
"integrity": "sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=4.2.0"
}
}
},
"dependencies": {
"typescript": {
"version": "4.5.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.2.tgz",
"integrity": "sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw==",
"dev": true
}
}
}

View File

@ -0,0 +1,20 @@
{
"name": "bangle.ts",
"version": "0.1.0",
"description": "Typescript configuration and typings for Bangle.js",
"main": "app.js",
"types": "app.d.ts",
"scripts": {
"build:testapp": "tsc src/app.ts",
"build:types": "tsc src/bangle.d.ts",
"build:app": "tsc"
},
"author": {
"name": "Sebastian Di Luzio",
"email": "sebastian@diluz.io"
},
"license": "MIT",
"devDependencies": {
"typescript": "^4.5.2"
}
}

View File

@ -0,0 +1,2 @@
const testString = 'test hehe';
console.log(testString);

View File

@ -0,0 +1,8 @@
{
"compilerOptions": {
"module": "es2015",
"noImplicitAny": true,
"target": "es2015",
"outDir": "../dist"
}
}