├── .gitignore ├── prettier.config.js ├── README.md ├── .vscode └── launch.json ├── package.json ├── sample ├── manifest ├── source │ ├── main.js │ └── util │ │ └── api.js ├── components │ ├── MyScene.xml │ └── MyScene.js └── resources │ └── api.json ├── jbs.js ├── input.js ├── index.js ├── pollyfills.js ├── converters.js └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | out.brs 3 | out/* 4 | out/ -------------------------------------------------------------------------------- /prettier.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | printWidth: 100, 3 | parser: 'typescript', 4 | semi: false, 5 | singleQuote: true, 6 | trailingComma: 'es5', 7 | } 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JS to BS 2 | 3 | ### Only a proof of concept! 4 | 5 | Uses babel to convert Javascript syntax to BrightScript syntax. 6 | 7 | `node jbs.js ` 8 | 9 | What have I done... 10 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [{ 7 | "type": "node", 8 | "request": "launch", 9 | "name": "Launch Program", 10 | "program": "${workspaceFolder}/jbs.js", 11 | "args": [ 12 | "./sample" 13 | ] 14 | }] 15 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "js-to-bs", 3 | "version": "0.0.1", 4 | "main": "index.js", 5 | "license": "MIT", 6 | "dependencies": { 7 | "@babel/code-frame": "^7.0.0", 8 | "@babel/core": "^7.1.2", 9 | "@babel/generator": "^7.1.3", 10 | "@babel/parser": "^7.1.3", 11 | "@babel/template": "^7.1.2", 12 | "@babel/traverse": "^7.1.4", 13 | "@willowtreeapps/wist": "^2.0.1", 14 | "brightscript-formatter": "^1.4.0", 15 | "fs-extra": "^7.0.1", 16 | "klaw-sync": "^6.0.0", 17 | "path": "^0.12.7" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /sample/manifest: -------------------------------------------------------------------------------- 1 | # Channel Details 2 | title=HeroGridChannel 3 | subtitle=Roku Sample Channel App 4 | major_version=1 5 | minor_version=1 6 | build_version=1 7 | 8 | # Channel Assets 9 | # mm_icon_focus_hd=pkg:/images/channel-poster_hd.png 10 | # mm_icon_focus_sd=pkg:/images/channel-poster_sd.png 11 | 12 | # Splash Screen + Loading Screen Artwork 13 | # splash_screen_sd=pkg:/images/splash-screen_sd.jpg 14 | # splash_screen_hd=pkg:/images/splash-screen_hd.jpg 15 | # splash_screen_fhd=pkg:/images/splash-screen_fhd.jpg 16 | splash_color=#808080 17 | splash_min_time=0 18 | # Resolution 19 | ui_resolutions=fhd 20 | 21 | confirm_partner_button=1 -------------------------------------------------------------------------------- /sample/source/main.js: -------------------------------------------------------------------------------- 1 | function RunUserInterface(params) { 2 | date = new roDateTime() 3 | print(`App Start Time: ${date.toISOString()}`) 4 | showScene(params) 5 | } 6 | 7 | function showScene(params) { 8 | print(params) 9 | 10 | this.screen = new roSGScreen() 11 | this.port = new roMessagePort() 12 | this.screen.setMessagePort(this.port) 13 | this.screen.createScene('MyScene') 14 | const data = parseJson(ReadAsciiFile('pkg:/resources/api.json')) 15 | this.screen.getGlobalNode().addFields({ 16 | api: data, 17 | }) 18 | this.screen.show() 19 | 20 | while (true) { 21 | msg = wait(0, this.port) 22 | msgType = type(msg) 23 | if ((msgType = 'roSGScreenEvent')) { 24 | if (msg.isScreenClosed()) { 25 | print('Closing app') 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /sample/components/MyScene.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 11 |