0.7.1 • Published 7 years ago

saturn-core v0.7.1

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

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)
  • 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 system
    • target: '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
  • worker.install: Promise (project_path, binder)
    • project_path: project path in your file system
    • binder:
      • 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 server
    • target: 'all' or '1', '2', .., 'n'
    • src: source object
      • this function overwrite the project
      • lib: lib.json in your project
      • scripts: 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

7 years ago

0.7.0

7 years ago

0.6.2

7 years ago

0.6.1

7 years ago

0.6.0

7 years ago

0.5.3

7 years ago

0.5.2

7 years ago

0.5.1

7 years ago

0.5.0

7 years ago

0.4.5

7 years ago

0.4.4

7 years ago

0.4.3

7 years ago

0.4.2

7 years ago

0.4.1

7 years ago

0.4.0

7 years ago

0.3.3

7 years ago

0.3.2

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago