build(COMPASS-28): move to inquirer 11 - #2723
Conversation
Automated review —
|
`inquirer` to ^11.1.0, and `@types/inquirer` removed — the package has shipped its own declarations since 9. 11 is the ceiling, not the latest. inquirer 12, 13 and 14 are all `"type": "module"`, and this package is CommonJS throughout: `module` is `commonjs`, `bin/run` is a `require`, and ts-jest runs the suite as CJS. 10 and 11 are the last dual-published majors. Going further needs the whole package converted to ESM, which is not this change. The named `prompt` export is gone; only `createPromptModule` and a default carrying `prompt` remain. The command imports the default now, and the spec's `jest.mock` stands in for the default export rather than a named one. `message` and `type` are non-optional on inquirer's question type, so both are spelled out. The labels are the text inquirer 8 produced for the same prompts, so what a user reads does not change. The compiler requires them to be present but cannot check what they say, and a wrong label compiles cleanly — so the three are asserted in the spec, mutation-checked. Nothing else in the suite touches the real module: it is mocked wholesale, so it would pass against an inquirer that cannot be loaded at all, which is the shape an ESM-only major takes here. One case now resolves it for real and reads the manifest off disk — the `exports` map does not expose `./package.json` — so a move to an ESM-only version fails at the bump rather than in a consumer's terminal. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Addressed in Two of the three findings held; one did not, and I want to flag it rather than quietly act on it. Finding 1 (the Finding 2 (CJS loadability) — sound, but the suggested test does not work. Finding 3 (prompt arguments) — premise unsound. Dropping It is still worth an assertion, for a different reason: the compiler checks presence, not text, and Also dropped the change-narration comments per the Suggestions tier, since the same edits touched those lines. |
7c69fad to
c75852c
Compare
Automated review, round 2 —
|
Ticket
COMPASS-28 — Bump
spot's NodeJS minimum from 18 to 22Why 11 and not 14
inquirer^8.1.1 → ^11.1.0,@types/inquirerremoved (the package ships its own declarations from 9 on).11 is the ceiling for this package, not a cautious choice. inquirer 12, 13 and 14 are all
"type": "module", andspotis CommonJS throughout —module: "commonjs",bin/runis arequire(), ts-jest runs the suite as CJS. 10 and 11 are the last dual-published majors:typemodulemoduleSo Dependabot #2637 (→ 14) cannot merge without converting the whole package to ESM, which is a separate project. Worth closing with that reason so it stops being re-proposed weekly.
Three API changes between 8 and 11
1. The named
promptexport is gone.So
import { prompt }becomesimport inquirer+inquirer.prompt(...), and the spec'sjest.mock("inquirer", () => ({ prompt: jest.fn() }))has to stand in for the default export instead.2.
messageis now required — and it is user-visible.inquirer 8 derived it in
lib/prompts/base.js:So these prompts already read
Generator:,Language:andOutput destination:on screen. Each is now spelled out with that exact text, and inquirer 11 renders${prefix} ${message}with nothing appended (checked in@inquirer/selectand@inquirer/input), so what a user sees is unchanged rather than approximately unchanged.3.
inputwas the default question type until 9 and is explicit now.The suite could not have caught a broken inquirer
generate.spec.tsmocks inquirer entirely, so it passes against a module that fails to load at all — which is exactly the failure mode an ESM-only major would produce. So I drove the real thing through a pty:All three prompts render, accept input, and the command exits 0. Taking the first choice at each prompt produced an artifact identical to the same run with flags:
diff -r /tmp/pr6-out /tmp/pr6-flags # emptyThat also confirms the prompt-to-value mapping still lands on the right generator and language, not just that the prompts appear.
How this was verified
Locally on Node 22.23.2, all exit 0:
pnpm buildpnpm testpnpm lint:checkpnpm build-docsdocker build+check-image-parityinquireris a runtime dependency becausegenerateprompts, so it ships in the image. Parity's seven generate cases passing is the proof thatrequire("inquirer")resolves under CJS inside the image — the image also reports@airtasker/spot/2.1.0 linux-arm64 node-v22.23.2, confirming the base-image pin from #2718.