Saturn Core
Install
cli
npm install -g saturn-core
use in code
npm install --save saturn-core
Usage
CLI
saturn clean ~/your/saturn/path # clean project (include config, run.js, variables)
saturn install ~/your/saturn/path # install npm
saturn run ~/your/saturn/path # run project
saturn run ~/your/saturn/path 2 # run specific block [0-n]
Programmatic
compile
compile.node_modules
: Function (str, project_path)- this function parse npm dependencies
- return [ "some-module" ]
compile.runnable
: Function (project_path)- this function create runnable
- return runnable object
'use strict'; let saturn = ; // some string contains requirelet libstring = "const fs = require('fs');\nconst mysql = require('mysql');" // [ "mysql" ]let node_modules = saturncompile;console // your saturn project pathlet project_path = '~/workspace/basic/python2.satbook'; // create runnable script in your project folderlet runnable = saturncompile;console;
worker
worker.run
: Promise (project_path, target, binder, argv)project_path
: project path in your file systemtarget
: 'all' or '1', '2', .., 'n'binder
:binder.terminal
: Function, callback(spawn_process)binder.data
: Function, callback(process_output)binder.error
: Function, callback(process_error)
worker.clean
: Promise (project_path)- this function remove all except
lib.json
,scripts.json
- this function remove all except
worker.install
: Promise (project_path, binder)project_path
: project path in your file systembinder
:binder.terminal
: Function, callback(spawn_process)binder.data
: Function, callback(process_output)binder.error
: Function, callback(process_error)
connect
connect.run
: Promise (project_path, target, src)project_path
: project path in your servertarget
: 'all' or '1', '2', .., 'n'src
: source object- this function overwrite the project
lib
: lib.json in your projectscripts
: scripts.json in your project
connect.status
: Promise- return running process
connect.stop
: Promise (project_path)- this function stop if project running
connect.disconnect
: Promise- this function remove connection (signout from server)
connect.log
: Function (project_path)
let saturn = ;let connect = saturn; let log = connect ;log; // force stop log // stop and run projectconnect ;