smac
Scriptcraft SMA Server controller
Last updated 3 months ago by sitapati .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install smac 
SYNC missed versions from official npm registry.

SMA Controller - Scriptcraft Modular Architecture

Manages dockerised Minecraft servers for developing and deploying Javascript Minecraft plugins written using Scriptcraft and the Scriptcraft Modular Architecture.

Install

npm i -g smac

Run

smac
➜ smac
Version 0.0.4

Usage:
smac <command>

Available commands:
COMMAND DESCRIPTION
start   Start a server
stop    Stop a server
status  Get the status of a server
version Output version information
list    List running SMA servers
inspect Inspect a running server

Terminal

When the logs are streaming - either from the start command or the logs command - you have an interactive terminal that pipes your commands to the server.

This is slightly different from typing directly at the server console of a running server. What you type here is sent to the server over HTTP and executed asynchronously as the Console Sender.

You can execute arbitrary javascript using the js command, for example:

js refresh()

There are two additional commands that the terminal supports:

  • smac - smac stop is supported to allow you to stop the server from the terminal.
  • ts - execute arbitrary TypeScript. The code that follows this command is transpiled to ES5 and sent to the server with js. For example:
ts [1,2,3].map(i => i+1)

Is transpiled to:

;[1, 2, 3].map(function(i) {
    return i + 1
})

Resulting in:

? > (ts [1,2,3].map(i => i+1)) [05:57:40 INFO]: [MinecraftRESTConsole] server remote executes js [1, 2, 3].map(function (i) { return i + 1; });

Generate config

Use the sma-server Yeoman generator to generate a configuration.

The configuration is a package.json file with a smaServerConfig key. This key contains the metadata to configure the server at run-time.

Custom bindings

You can custom bind directories in an smaServerConfig. This is useful when you are working on a package and want to mount it into the server.

Here is an example configuration that I use to work on the MCT1 plugin. I custom bind the mct1 worlds from their local repo checkout.

I have the @magikcraft/op-all plugin installed to give myself op on the server automatically, and I bind the local checkout of the MCT1 plugin into the server to test my changes as I make them.

Note: npm link is a standard way to work on a local check-out of a package, however, this doesn't work by default on a Mac with docker.

Please see this issue about using npm link with SMA on Mac OS. You must change your Docker preferences for it to work.

Using a custom bind is a way to do this without having to configure Docker.

I have this subkey in my server's package.json:

"smaServerConfig": {
  "dockerTag": "latest",
  "port": "25565",
  "serverName": "mct1-dev",
  "bind": [
    {
      "src": "../mct1-worlds",
      "dst": "worlds"
    },
    {
        "src": "../mct1",
        "dst": "scriptcraft-plugins/@magikcraft/mct1"
    }
  ]
}

Development

To dev on this utility, run:

npm i
npm link
npm run dev

This will link your checkout to the global smac command, and start a compiling watcher that transpiles changes and updates the linked binary.

Current Tags

  • 0.4.4                                ...           latest (3 months ago)

32 Versions

  • 0.4.4                                ...           3 months ago
  • 0.4.3                                ...           3 months ago
  • 0.4.2                                ...           3 months ago
  • 0.3.10                                ...           3 months ago
  • 0.4.1                                ...           a year ago
  • 0.4.0                                ...           a year ago
  • 0.3.9                                ...           a year ago
  • 0.3.8                                ...           a year ago
  • 0.3.7                                ...           a year ago
  • 0.3.6                                ...           a year ago
  • 0.3.5                                ...           a year ago
  • 0.3.4                                ...           a year ago
  • 0.3.3                                ...           a year ago
  • 0.3.2                                ...           a year ago
  • 0.3.1                                ...           a year ago
  • 0.3.0                                ...           a year ago
  • 0.2.2                                ...           a year ago
  • 0.2.1                                ...           a year ago
  • 0.2.0                                ...           a year ago
  • 0.1.1                                ...           a year ago
  • 0.1.0                                ...           a year ago
  • 0.0.19                                ...           a year ago
  • 0.0.18                                ...           a year ago
  • 0.0.17                                ...           a year ago
  • 0.0.16                                ...           a year ago
  • 0.0.15                                ...           a year ago
  • 0.0.14                                ...           a year ago
  • 0.0.13                                ...           a year ago
  • 0.0.12                                ...           a year ago
  • 0.0.11                                ...           a year ago
  • 0.0.10                                ...           a year ago
  • 0.0.9                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (19)
Dev Dependencies (23)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |