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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@meru2802/nexus-modscript-composer

v2.0.10

Published

Compose multi-layer deployment scripts for NexusEPM agents (L0 → L1 → L2 pipeline)

Readme

@meru2802/nexus-modscript-composer

Compose multi-layer deployment scripts for NexusEPM agents. Takes individual L0 monitoring/collection scripts and produces a composed L1 collection script + L2 deployment wrapper (systemd service on Linux, Scheduled Task on Windows).

Install

npm install @meru2802/nexus-modscript-composer

Usage

import { generateFinalScript } from "@meru2802/nexus-modscript-composer";

const l0Bodies = [tomcatScript, postgresqlScript]; // raw L0 script strings with metadata headers

const result = await generateFinalScript(l0Bodies, {
  platform: "windows",
  templateUrls: {
    l1: "https://nexus-endpoint-desktop-app.s3.ap-south-1.amazonaws.com/l1-l2-templates/l1-windows.ps1.tmpl",
    l2: "https://nexus-endpoint-desktop-app.s3.ap-south-1.amazonaws.com/l1-l2-templates/l2-windows.ps1.tmpl",
  },
  orgId: "acme-corp",
  icebergEndpoint: "https://iceberg.example.com/api/v1/collect",
  agentId: "agent-001",
  authToken: "bearer-token",
  bufferTime: "5m",
  timeout: "10m",
});

console.log(result.l1Script);  // composed L1 collection script
console.log(result.l2Script);  // L2 deployment wrapper
console.log(result.modules);   // ["tomcat", "postgresql"]

Template URLs

| Platform | Layer | URL | |----------|-------|-----| | Linux | L1 | https://nexus-endpoint-desktop-app.s3.ap-south-1.amazonaws.com/l1-l2-templates/l1-linux.sh.tmpl | | Linux | L2 | https://nexus-endpoint-desktop-app.s3.ap-south-1.amazonaws.com/l1-l2-templates/l2-linux.sh.tmpl | | Windows | L1 | https://nexus-endpoint-desktop-app.s3.ap-south-1.amazonaws.com/l1-l2-templates/l1-windows.ps1.tmpl | | Windows | L2 | https://nexus-endpoint-desktop-app.s3.ap-south-1.amazonaws.com/l1-l2-templates/l2-windows.ps1.tmpl |

generateFinalScript(l0ScriptBodies, options)

Parameters

l0ScriptBodies string[] -- Array of raw L0 script contents. Each string must include the full metadata header (# ==== NEXUS MODSCRIPT L0 ==== ... # ==== END METADATA ====) followed by the function body. All L0 scripts must target the same OS_FAMILY as the platform option.

options GenerateOptions:

| Field | Type | Required | Default | Description | |-------|------|----------|---------|-------------| | platform | "linux" \| "windows" | Yes | -- | Target OS. Must match the OS_FAMILY in all L0 scripts. | | templateUrls | { l1: string, l2: string } | Yes | -- | URLs to fetch the L1 and L2 template files. See table above. | | orgId | string | No | "test-client" | Organization ID baked into L1 for Iceberg payloads. | | icebergEndpoint | string | No | "https://iceberg.example.com/api/v1/collect" | URL where L1 POSTs collected data. Written to the L2 env file. | | agentId | string | No | "test-agent-001" | Agent identifier included in Iceberg payloads. | | authToken | string | No | "test-bearer-token" | Bearer token for Iceberg API authentication. | | bufferTime | string | No | "5m" | Wait time after L1 completes before next run. Accepts "30s", "5m", "1h". Linux: OnUnitInactiveSec. Windows: Start-Sleep in wrapper loop. | | timeout | string | No | "10m" | Max L1 execution time before force-kill. Same format as bufferTime. Linux: TimeoutStartSec. Windows: WaitForExit(). | | maxParallel | number | No | 5 | Max parallel L0 modules. Linux: background jobs. Windows: runspace pool size. | | previousServiceId | string | No | "" | Service ID of a previous deployment to tear down before installing the new one. | | writeToDisk | boolean | No | false | Write the composed scripts to timestamped files on disk. | | outputDir | string | No | "./final-scripts" | Directory for writeToDisk output. Resolved relative to process.cwd(). |

Return Value

{
  l1Script: string;    // Composed L1 collection script (all L0 modules merged)
  l2Script: string;    // L2 deployment wrapper (installs L1 as systemd service or Scheduled Task)
  platform: "linux" | "windows";
  modules: string[];   // Names of L0 modules included, e.g. ["tomcat", "postgresql"]
  l1Path?: string;     // File path if writeToDisk was true
  l2Path?: string;     // File path if writeToDisk was true
}

The function validates the composed scripts (structural checks, syntax via bash -n/shellcheck/pwsh, and a dry-run extraction test) before returning. It throws if validation fails.