You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The BRS project is published as a `node` package, so use `npm`:
37
37
38
38
```shell
39
-
$ npm install -g brs
39
+
$ npm install -g @rokucommunity/brs
40
40
```
41
41
42
42
## Usage
43
+
43
44
This repo provides the `brs` executable, which operates in two ways.
44
45
45
46
### REPL
47
+
46
48
An interactive BrightScript REPL (Read-Execute-Print Loop) is available by running `brs` with no arguments, e.g.:
47
49
48
-
```
50
+
```shell
49
51
$ brs
50
52
brs>?"Dennis Ritchie said ""Hello, World!"""
51
53
Dennis Ritchie said "Hello, World!"
52
54
```
53
55
54
-
Quit by entering`^D` (Control-D).
56
+
Quit by pressing`^D` (Control-D) or executing `exit`.
55
57
56
58
### Executing a file
59
+
57
60
BRS can execute an arbitrary BrightScript file as well! Simply pass the file to the `brs` executable, e.g.:
58
61
59
-
```
62
+
```shell
60
63
$ cat hello-world.brs
61
64
?"Dennis Ritchie said ""Hello, World!"""
62
65
@@ -65,30 +68,45 @@ Dennis Ritchie said "Hello, World!"
65
68
```
66
69
67
70
## Sure, but why?
71
+
68
72
The [Roku](https://roku.com) series of media streaming devices are wildly popular amongst consumers, and several [very](https://netflix.com)[popular](https://hulu.com)[streaming](https://amazon.com/primevideo)[services](https://crackle.com) 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.
69
73
70
74
## So can I use this to watch TV without a Roku?
75
+
71
76
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.
72
77
73
78
## Building from source
79
+
74
80
The BRS project follows pretty standard `node` development patterns, with the caveat that it uses `yarn` for dependency management.
75
81
76
82
### Prerequisites
83
+
77
84
BRS builds (and runs) in `node`, so you'll need to [install that first](https://nodejs.org).
This project is written in TypeScript, so it needs to be compiled before it can be executed. `npm run build` compiles files in`src/` into JavaScript and TypeScript declarations, and puts them in`lib/` and `types/` respectively.
93
111
94
112
```shell
@@ -102,12 +120,15 @@ index.d.ts (and friends)
102
120
```
103
121
104
122
Alternatively, you can run the build step in"watch" mode. This will run `npm run build`for you automatically, every time it detects source file changes:
123
+
105
124
```shell
106
125
$ npm run watch
107
126
```
127
+
108
128
This is often useful fortesting that local changes workin your BrightScript project, without having to run `npm run build` over and over.
109
129
110
130
#### Testing
131
+
111
132
Tests are written in plain-old JavaScript with [Facebook's Jest](http://facebook.github.io/jest/), and can be run with the `test` target:
112
133
113
134
```shell
@@ -119,10 +140,11 @@ $ npm run test
119
140
Note that only test files ending in `.test.js` will be executed by `yarn test`.
120
141
121
142
#### Cleaning
143
+
122
144
Compiled output in `lib/` and `types/` can be removed with the `clean` target:
123
145
124
146
```shell
125
-
$ yarn clean
147
+
$ npm run clean
126
148
127
149
$ ls lib/
128
150
ls: cannot access 'lib': No such file or directory
@@ -131,13 +153,6 @@ $ ls types/
131
153
ls: cannot access 'types': No such file or directory
132
154
```
133
155
134
-
#### All Together
135
-
Thanks to the [npm-run-all](https://www.npmjs.com/package/npm-run-all) package, it's trivially easy to combine these into a sequence of tasks without relying on shell semantics:
136
-
137
-
```shell
138
-
$ yarn run-s clean build test
139
-
```
140
-
141
156
## Documentation
142
157
143
-
For the most part, `brs` attempts to emulate BrightScript as closely as possible. However, there are certain implementation gaps. Also, in the spirit of unit testing, there are a few extensions that will help with testing. All of our documentation for APIs, extensions, gaps, and more is hosted on our docs site, [hulu.github.io/roca](https://hulu.github.io/roca).
158
+
For the most part, `brs` attempts to emulate BrightScript as closely as possible. However, as a work in progress, there are certain implementation gaps, please refer to the [BrightScript language reference](https://developer.roku.com/docs/references/brightscript/language/brightscript-language-reference.md) and report an issue for any gaps found. Also, in the spirit of unit testing, there are a few extensions that will help with testing. All of our documentation for APIs, extensions, gaps, and more is hosted on our docs site, [hulu.github.io/roca](https://hulu.github.io/roca).
0 commit comments