BRS: Off-Roku BrightScript
An interpreter for the BrightScript language that runs on non-Roku platforms.
The BRS project is published as a
node package, so use
$ npm install -g brs
yarn if that's your preference:
$ yarn global add brs
This repo provides the
brs executable, which operates in two ways.
An interactive BrightScript REPL (Read-Execute-Print Loop) is available by running
brs with no arguments, e.g.:
$ brs brs> ?"Dennis Ritchie said ""Hello, World!""" Dennis Ritchie said "Hello, World!"
Quit by entering
Executing a file
BRS can execute an arbitrary BrightScript file as well! Simply pass the file to the
brs executable, e.g.:
$ cat hello-world.brs ?"Dennis Ritchie said ""Hello, World!""" $ brs hello-world.brs Dennis Ritchie said "Hello, World!"
Sure, but why?
The Roku series of media streaming devices are wildly popular amongst consumers, and several very popular streaming services offer Channels for the Roku platform. Unfortunately, Roku chanels must be written in a language called BrightScript, which is only executable directly on a Roku device. BRS hopes to change that by allowing Roku developers to test their code on their own machines, thus improving the quality of their channels and the end-user's experience as a whole.
So can I use this to watch TV without a Roku?
Nope! The BRS project currently has no intention of emulating the Roku user interface, integrating with the Roku store, or emulating content playback. In addition to likely getting this project in legal trouble, that sort of emulation is a ton of work. BRS isn't mature enough to be able to sustain that yet.
Building from source
The BRS project follows pretty standard
node development patterns, with the caveat that it uses
yarn for dependency management.
BRS builds (and runs) in
node, so you'll need to install that first.
Once that's ready, install yarn. Installing it with
npm is probably the simplest:
$ npm install -g yarn
Clone this repo:
$ git clone https://github.com/sjbarag/brs.git
Install dependencies:$ yarn install # or just `yarn`
PATH:$ yarn link
The build-test-clean dance
This project is written in TypeScript, so it needs to be compiled before it can be executed.
yarn build compiles files in
$ yarn build$ ls lib/index.js$ ls types/index.d.ts
$ yarn test# tests start running
Note that only test files ending in
.test.js will be executed by
Compiled output in
types/ can be removed with the
$ yarn clean$ ls lib/ls: cannot access 'lib': No such file or directory$ ls types/ls: cannot access 'types': No such file or directory
Thanks to the npm-run-all package, it's trivially easy to combine these into a sequence of tasks without relying on shell semantics:
$ yarn run-s clean build test