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

@mlightcad/cad-html-exporter-cli

v1.5.6

Published

CLI example: convert DXF/DWG drawings to offline HTML

Readme

@mlightcad/cad-html-exporter-cli

License: MIT npm version

Node.js command-line example that converts a DXF or DWG file into a self-contained offline HTML viewer (same pipeline as the browser Export HTML command).

The CLI drives a headless Chromium instance (Playwright) that runs the same viewer code path as cad-simple-viewer-example, then writes the packaged HTML to disk.

Prerequisites

  • Node.js 20+
  • Network access on first run (Playwright downloads Chromium; fonts load from CDN during export)

From the monorepo root:

pnpm install
pnpm --filter @mlightcad/cad-html-exporter-cli install-browser
pnpm --filter @mlightcad/cad-html-exporter-cli build

Usage

# From the package directory
node dist/cli.js path/to/drawing.dxf

# Or via the bin name (after pnpm link / workspace install)
pnpm exec cad-html-exporter path/to/drawing.dwg -o out/viewer.html

# Chinese UI in the exported HTML
pnpm exec cad-html-exporter drawing.dxf --locale zh -o drawing.html

Options

| Option | Description | |--------|-------------| | -o, --output <path> | Output HTML file (default: input name with .html) | | --locale <code> | Embedded viewer locale (en, zh, …) | | --title <text> | Title in snapshot metadata / <title> | | --no-export-invisible-layers | Exclude off/frozen layer geometry (default: included) | | --initial-view <fit\|current> | Initial view when opening HTML (fit = zoom extents, default) |

How it works

  1. Vite builds runner/dist-runner/ (viewer + workers + viewer-runtime.iife.js).
  2. Playwright serves dist-runner locally and calls window.exportCadToHtml().
  3. The runner uses AcApDocManagerAcApHtmlSnapshotBuilderpackHtml.
  4. The CLI writes the returned HTML string to -o.

The generated HTML opens offline in any browser; Node.js is not required to view it.

Project layout

| Path | Role | |------|------| | src/cli.ts | Commander CLI entry | | src/exportToHtml.ts | Playwright orchestration | | runner/ | Browser export harness (Vite input) | | dist-runner/ | Built runner (created by pnpm build) |