Skip to content

Create npm package for JavaScript/TypeScript projects #62

@rz1989s

Description

@rz1989s

Goal

Provide npm package for using LUMOS in JavaScript/TypeScript projects without Rust toolchain.

Phase: 6.2 Tooling Ecosystem


Problem

JS/TS developers need Rust installed:

  • ❌ Must install Cargo to use LUMOS
  • ❌ Not idiomatic for JS projects
  • ❌ Slower onboarding

Solution

Publish npm package with WASM or Node binary.

Installation

npm install @getlumos/cli
# or
yarn add @getlumos/cli

Usage

import { generate } from '@getlumos/cli';

await generate('schema.lumos', {
  outputRust: 'src/generated.rs',
  outputTs: 'src/generated.ts',
});

CLI:

npx lumos generate schema.lumos

Implementation Options

Option 1: WASM (Preferred)

  • Compile LUMOS core to WASM
  • Works in Node.js and browsers
  • No platform-specific binaries

Option 2: Native Binaries

  • Ship binaries for each platform
  • Faster than WASM
  • More complex to maintain

Package Structure

@getlumos/cli/
├── dist/
│   ├── index.js        # Main entry
│   ├── cli.js          # CLI binary
│   └── lumos.wasm      # WASM module
├── package.json
└── README.md

Features

  • Generate schemas programmatically
  • CLI via npx lumos
  • Watch mode
  • TypeScript types included

Success Criteria

  • Published to npm as @getlumos/cli
  • Works without Rust installed
  • CLI and programmatic API
  • TypeScript types
  • Documentation

Documentation

  • docs/tools/npm-package.md
  • ROADMAP.md - Mark Phase 6.2 complete ✅

Priority: High
Complexity: Medium-High
Timeline: 5-7 days


📌 Remember: Update ROADMAP.md after completing this issue!

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:ecosystemCross-repo initiatives and ecosystem-wide featuresarea:wasmWASM/browser playground supporthigh-priorityHigh priority taskpublishingPublishing and release taskstype:featureNew feature or functionality

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions