Skip to content

feat: build the package from src/ with tsup and keep ./main as a deprecated alias (#81) - #89

Merged
Shinrai merged 7 commits into
nextfrom
feat/library-layout
Nov 1, 2026
Merged

Shinrai merged 7 commits into
nextfrom
feat/library-layout

Conversation

@cldmv-bot

@cldmv-bot cldmv-bot Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

🚀 What's Changed

💥 Breaking Changes

No breaking changes

✨ Features

🐛 Bug Fixes

📦 Dependencies

No dependency updates

🔧 Other Changes

👥 Contributors

…ecated alias (#81)

- move the entries to src/index.mjs and src/index.cjs; index.mjs imports
  ./hold-my-task.mjs instead of the package's own name, and the sync
  devcheck block now loads ../devcheck.mjs
- replace build.mjs with tsup: dist/index.mjs is the bundle (devcheck
  kept external), dist/index.cjs a verbatim copy of src/index.cjs, and
  dist/main.mjs the ./main alias, which imports ./index.mjs instead of
  carrying its own copy
- ./main re-exports the root (same HoldMyTask class) and emits a
  once-per-process DeprecationWarning with code CLDMV_HOLDMYTASK_MAIN
- package.json: holdmytask-dev condition on "." (import + require),
  main/module/types point at dist/ and types/src/, files ships dist/
  (no maps) and types/src/, prepack builds, build:ci runs lint and
  format:check first; drop the test:run / test:coverage scripts
- types: generated from src/ now (types/src/index.d.mts, main.d.mts);
  the stale types/index.d.mts and types/build.* are gone, and dist/,
  tmp/ and tsup.config.mjs are excluded from declaration output
- tests: the node --test entry tests build first and check dist/ and
  src/, the CJS shape, the condition routing, that devcheck is not
  bundled and stops the src entry without the condition, and the
  alias; new vitest cases cover the alias and the async factories
@cldmv-bot cldmv-bot Bot added ! feature → next v4 flow: contributor PR targeting the next integration branch type: feature Implements new functionality — a PR or issue that adds a feature area: core Touches core library / runtime source code area: tests Touches test files, fixtures, or test infrastructure type: ci Changes to CI workflows, actions, or build pipelines type: config Changes to repository or project configuration files labels Nov 1, 2026
@Shinrai Shinrai changed the title fix: mark ./main as having side effects so bundlers keep its deprecation warning (#81) feat: build the package from src/ with tsup and keep ./main as a deprecated alias (#81) Nov 1, 2026
@cldmv-bot cldmv-bot Bot added type: dependencies Relates to dependency updates, version bumps, or package management type: documentation Relates to docs, README updates, guides, or inline code comments labels Nov 1, 2026
@cldmv-bot

cldmv-bot Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Auto-normalized PR title: rewrote PR title to match the highest-priority commit type (feat).

  • Before: fix: mark ./main as having side effects so bundlers keep its deprecation warning (#81)
  • After: feat: build the package from src/ with tsup and keep ./main as a deprecated alias (#81)

If this isn't what you want, edit the title — the normalizer won't re-fire as long as the title stays conventional.

The dev toolchain (chokidar 6, tsup 9) needs Node 22.22, so nothing older can be tested. engines, the CJS guard message and the CI matrix floor move together.
The previous commit swept in build:types output (formatting-only churn). Only the Node.js floor change was intended.
@Shinrai
Shinrai merged commit 567ac60 into next Nov 1, 2026
28 checks passed
@cldmv-bot
cldmv-bot Bot deleted the feat/library-layout branch November 1, 2026 22:09
cldmv-bot Bot added a commit that referenced this pull request Nov 2, 2026
# HoldMyTask v2.1.0 Changelog

**Release Date**: November 2026
**Release Type**: Minor
**Branch**: `release/2.1.0`

---

## Overview

v2.1.0 moves the package to the CLDMV library layout. The published entries are now built by tsup from `src/index.mjs` and `src/index.cjs` into `dist/`, the `holdmytask-dev` export condition moves onto the package root, the development-only `devcheck.mjs` is gone, and `@cldmv/holdmytask/main` stays as a deprecated alias of the root. The queue itself (`src/hold-my-task.mjs`, `src/utils.mjs`) is unchanged, and the root import and `require()` return the same exports as v2.0.6.

The supported Node.js range changes: `engines.node` goes from `>=18.12` to `>=22.22.0`. That is a real requirement change even though it ships in a minor release; see [Breaking Changes](#-breaking-changes) and the upgrade notes.

---

## 💥 Breaking Changes

### Node.js `>=22.22.0` is now required ([#89](#89))

`engines.node` was `>=18.12` in v2.0.6, with CommonJS `require()` documented as needing `^20.19.0` or `>=22.12.0`. Both are now `>=22.22.0`. The new build toolchain no longer runs on Node.js 18 or 20 (tsup 9 alone declares `^22.18.0 || ^24.11.0 || >=26.0.0`), so older versions can't be built or tested any more. The floor is set to 22.22.0, the oldest version the CI matrix now builds and tests. The `ERR_REQUIRE_ESM` message that `require()` throws on a Node.js without `require(esm)` now names `>=22.22.0`.

The queue code has no new runtime dependency on Node.js 22.22, but older versions are no longer tested or supported. npm prints an `EBADENGINE` warning when installing on an older Node.js, and the install fails when `engine-strict` is set.

---

## ✨ Features

### Library layout: `src/` entries and a tsup build ([#89](#89))

The root `index.mjs` / `index.cjs` moved to `src/index.mjs` / `src/index.cjs`. The ESM entry now imports `./hold-my-task.mjs` directly instead of importing the package by its own name (`@cldmv/holdmytask/main`), so nothing in the package imports itself.

The old `build.mjs` only copied `src/` into `dist/`; it is replaced by tsup (`tsup.config.mjs`):

- `dist/index.mjs` is the ESM bundle, minified with function and class names kept, so `HoldMyTask.name` and stack traces read the same.
- `dist/index.cjs` is not a second bundle. It is a verbatim copy of `src/index.cjs`, a thin wrapper that loads `./index.mjs` through Node's synchronous `require(esm)` and maps it to the historical CommonJS shape (the class as `module.exports`, plus the aliases as properties).
- `dist/main.mjs` is the deprecated `./main` alias, built with `./index.mjs` external so it imports `dist/index.mjs` instead of carrying its own copy.

`package.json` follows: `main` / `module` point at `dist/`, `types` at `types/src/index.d.mts`, `files` ships `dist/` (without source maps) and `types/src/`, and `prepack` runs the build so `dist/` is never committed. The stray `test:run` / `test:coverage` scripts that called vitest directly are gone.

### `holdmytask-dev` export condition on the package root ([#89](#89))

The `holdmytask-dev` condition used to sit only on `./main`. It is now on `"."`, for both `import` (`./src/index.mjs`) and `require` (`./src/index.cjs`). Running Node.js with `--conditions=holdmytask-dev` in a checkout of this repository loads the unbuilt source; without it, the root resolves to the built `dist/` files. Installed copies are unaffected, since they only ship `dist/`.

### `@cldmv/holdmytask/main` is a deprecated alias ([#89](#89))

`./main` still resolves, but it now re-exports the package root and emits a one-time `DeprecationWarning` with the code `CLDMV_HOLDMYTASK_MAIN`. Its `HoldMyTask` is the same class the root exports, as it was before; the alias also exposes the root's factories and class aliases, which the old `./main` did not. It stays ESM-only, as before. `node --no-deprecation` silences the warning, and the code lets an application filter it.

`package.json` `sideEffects` now lists `src/main.mjs` and `dist/main.mjs`, so bundlers keep the warning instead of tree-shaking it away. The alias will be removed in the next major version; import `@cldmv/holdmytask` instead.

### `devcheck.mjs` removed ([#89](#89))

The root entry used to start a fire-and-forget `devcheck.mjs` import that, in a checkout of this repository, exited with setup instructions when `src/` was present but the `holdmytask-dev` condition was not set. It is gone, along with its test. The condition already chooses between `src/` and `dist/`, and both are valid; a checkout with no build and no condition now fails with `ERR_MODULE_NOT_FOUND` naming `dist/`, which `npm run build` fixes. The published package never shipped `devcheck.mjs`, so installed copies see no difference.

---

## 🔧 CI & tooling

- Coverage builds with `npm run build:ci` (`coverage_build_command`), and `build:ci` now runs `lint` and `format:check` before the type and tsup builds ([#89](#89)).
- The bundle-size check measures the real `dist/**.mjs` / `dist/**.cjs` output ([#89](#89)).
- The CI and publish test matrices start at Node.js 22.22.0, the new package floor ([#89](#89)).
- A `.prettierignore` keeps `format:check` off generated `types/`, the lockfile, `dist/`, `coverage/` and workflow YAML ([#90](#90)).
- Declarations are generated from `src/` into `types/src/`. The stale root `types/index.d.mts` and `types/build.*` files are gone, and `dist/`, `tmp/`, `coverage/`, `examples/` and `tsup.config.mjs` are excluded from declaration output. The generated `index.d.mts` now declares `HoldMyTask` before exporting it, which CodeQL flagged ([#91](#91)).
- Tests: the `node --test` CommonJS suite builds first and checks both `dist/` and `src/`, the CommonJS export shape and the condition routing; new vitest cases cover the `./main` alias (same class, one warning with the right code) and the async factories ([#89](#89)).

## 📚 Documentation

- The README imports `@cldmv/holdmytask` instead of the `./main` subpath, documents the `holdmytask-dev` condition for `import` and `require()`, adds a section on the deprecated `./main` alias, and states the `>=22.22.0` requirement ([#89](#89)).
- **NEW:** [docs/changelog/v2/v2.1.0.md](./v2.1.0.md) — this changelog.

## 🔧 Dependencies

All of these are development dependencies; the package still has no runtime dependencies.

- `tsup` `^9.0.0` added as the build tool ([#89](#89)).
- `typescript` `^7.0.2` → `^6.0.3`. TypeScript 7's JavaScript declaration emit isn't complete yet, so the declarations are generated with TypeScript 6 ([#91](#91)).
- `overrides` for `katex` (`>=0.19.1 <1.0.0`, 0.16.47 → 0.19.1) and `minimatch` (`^11.0.3`, 10.2.6 → 11.0.3) clear the dev-only advisories that come in through `eslint` and `@eslint/markdown` ([#91](#91)).
- Toolchain refresh ([#90](#90)): `@cldmv/configs` 1.2.4 → 1.3.0, `@cldmv/fix-headers` 2.2.0 → 2.2.4, `@cldmv/vitest-runner` 1.5.3 → 1.5.6, `vitest` / `@vitest/coverage-v8` / `@vitest/ui` 5.0.3 → 5.0.5, `eslint` 10.12.0 → 10.14.0, `@eslint/css` 2.0.0 → 2.0.1, `@eslint/json` 2.1.0 → 2.1.1, `@html-eslint/eslint-plugin` and `@html-eslint/parser` 0.66.1 → 0.67.0, `@types/node` 26.6.4 → 26.6.6, `globals` 17.13.0 → 17.14.0, plus transitive fixes from `npm audit fix` (`vite` 8.3.2 → 8.3.5 among them).
- `prettier` 3.9.9 → 3.9.10 ([#72](#72)).

---

## Upgrade notes

- **Node.js `>=22.22.0` is required.** Upgrade Node.js before upgrading the package. On an older Node.js, stay on [v2.0.6](./v2.0.6.md).
- Replace `import … from "@cldmv/holdmytask/main"` with `import … from "@cldmv/holdmytask"`. The old subpath keeps working until the next major, but prints a `DeprecationWarning` (`CLDMV_HOLDMYTASK_MAIN`) once per process.
- No other API change: the root import, `require()` and the TypeScript declarations resolved through `exports` expose the same names as v2.0.6. Code that deep-imported a file path such as `types/index.d.mts` or `dist/hold-my-task.mjs` instead of using `exports` must switch to the package root.

Closes [#81](#81).



<details>
<summary>👥 Contributors</summary>

- @Shinrai

</details>

---

<!-- coverage-start -->

![coverage](https://img.shields.io/badge/coverage-77.8%25-green?style=for-the-badge&logo=vitest&logoColor=white)

| Metric | Coverage |
|--------|----------|
| Statements | 80.8% |
| Branches   | 75.4% |
| Functions  | 73.4% |
| Lines      | 81.9% |

*Avg: **77.8%** · `238f433` · Node lts/**

<!-- coverage-end -->

<!-- co-authors -->

Co-authored-by: Shinrai <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: core Touches core library / runtime source code area: tests Touches test files, fixtures, or test infrastructure ! feature → next v4 flow: contributor PR targeting the next integration branch type: ci Changes to CI workflows, actions, or build pipelines type: config Changes to repository or project configuration files type: dependencies Relates to dependency updates, version bumps, or package management type: documentation Relates to docs, README updates, guides, or inline code comments type: feature Implements new functionality — a PR or issue that adds a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant