• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

RobotWebTools / rclnodejs / 27249695817
91%

Build:
DEFAULT BRANCH: develop
Ran 10 Jun 2026 03:04AM UTC
Jobs 1
Files 65
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

10 Jun 2026 02:47AM UTC coverage: 91.22%. Remained the same
27249695817

push

github

web-flow
ESM Migration Phase 3 — dual ESM + CommonJS build (#1531)

### Build system
- **Add `tsup` dual build** (`tsup.config.js`, new): authored source stays native ESM but tsup now emits both formats into a flat `dist/` — `dist/index.{js,cjs}`, `dist/web.{js,cjs}`, `dist/server.{js,cjs}`, `dist/rosocket.{js,cjs}`. CJS-island generators (`rosidl_gen/*`, `rostsd_gen/*`) are kept external so their `__dirname`-relative template lookups stay valid; a CJS footer collapses the lone `export default` to `module.exports` so `require('rclnodejs')` works without `.default`.
- **`package.json`**: `main` → `./dist/index.cjs`, added `module` → `./dist/index.js`; every `exports` subpath (`.`, `./web`, `./web/server`, `./rosocket`) now has `import`/`require`/`default` conditions pointing at the dual `dist/` output. Added `build:dist` script, `prepack` hook (builds dist before publish), and `tsup` devDependency.
- **`scripts/npm-pack.sh`**: pack tarball now goes to `./pack/` instead of `./dist/`, so it no longer collides with the tsup-owned, published `dist/`.

### Source
- **`web/client.js`**: replaced top-level `await import('ws')` with a lazy `_ensureWS()` resolver and made `_WsLink.connect()` async, so the CJS build (no top-level await) works; browsers still use `globalThis.WebSocket`.

### Examples & demos (type:module compliance)
- Renamed all legacy CommonJS examples and in-repo demo scripts from `.js` to `.cjs` (`example/**`, `demo/**`) and updated their relative requires.
- Added native ESM `.mjs` variants for representative cases (publisher, subscriber, services client/service, timer).
- Updated `example/services/README.md` and `example/topics/README.md` to reference the new file names.

### Verification
- `npm run build:dist` (tsup) produces both ESM + CJS bundles successfully; `npm run lint` clean; `node --check` passes on all renamed/new `.cjs`/`.mjs` files. (Native addon build still requires a sourced ROS environment — unrelated to these changes.)

Fix: #1358

2045 of 2403 branches covered (85.1%)

Branch coverage included in aggregate %.

16688 of 18133 relevant lines covered (92.03%)

228.47 hits per line

Jobs
ID Job ID Ran Files Coverage
1 27249695817.1 10 Jun 2026 03:04AM UTC 65
91.22
GitHub Action Run
Source Files on build 27249695817
  • Tree
  • List 65
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #27249695817
  • 774b6378 on github
  • Prev Build on develop (#27193208698)
  • Next Build on develop (#27263579073)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc