Skip to content

Adopt the CLDMV library layout: tsup build, src/index.mjs + src/index.cjs entries #75

Closed

Description

@Shinrai

Problem

There is no build. build and build:ci are echo '✓ no build step', and the package ships src/ and scripts/ directly, with hand-written root index.mjs / index.cjs entries (index.mjs re-exports ./src/lib/android-tv-remote.mjs). There is no -dev condition, so a checkout can't tell source from a build.

Target layout

CLDMV/llm-translator (PR #1) is the reference implementation for the layout.

package.json   "." → { "node-android-tv-remote-dev": { import: ./src/index.mjs, require: ./src/index.cjs },
                       import: ./dist/index.mjs, require: ./dist/index.cjs }
src/
  index.mjs    the real exports
  index.cjs    require_module guard + require("./index.mjs"), mapped to the CJS export shape
  lib/ …
dist/          tsup output (gitignored, rebuilt by prepack)
  index.mjs    bundle
  index.cjs    verbatim copy of src/index.cjs (tsup onSuccess copyFileSync)

Tasks

  • git mv index.mjs src/index.mjs and git mv index.cjs src/index.cjs, and change the re-export to ./lib/android-tv-remote.mjs.
  • Pass --conditions=node-android-tv-remote-dev to the vitest config and test:cjs (as in llm-translator).
  • Add tsup, modeled on llm-translator's tsup.config.mjs: an index entry, onSuccess copying src/index.cjs to dist/index.cjs, keepNames: true, removeNodeProtocol: false. Runtime deps (@devicefarmer/adbkit, sharp) stay external.
  • package.json:
    • put the -dev condition on "."
    • main / module → dist/
    • files: dist/, types/; not src/
    • build = tsup, prepack: npm run build, build:ci: lint + format:check + build
    • engines.node: ^20.19.0 || >=22.13.0, because the CJS entry needs require(esm) and Node 22.12.x warns when require() loads ESM (today >=20.9.0, which index.cjs already rejects at runtime)
  • Decide whether scripts/ still needs to ship, and move the root eslint.config.mjs into .configs/ like the other CLDMV repos.
  • tests/cjs/entry.test.cjs: point at dist/.
  • ci.yml: coverage_build_command: "npm run build:ci". bundle-size.yml: dist_paths = the real dist/ output.

Compatibility

The public entry (".") and its exports don't change. The one consumer-visible change is the engines floor, which matches what index.cjs already enforces at runtime.

Activity

  1. added
    type: enhancement
    priority: low
    area: core
    status: not started
    on Oct 25, 2026
  2. changed the title [-]Adopt the CLDMV library layout: tsup build, src/index.mjs + src/index.cjs entries, devcheck[/-] [+]Adopt the CLDMV library layout: tsup build, src/index.mjs + src/index.cjs entries[/+] on Nov 1, 2026
  3. Shinrai commented on Nov 1, 2026

    @Shinrai
    ContributorAuthor

    Dropped the devcheck part, it's being removed from all the packages instead.

  4. added
    status: in progress
    and removed
    status: not started
    on Nov 1, 2026
  5. added
    status: implemented
    and removed
    status: in progress
    on Nov 1, 2026
  6. cldmv-bot commented on Nov 1, 2026

    @cldmv-bot
    Contributor

    Marked status: implemented — resolved by #81, merged into next. This issue closes automatically when that work ships to the default branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: corepriority: lowstatus: implementedtype: enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions