ocaml-npm-publishing

Publish OCaml libraries to npm for browser targets using js_of_ocaml and wasm_of_ocaml.

35|9|Updated Dec 25, 2025
One-click install
npx skills add https://github.com/avsm/ocaml-claude-marketplace --skill ocaml-npm-publishing-avsm
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ocaml-npm-publishing
Source: https://github.com/avsm/ocaml-claude-marketplace/tree/main/plugins/ocaml-dev/skills/ocaml-npm-publishing
Command: npx skills add https://github.com/avsm/ocaml-claude-marketplace --skill ocaml-npm-publishing-avsm

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Publishing OCaml to npm via js_of_ocaml and wasm_of_ocaml. Use when discussing browser targets, JavaScript compilation, WASM output, npm packages, or the two-branch workflow.

Core Features & Use Cases

  • NPM publishing workflow for OCaml libraries with browser bindings through js_of_ocaml and wasm_of_ocaml
  • Dune build rules, branch structure, and packaging of browser assets for npm distribution
  • Templates and scripts for generating package.json and release.sh, plus guidance for the npm branch workflow

Quick Start

Follow the npm publishing workflow to build on main, switch to the npm branch, and run the release script to publish to npm.

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 the browser?

To publish an OCaml library to npm for the browser, compile your code using js_of_ocaml and wasm_of_ocaml, then use dune build rules and a release script to automate packaging and publishing to the npm registry.

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

The two-branch workflow for npm publishing involves building your OCaml library on the main branch, switching to a dedicated npm branch, and running a release script to package browser assets and publish to npm.

Can I use dune to package OCaml code for JavaScript distribution?

Yes, you can use dune to package OCaml code for JavaScript distribution by defining build rules that compile with js_of_ocaml and generate the required package.json and release scripts for npm.

Do I need wasm_of_ocaml to publish OCaml packages to npm?

You do not strictly need wasm_of_ocaml to publish to npm, as the workflow also supports js_of_ocaml for JavaScript compilation, but using both allows you to target multiple browser environments.

What templates are required to automate OCaml npm releases?

Automating OCaml npm releases requires templates to generate a package.json file and a release.sh script, which together handle the packaging of browser assets and the publishing process.