No description, website, or topics provided.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist
docs
src
test
webpack
.babelrc
.eslintrc.yml
.gitignore
.npmignore
.travis.yml
README.md
_config.yml
esdoc.json
karma.conf.js
license.md
package-lock.json
package.json
release_notes_0.1.0.md
run.sh
webpack.config.js

README.md

Hyperty Runtime Core

Build status

Master Develop
Build Status Build Status

Note

In order to speed up the installation process, we have removed the first verification of global modules, so, if you want to install this repository, you should globally install this module:

npm install -g karma-cli

Overview

This repository contains the source code and associated documentation of the core components required to support the deployment and execution of Hyperties in user devices or in network servers. The full specification is provided here.

The Hyperty Runtime architecture follows a security by design approach where different types of components are executed in isolated sandboxes. Thus, components downloaded from a specific Service Provider are executed in sandboxes that are different from the sandboxes used to execute components downloaded from another service provider. Communication between components running in different sandboxes is only possible through messages exchanged through a Message Bus functionality provided by the Hyperty Runtime Core Sandbox. On the other hand, and according to the ProtoOFly concept, the protocol stub is executed in isolated sandbox and provides the bridge for the Hperty Runtime to communicate with associated Service Provider.

Hyperty Core Runtime components are platform agnostic and are to be included in platform specific Hyperty Runtimes, like Web Browsers and Nodejs based platforms.

The detailed specification of the Hyperty Runtime Core is provided here and the full reTHINK Framework is provided here.

User View

How to include the Hyperty Runtime Core in other Projects

How to include this repository in other runtime platforms, like dev-runtime-browser or dev-runtime-node;

Install the runtime-core like a npm module;

npm install github:rethink-project/dev-runtime-core#master --save

Browser Environment

import {Sandbox, SandboxRegistry, SandboxType} from 'runtime-core/dist/sandbox'
import MiniBus from 'runtime-core/dist/minibus';

console.log('Sandbox: ', Sandbox, SandboxRegistry);
console.log('MiniBus: ', MiniBus);

Nodejs Environment

This code, probably, needs to be updated

var Sandbox = require('runtime-core').sandbox;
var MiniBus = require('runtime-core').minibus;

console.log('Sandbox: ', Sandbox);
console.log('MiniBus: ', MiniBus);

if you find some issues, please submit them into the respective repository;


Developer view

Setup Environment

To install the runtime-core repository in your machine, you can clone the github and run the following command;

# install all the dependencies
npm install

Issues

if you have some trouble with the environment, you can open an issue here;

Javascript Environment

JavaScript code should be written in ES6. There are direct dependencies from nodejs and npm, these can be installed separately or in conjunction with nvm

Logging System

To improve the "spam" of log in the console we are using a log system with allow us define by each module one level of log; You can access this configuration here and update it;

A little explanation about the log level; We have the same as console, but instead of console we should use:

  • log.trace(msg) - 0
  • log.debug(msg) or log.log(msg) - 1
  • log.info(msg) - 2
  • log.warn(msg) - 3
  • log.error(msg) - 4

log.setLevel(level, [persist]) method.

This disables all logging below the given level, so that after a log.setLevel("warn") call log.warn("something") or log.error("something") will output messages, but log.info("something") will not.

the level could be:

  • As a string, like 'error' (case-insensitive) ← for a reasonable practical balance
  • As a numeric index from 0 (trace) to 5 (silent) ← deliciously terse, and more easily programmable (...although, why?)

Dependencies

  • nodejs

  • npm

  • karma - Make the communication between unit test tool and jenkins. See more on karma

  • mocha - Unit test tool. See more on http://mochajs.org

Code Style and Hinting

On the root directory you will find .eslintrc.yml based on the google style code without some restrictions, this file are helpers to maintain syntax consistency (this could be changed if we understand), it signals syntax mistakes and makes the code equal for all developers.

  • eslint - Maintain JavaScript Code Style

All IDE's and Text Editors can handle these tools.

# to check if the code is aligned with the style code
npm run test:lint

Documentation

To generates api documentation, check here;

Unit Testing

Unit testing can be launched manually with karma start. The tool to do the tests is the chaijs, with expect;

Karma

if you have some problems starting the karma tests, try running this commands for the following order:

  1. npm uninstall karma karma-browserify karma-mocha karma-mocha-reporter karma-chrome-launcher -g

  2. npm install karma-cli -g

  3. npm install

Note

This repository is ready to start working on development of runtime-core. The code will go to the src folder. The unit tests will be on test folder, following the name standard .spec.js


Gulp Tasks

Documentation

# Generate all the associated to the runtime core;
npm run build:doc

Generate all documentation associated to runtime core;

  • if you run gulp doc the documentation based on jsdoc3 will be generated on folder docs/jsdoc and you can interact;

    gulp doc deprecated

  • if you run gulp api the documentation is generate based on docs/api/ html files, and converted to markdown;

    gulp api deprecated

  • if you run gulp docx should be generated an .docx file, but this process should be optimized, is not working very well;

    gulp docx deprecated

License

The license text will be added to all files after it build

To add the license text to all files in src folder;

gulp license deprecated

Dist

To distribute the runtime-core, you can make a distribution file.

Run the command:

# make a build of core components to be used for development; The files could be a little large because include the sourceMaps;
npm run build:dev

# make a build of core components to be used form production;
npm run build:prod