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

@avocode/monroe-cli

v0.5.0

Published

Avocode Monroe rendering CLI JavaScript wrapper

Downloads

119

Readme

Monroe CLI JS

JavaScript package wrapping native binaries of Avocode Monroe rendering engine CLI.

When included as a NPM dependency, based on configuraton the package automatically downloads all the binaries and installs them to bin/ directory.

Use

TODO

The interface of the package is yet to be specified, but the sample use shows how to get the CLI executable path, how to check the binary and how to run custom command processor.

import { check, spawn_cli } from 'monroe-cli/lib.js'
import { get_exec_path } from 'monroe-cli/config.js'

// just get the exec path
console.log("rendering exec path:", get_exec_path());
// ---------------------------------------------------------------------------


// check the if the executable works
await check()
    .then(output => console.log(`output: ${output}`))
    .catch(err_code => console.log(`error: ${err_code}`))
// ---------------------------------------------------------------------------

// run custom command processor
async function run() {
    return new Promise((resolve, reject) => {
        const exec = get_exec_path()

        const cmd = spawn_cli(exec)

        let output = ""

        cmd.stdout.on('data', (data) => {
            output += String(data)
        });

        cmd.stderr.on('data', (data) => {
            output += String(data)
        });

        cmd.on('close', (code) => {
            if (!code) {
                resolve(output);
            } else {
                reject(code);
            }
        });

        cmd.stdin.write("quit;\n");
        cmd.stdin.end();
    });
}

await run()
    .then(output => console.log(`output: ${output}`))
    .catch(err_code => console.log(`error: ${err_code}`))
// ---------------------------------------------------------------------------

Configuration

The package configuration is modified via several parameters, which can be set using environtment variables, .npmrc file or package.json's config field (in that order of precedence).

In the following list, the value represents a name of the environtment variable, its lowercase version can be used in package.json or .npmrc

If a parameter isn't set explicitly the default value derived from the host system is used.

MONROE_CLI_VERSION

Version of the rendering the CLI is derived from, either semver, git commit ID or latest (for development).

default: latest

MONROE_CLI_TARGET

Target triple describing a platform and architecture of the desired build.

Available targets:

  • x86_64-pc-linux-gnu GLIBC based Linux,
  • x86_64-pc-linux-musl, system based on musl standard C library (e.g Alpine Linux)
  • x86_64-darwin-apple x86 macOS,
  • x86_64-pc-windows MSVC based Windows

default:

  • x86_64-pc-linux-gnu (Linux)
  • x86_64-darwin-apple (macOS)
  • x86_64-pc-windows (Windows)

MONROE_CLI_GL_PROVIDER

Specifies OpenGL system interface.

  • native - WGL for Windows, CGL for macOS (Linux needs to set either glx or osmesa)
  • glx - (Linux only) X Window based OpenGL, allows hardware acceleration.
  • osmesa - (Linux only) Mesa3D sofware implemetaion of OpenGL in off-screen buffer (doesn't require X11 or any other windowowing system)

default:

  • glx (linux)
  • native (macOS)
  • native (Windows)

MONROE_CLI_INSTALL_DEPS

Boolean flag determining whether all the dependencies are to be dowloaded along with the binary.

For macOS and Windows no explicit dependencies are needed, only working installation of the host system.

TODO: link docs how to install dependecies in specific systems

default: false

MONROE_CLI_URL_BASE

URL prefix representing root of the releases tree.

default: https://avocode-rendering-test.s3.amazonaws.com/releases

Releases Tree

Preview of the releases to tree to show its structure (actual data might difer).

releases/
├── latest
│   ├── x86_64-apple-darwin
│   │   └── opengl_native
│   │       └── monroe-cli
│   ├── x86_64-pc-linux-musl
│   │   └── opengl_osmesa
│   │       └── libs
│   │           ├── ld-musl-x86_64.so.1
│   │           ├── libffi.so.7
│   │           ├── libgcc_s.so.1
│   │           ├── libglapi.so.0
│   │           ├── libLLVM-10.so
│   │           ├── liblzma.so.5
│   │           ├── libOSMesa.so.8
│   │           ├── libstdc++.so.6
│   │           ├── libxml2.so.2
│   │           ├── libz.so.1
│   │           └── libzstd.so.1
│   ├── x86_64-pc-linux-gnu
│   │   ├── opengl_glx
│   │   │   └── libs
│   │   │       └── ...
│   │   └── opengl_osmesa
│   │       ├── libs
│   │       │   ├── ld-linux-x86-64.so.2
│   │       │   ├── libc.so.6
│   │       │   ├── libdl.so.2
│   │       │   ├── libedit.so.0
│   │       │   ├── libffi.so.7
│   │       │   ├── libgcc_s.so.1
│   │       │   ├── libglapi.so.0
│   │       │   ├── libicudata.so.68
│   │       │   ├── libicuuc.so.68
│   │       │   ├── libLLVM-11.so
│   │       │   ├── liblzma.so.5
│   │       │   ├── libm.so.6
│   │       │   ├── libncursesw.so.6
│   │       │   ├── libOSMesa.so.8
│   │       │   ├── libpthread.so.0
│   │       │   ├── libstdc++.so.6
│   │       │   ├── libxml2.so.2
│   │       │   ├── libz.so.1
│   │       │   └── libzstd.so.1
│   │       └── monroe-cli
│   └── x86_64-pc-windows
│       └── opengl_native
│           ├── libs
│           │   └── icuuc62.dll
│           └── monroe-cli.exe
└── v1.2.3
    ├── x86_64-apple-darwin
    │   └── opengl_native
    │       └── monroe-cli
    ├── x86_64-pc-linux-gnu
    │   ├── opengl_glx
    │   │   └── libs
    │   │       └── ...
    │   └── opengl_osmesa
    │       ├── libs
    │       │   ├── ld-linux-x86-64.so.2
                        .
                        .
    │       │   └── libzstd.so.1
    │       └── monroe-cli
    ├── x86_64-pc-linux-musl
    │   └── opengl_osmesa
    │       └── libs
    │           ├── ld-musl-x86_64.so.1
                    .
                    .
    │           └── libzstd.so.1
    └── x86_64-pc-windows
        └── opengl_native
            ├── libs
            │   └── icuuc62.dll
            └── monroe-cli.exe