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 🙏

© 2025 – Pkg Stats / Ryan Hefner

unity-cli-tools

v1.0.0

Published

A tools for Unity command line development.

Readme

Unity Command line Tools

A TypeScript library for programmatically interacting with Unity Hub and Unity Editor command line interfaces.

Installation

npm install unity-cli-tools

Dual Module Support

This package publishes separate builds for both ES Modules (ESM) and CommonJS (CJS). You can consume it either way:

ESM (Node and bundlers):

import { UnityHub } from "@notask/unity-cli-tools";

CJS:

const { UnityHub } = require("@notask/unity-cli-tools");

Requirements

  • Node.js 20+
  • Unity Hub installed
  • Unity Editor (for editor operations)

Core Concepts

Unity CLI Tools provides two main modules:

  • UnityHub - For interacting with Unity Hub
  • UnityEditor - For interacting with Unity Editor (documentation coming soon)

UnityHub API Reference

Checking Availability

import { UnityHub } from "unity-cli-tools";

// Check if Unity Hub is available
const isAvailable = await UnityHub.isUnityHubAvailable();

Finding Unity Installations

// Get all installed Unity versions
const installations = await UnityHub.getUnityInstallations();
// Returns: { '2022.3.60f1': 'C:/Program Files/Unity/Hub/Editor/2022.3.60f1', ... }

Managing Unity Versions

import { UnityHub, UnityModules } from "unity-cli-tools";

// Install a new Unity version
await UnityHub.addEditor("2022.3.60f1");

// Install with specific modules
await UnityHub.addEditor("2022.3.60f1", undefined, [UnityModules.AndroidBuildSupport, UnityModules.WebGLBuildSupport]);

// Add modules to existing installation
await UnityHub.addModule("2022.3.60f1", [UnityModules.IOSBuildSupport]);

Projects Management

// Get projects from Unity Hub
const projects = await UnityHub.getProjects();
// Returns: [{ name: 'ProjectName', path: '/path/to/project', version: '2022.3.60f1' }, ...]

// Get default projects directory
const defaultDir = await UnityHub.getDefaultProjectsDirectory();

Custom Commands

// Execute any Hub command directly
const result = await UnityHub.execUnityHubCommand(["editors", "-r"]);
console.log(result.stdout);

Available Constants

UnityModules

| Constant | Description | | -------------------------- | ------------------------- | | Documentation | Unity documentation | | AndroidBuildSupport | Android platform support | | AndroidSDKNDKTools | Android SDK/NDK tools | | OpenJDK | Java Development Kit | | IOSBuildSupport | iOS platform support | | TvOSBuildSupport | tvOS platform support | | LinuxBuildSupportMono | Linux Mono support | | LinuxBuildSupportIL2CPP | Linux IL2CPP support | | WebGLBuildSupport | WebGL platform support | | WindowsBuildSupport | Windows platform support | | VuforiaAR | Vuforia AR support | | WindowsBuildSupportMono | Windows Mono support | | LuminBuildSupport | Magic Leap support | | VisualStudioCommunity | Visual Studio integration | | MacBuildSupportMono | macOS Mono support | | MacBuildSupportIL2CPP | macOS IL2CPP support | | UniversalWindowsPlatform | UWP support | | UWPBuildSupportIL2CPP | UWP IL2CPP support | | UWPBuildSupportDotNet | UWP .NET support |

UnityLanguages

| Constant | Description | | -------------------- | --------------------------------- | | Japanese | Japanese language pack | | Korean | Korean language pack | | ChineseSimplified | Simplified Chinese language pack | | ChineseTraditional | Traditional Chinese language pack | | Chinese | Chinese language pack (legacy) |

Configuration

Environment Variables

  • UNITY_HUB_PATH - Custom path to Unity Hub executable

Platform Detection

The library automatically detects and uses the correct paths for:

  • Windows
  • macOS
  • Linux

Examples

Complete Unity Hub Workflow

import { UnityHub, UnityModules } from "unity-cli-tools";

async function manageUnityInstallation() {
  try {
    // Check if hub is available
    const isAvailable = await UnityHub.isUnityHubAvailable();
    if (!isAvailable) {
      console.error("Unity Hub not found");
      return;
    }

    // List installations
    const installations = await UnityHub.getUnityInstallations();
    console.log("Installed versions:", Object.keys(installations));

    // Install WebGL support for specific version
    if (installations["2022.3.60f1"]) {
      await UnityHub.addModule("2022.3.60f1", [UnityModules.WebGLBuildSupport]);
      console.log("WebGL support added");
    }

    // Get recent projects
    const projects = await UnityHub.getProjects();
    console.log(
      "Recent projects:",
      projects.map((p) => p.name)
    );
  } catch (error) {
    console.error("Error in Unity workflow:", error);
  }
}

Advanced Usage

Custom Command Execution

// List all editors with detailed output
const result = await UnityHub.execUnityHubCommand(["editors", "-a"], {
  reject: true, // Throw error on failure
  timeout: 30000, // 30 second timeout
  env: { UNITY_HUB_VERBOSE: "1" }, // Custom environment variables
});

// Process output
const editorList = result.stdout.split("\n").filter((line) => line.includes("Unity Version"));