JSPM

  • Created
  • Published
  • Downloads 411
  • Score
    100M100P100Q92027F
  • License MIT

a runtime interface

Package Exports

  • runtime
  • runtime/lib/utils

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (runtime) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

npm downloads NPM version build

its runtime!

The project is parent of gulp-runtime. progressed.io


**implementation state**: young, using *Bigfoot* diapers

The aim of the project is to provide an easy and unopinionated container to develop runtime interfaces. That being a CLI or something completely different (http.Server, readline.Interface, etc). There should be an entry event for that "runtime" and the idea is just to hook pre-defined commands to that "runtime".

This way, one would define a custom command, which associates that to a function via the runtime interface. The interface should provide a flexible way to set and get commands and give a hook to parse command properties thus maintain the housekeeping for that case.

Only one use-case will be built-in by default, a runtime CLI. For this case, command line completion of file paths, custom commands and support for command aliasing should be given.

After that, you can do pretty much whatever you want with it.

On the gulp-runtime repo I'm working on that cli feature for gulp so go check it out.

install

npm install runtime

use case: with gulp

 // Your favourite gulpfile.js
 var runtime = new require('runtime').create('gulp');

At runtime, when you want to see the prompt, press enter.

[13:07:50] Starting 'default'...
[13:07:50]  > default
[13:07:50] Finished 'default' after 800 μs
 > gulp

The prompt by it self does nothing, but if you wrote a custom command

runtime.set('yeeeha', function(){

  console.log('Start dancing!')
});

Life changed

> gulp yeeeha
Start dancing!
> gulp

Missing some better docs, I know. For now you can look at the original project documentaion.

TODO

  • Write tests.
  • API documentation.
  • Support standard shell behavior (Ctrl+L, Ctrl+C, history, etc.).
    • readline to the rescue. It even provides completion options!
  • Command completion.
  • Register custom runtime commands.

NPM

License

LICENSE