Home

STB single page application framework

NPM version Dependencies Status Gitter

Provides development environment and base components in a form of CommonJS modules for set-top box software production.

This framework is targeted on the client side and requires a building stage with Webpack or Browserify.

Getting Started

Node.js and NPM should be installed beforehand. Please follow the official instruction.

stb is available as an npm package and should be installed globally:

npm install -g stb

In Linux this can be done as a root:

sudo npm install -g stb

Usage

Create a new folder for your project and move to it:

mkdir myapp
cd myapp

Run the generator from within the new folder:

stb init

This will create all necessary files and folders (with smart conflict resolution mechanism in case there are already some files in the current directory) and install all necessary package dependencies.

To start working with a project it's necessary to make initial build and start all servers:

stb serve

General way of usage:

stb <command> [options]

Full list of available commands:

Name Description
doc open STB documentation in the default web browser
init initial creation of all necessary files and folders
serve main entry point - rebuild everything, start all watchers and servers
develop run all development tasks
release run all production tasks
lint analyse JavaScript code for potential errors and problems
static serve files in the build directory
proxy proxy js code execution from a desktop browser to STB
logger WebSocket server to translate log messages from STB to a desktop console
weinre WEb INspector REmote debugger server
img execute all the tasks to remove and copy all images
jade compile all HTML files from Jade sources
less compile all Less files into a set of css files with maps
webpack compile all CommonJS modules into a single js file

After the stb serve command the start page should open in the default browser. This page should be accessible remotely on the STB device via address.

It's possible to suppress a browser opening with

stb serve --no-open

In case remote access to STB device is enabled and configured in application ./config/ssh.js it's possible to activate one of the profiles:

stb serve --ssh [profile_name]

where profile_name is one of the following:

Name Description
root open index file in the root of the started HTTP server
develop (default) open debug develop build
release open final release build

For example command stb serve --ssh will build and serve as usual but also connect to the STB device by SSH protocol and starts there a web browser with the debug version of application.

It's also possible to customize some commands execution with additional flags e.g. --clean, --develop, --release and so on. Full list of available options can be provided by the stb application:

stb --help
stb <command> --help

At runtime the development mode has a set of useful function available via keyboard shortcuts:

Keys Description
Numpad . reload the page CSS
Numpad 0 reload the page in the current resolution
Numpad 1 reload the page in NTSC
Numpad 2 reload the page in PAL
Numpad 3 reload the page in 720p
Numpad 4 reload the page in 1080p
Numpad 5 draw debug grid with indicators
Numpad 6 stress-testing based on gremlins.js for the emulation mode
Numpad 7 SpyJS tracing/debugging/profiling activation and deactivation
Numpad 8 FireBug Lite console activation

Illustrations of most approaches and components can be found in the demo application.

Help files generated from JSDocs comments in framework modules are available online.

Structure

Path Description
app contains all framework JavaScript modules and associated Less files
bin main command-line script available globally
config base config files for all servers
lib modules required to framework work
tasks gulp tasks to provide all the functionality
test QUnit tests files (units and static)
tpl a new application directory structure and base files

Technologies

Contribution

If you have any problem or suggestion please open an issue here. Pull requests are welcomed with respect to the JavaScript Code Style and included ESLint rules.

License

stb is released under the GPL-3.0 License.