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

@lxpack/api

v0.7.0

Published

Programmatic validate/build API for LXPack

Readme

@lxpack/api

Documentation npm version CI License Node.js

Programmatic validate and build API for LXPack courses — the same logic the CLI uses, with structured results for Node integrations (LessonKit, CI, custom exporters).

Part of LXPack. Docs: LessonKit & React hub · Export to LMS.

| Related | Package | |---------|---------| | CLI (wraps this package) | @lxpack/cli | | Schemas & filesystem checks | @lxpack/validators | | ZIP / directory export | @lxpack/scorm |

Install

npm install @lxpack/api

Requires Node.js 18 or 20 (18+).

Usage

Validate

import { validateCourse } from "@lxpack/api";

const result = await validateCourse({
  courseDir: "/path/to/my-course",
  target: "scorm2004", // optional export-specific checks
});

if (!result.ok) {
  for (const issue of result.issues) {
    console.error(`${issue.severity} ${issue.path}: ${issue.message}`);
  }
} else {
  console.log(result.manifest.title);
}

Build

import { buildCourse } from "@lxpack/api";

// ZIP (default)
const zip = await buildCourse({
  courseDir: "/path/to/my-course",
  target: "scorm12",
  output: ".lxpack/course-scorm12.zip", // optional
  outputBaseDir: ".lxpack",
});

if (!zip.ok) throw new Error("build failed");
console.log(zip.outputPath, zip.fileCount);

// Unpacked directory
const dir = await buildCourse({
  courseDir: "/path/to/my-course",
  target: "standalone",
  dir: true,
  output: ".lxpack/standalone",
});

Targets: scorm12, scorm2004, standalone, xapi, cmi5.

Injected assessments

Pass assessment objects instead of reading assessments/*.yaml from disk:

await buildCourse({
  courseDir: "/path/to/my-course",
  target: "scorm12",
  assessments: [
    {
      id: "quiz",
      passingScore: 0.7,
      questions: [
        {
          id: "q1",
          prompt: "Ready?",
          choices: [
            { id: "yes", text: "Yes", correct: true },
            { id: "no", text: "No" },
          ],
        },
      ],
    },
  ],
});

The course manifest must still declare assessments: [{ id: quiz, file: ... }]; the API uses injected data at validate/build time.

LessonKit interchange (lessonkit.json)

v1 interchange requires format: "lessonkit" and version: "1". See lessonkit interchange reference.

packageLessonkit() (v0.5.0)

Package without hand-written course.yaml:

import { packageLessonkit } from "@lxpack/api";

const result = await packageLessonkit({
  interchange: {
    format: "lessonkit",
    version: "1",
    course: { title: "My SPA Course" },
    lessons: [{ id: "main", type: "spa", path: "dist/main" }],
  },
  spaDirs: { main: "/abs/path/to/vite-dist" },
  configDir: "/path/to/project", // optional — loads lxpack.config.json for defaultTarget / output.dir
  target: "scorm12", // optional when configDir (or outputAnchorDir) has lxpack.config.json
  assessments: [/* optional MCQ payloads */],
});

Exports

| Export | Description | |--------|-------------| | validateCourse(options) | Validate course directory; returns { ok, manifest?, issues } | | buildCourse(options) | Validate and package; returns paths and file counts | | packageLessonkit(options) | Materialize interchange + SPA dirs, then build | | ExportTarget | Re-exported from @lxpack/scorm | | CourseManifest, ValidationIssue | Re-exported from @lxpack/validators |

Development

From the monorepo root:

pnpm --filter @lxpack/api build
pnpm --filter @lxpack/api test
pnpm --filter @lxpack/api typecheck

Links

License

Apache-2.0