0.7.1 • Published 9 years ago
saturn-core v0.7.1
Saturn Core
Install
cli
npm install -g saturn-coreuse in code
npm install --save saturn-coreUsage
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 = require('saturn-core');
// some string contains require
let libstring = "const fs = require('fs');\nconst mysql = require('mysql');"
// [ "mysql" ]
let node_modules = saturn.compile.node_modules(libstring);
console.log(node_modules)
// your saturn project path
let project_path = '~/workspace/basic/python2.satbook';
// create runnable script in your project folder
let runnable = saturn.compile.runnable(project_path);
console.log(runnable);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 = require('saturn-core');
let connect = saturn.connect('http://host', 'user', 'password');
let log = connect.log('/examples/server/express-api-server.satbook')
.on('data', (json_data)=> {
// when log received.
});
log.close(); // force stop log
// stop and run project
connect.stop('/examples/server/express-api-server.satbook')
.then(()=> connect.run('/examples/server/express-api-server.satbook', 'all'))
.then(()=> connect.disconnect());0.7.1
9 years ago
0.7.0
9 years ago
0.6.2
9 years ago
0.6.1
9 years ago
0.6.0
9 years ago
0.5.3
9 years ago
0.5.2
9 years ago
0.5.1
9 years ago
0.5.0
9 years ago
0.4.5
9 years ago
0.4.4
9 years ago
0.4.3
10 years ago
0.4.2
10 years ago
0.4.1
10 years ago
0.4.0
10 years ago
0.3.3
10 years ago
0.3.2
10 years ago
0.3.1
10 years ago
0.3.0
10 years ago
0.2.2
10 years ago
0.2.1
10 years ago
0.2.0
10 years ago
0.1.5
10 years ago
0.1.4
10 years ago
0.1.3
10 years ago
0.1.2
10 years ago
0.1.1
10 years ago
0.1.0
10 years ago