Socket
Book a DemoInstallSign in
Socket

@avocode/monroe-cli

Package Overview
Dependencies
Maintainers
15
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@avocode/monroe-cli

Avocode Monroe rendering CLI JavaScript wrapper

latest
npmnpm
Version
0.5.0
Version published
Maintainers
15
Created
Source

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

FAQs

Package last updated on 09 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts