npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

smac

v0.4.4

Published

Scriptcraft SMA Server controller

Downloads

50

Readme

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.