DEV Community

Sebastian Nozzi
Sebastian Nozzi

Posted on

Mini Micro Web-Runner CLI

After some days of work I finished re-working the MMWR (Mini Micro Web-Runner, more details about this in another post) so that it is driven by two powerful and handy (Node.js-based) command-line tools ...

Serve

The first one is mmwr-serve ... which would be used when developing. One just navigates to one's Mini Micro project, issues the aforementioned command, and a local HTTP server is started which "serves" the project to be run on the browser. That's it. If one changes something in the code, just reload and the change should be there.

Using the serve tool

No additional "index.html", CSS or JavaScript files needed. The server tool takes care of all the details behind the scenes.

Package

The second one is mmwr-package ... which one would use to package a Mini Micro project to deploy somewhere, for example itch.io. Same thing: navigate to the Mini Micro project and issue the command. An Archive.zip file is produced with everything needed. Including a whole "sysdisk". More on this below.

Config File

Both tools can make use of a webrunner.config.json file if present. One can specify the HTML page title, one should specify the main ".ms" file of the project, and optionally additional files / folders.

For example:

{
  "pageTitle": "Sliding Puzzle - Mini Micro Web Runner",
  "mainFile": "game.ms",
  "otherEntries": [
    "animation.ms",
    "game-images"
  ],
  ...
}
Enter fullscreen mode Exit fullscreen mode

Sysdisk Entries

One interesting aspect is that one can filter (out) "sysdisk" entries, making the end-product (Archive.zip) slicker than it would be, resulting in faster downloads (from itch.io) and thus quicker start-up times.

Consider this:

{
  "pageTitle": "Mini Micro - LetterShooter (Web Runner)",
  "mainFile": "game.ms",
  "sysDisk": {
    "useOnly": [

      "/sys/pics/Heart.png",
      "/sys/pics/Fighter.png",

      "/sys/sounds/airburst.wav",
      "/sys/sounds/airburst.wav",
      "/sys/sounds/hit.wav",
      "/sys/sounds/ting.wav",
      "/sys/sounds/bling.wav",
      "/sys/sounds/fanfare.wav"
    ]
  }
}
Enter fullscreen mode Exit fullscreen mode

In this case we include only some pics and sounds from the "sysdisk", greatly reducing the final size from 13 Mb to 2.4 Mb.

Final Words

This is the initial version of these tools. Some things might change. But in general this is the direction I want to take the MMWR. It should be both:

  • A handy tool for local development
  • A handy tool for sharing one's creations with others

As mentioned, the new CLI tools cover both these areas.

Top comments (1)

Collapse
 
joestrout profile image
JoeStrout

This is really great stuff! It's so exciting to see Mini Micro projects coming to native web (i.e. without having to go through the Unity web runner)!