onyx-toolbox
Environment tools for the [Onyx server](https://github.com/MainframeHQ/onyx-server)
Last updated 3 years ago by paul_lecam .
MIT · Original npm · Tarball · package.json
$ cnpm install onyx-toolbox 
SYNC missed versions from official npm registry.

Onyx toolbox

Environment tools for the Onyx server

Prerequisites

Node v8+ with npm.

Installation

npm install --global onyx-toolbox

CLI

Usage
  onyx <command>

Commands
  clean - Clean the environment created by the setup
  help <command> - Information and available flags for the specified command
  reset - Reset the environment, same as clean + setup
  setup - Setup the environment
  start - Start the Onyx server
  status - Display the environment and processes status
  stop - Stop the Onyx server
  swarm <action> - Swarm commands

API

Static configuration

The values of the onyx Object from the package.json file are exposed in the public API.

conf: Conf

The Conf instance holding the dynamic toolbox configuration and local state.

getPath(key: string): string

Returns the path matching the provided key, if set.

Supported keys

  • geth.bin: the geth executable
  • server.bin: the onyx-server executable
  • swarm.bin: the swarm executable
  • swarm.data: the Swarm data folder
  • swarm.git: the go-ethereum git folder
  • swarm.pwd: the Swarm account password file
  • swarm.root: The Swarm folder, holding all the others

setPath(key: string, value: string): void

Sets the path for the specified key. See above for the list of keys used by the toolbox.

setPaths({[key: string]: string}): void

Sets multiple paths. See above for the list of keys used by the toolbox.

resetPaths(): void

Resets the paths used by the toolbox.

isSetup(): boolean

Returns whether the environment is setup or not.

checkGit(): Promise<boolean>

Checks if git is installed in the environment.

checkGo(): Promise<boolean>

Checks if Go is installed in the environment.

gitClone(cwd: string): Promise<string>

Runs git clone in the provided cwd directory to download the supported go-ethereum repository.

gitFetch(cwd: string): Promise<string>

Runs git clone in the provided cwd directory to retrieve the supported go-ethereum branch.

gitFetch(cwd: string): Promise<string>

Runs git fetch in the provided cwd directory. The provided path should be the one of the go-ethereum repository downloaded using gitFetch().

buildBin(cwd: string, name: string): Promise<string>

Builds the binary from the go-ethereum repository provided by the cwd argument and identified by the provided name. Supported names are geth and swarm.

createAccount(): Promise<string>

Creates a new BZZ account and returns its address.

createPassword(password?: string): Promise<void>

Creates a password file containing the provided password or a default one.

getServerStatus(): ?{ pid: number, port: number }

If the Onyx server is running, returns an Object containing the process pid and server port.

getSwarmStatus(): ?{ pid: number }

If Swarm is running, returns an Object containing the process pid.

startSwarm(options = {}): Promise<false | number>

Attempts to start the Swarm process with the provided options. Returns the process pid or false if it fails.

stopSwarm(): Promise<boolean | number>

Attempts to stop the Swarm process. Returns false if the process doesn't seem to be running, true if the process can be killed, or the process pid if it fails.

cleanSwarm(): Promise<void>

Deletes the existing local state and removes the Swarm directory with all its contents.

startServer(options = {}): Promise<false | {pid: number, port: number}>

Starts the Onyx server with the provided options. Returns false if it fails to start the server, or an Object containing the server pid and port.

stopServer(): Promise<boolean | number>

Attempts to stop the Onyx server. Returns false if the process doesn't seem to be running, true if the process can be killed, or the process pid if it fails.

License

MIT.
See LICENSE file.

Current Tags

  • 0.2.0                                ...           latest (3 years ago)

4 Versions

  • 0.2.0                                ...           3 years ago
  • 0.1.1                                ...           3 years ago
  • 0.1.0                                ...           3 years ago
  • 0.0.1                                ...           3 years ago
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 2
Dependencies (10)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |