ocaml-npm-publishing

Publish OCaml libraries to npm with js_of_ocaml and wasm_of_ocaml builds.

46|6|Updated Jan 28, 2026
One-click install
npx skills add https://github.com/aresbit/MateBot --skill ocaml-npm-publishing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ocaml-npm-publishing
Source: https://github.com/aresbit/MateBot/tree/main/skills/ocaml/ocaml-npm-publishing
Command: npx skills add https://github.com/aresbit/MateBot --skill ocaml-npm-publishing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Publishing OCaml libraries to npm with browser-ready builds, enabling seamless web deployment of OCaml code via js_of_ocaml and wasm_of_ocaml.

Core Features & Use Cases

  • Browser-ready OCaml libraries built with js_of_ocaml/wasm_of_ocaml.
  • Two-branch workflow (main for source; npm branch for packaged assets) to publish npm packages.
  • Dune-based build rules for library and browser artifacts, with copy/install steps for npm packaging.

Quick Start

Steps:

  • Build on main: dune build @install.
  • Switch to the npm branch and run the release script to copy assets.
  • Update package.json version and run npm publish.

Frequently Asked Questions about ocaml-npm-publishing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I publish an OCaml library to npm for browser use?

To publish an OCaml library to npm for browser use, use a two-branch workflow: build source on the main branch with Dune, switch to an npm branch, run a release script to copy browser-ready artifacts, update package.json, and run npm publish.

Can I compile OCaml to WebAssembly and JavaScript for npm packaging?

Yes, you can compile OCaml to both WebAssembly and JavaScript for npm packaging by utilizing the wasm_of_ocaml and js_of_ocaml toolchains to generate browser-ready artifacts.

Do I need Dune to build OCaml libraries for npm deployment?

Yes, Dune is required to build OCaml libraries for npm deployment, providing the build rules for library and browser artifacts along with copy and install steps for packaging.

What is the two-branch workflow for publishing OCaml packages to npm?

The two-branch workflow for publishing OCaml packages to npm maintains source code on the main branch and packaged browser-ready assets on a separate npm branch containing package.json and a release script to copy built artifacts.

Does js_of_ocaml work with Dune for bundling OCaml web artifacts?

Yes, js_of_ocaml works with Dune for bundling OCaml web artifacts, serving as a required toolchain alongside wasm_of_ocaml to compile OCaml code into browser-ready JavaScript and WebAssembly formats.

Why do I need a separate npm branch for OCaml browser packages?

A separate npm branch is needed for OCaml browser packages to isolate the packaged JavaScript and WebAssembly artifacts, package.json, and release scripts from the source code maintained on the main branch.