-
Notifications
You must be signed in to change notification settings - Fork 963
chore(cz-commitlint): allow inquirer v14 compatibility #4879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,12 +43,12 @@ | |
| "word-wrap": "^1.2.5" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/inquirer": "^9.0.7", | ||
| "commitizen": "^4.2.4" | ||
| "commitizen": "^4.2.4", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| "inquirer": "^14.0.2" | ||
| }, | ||
|
Comment on lines
+46
to
48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 6. Node engine floor mismatch The package engine allows Node >=22.12.0, but the newly added devDependency inquirer@14.0.2 requires Node ^22.13.0 (or newer) per the lockfile. Installs/tests run on Node 22.12.x (allowed by this package) can fail due to dependency engine constraints. Agent Prompt
Comment on lines
45
to
48
|
||
| "peerDependencies": { | ||
| "commitizen": "^4.0.3", | ||
| "inquirer": "^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0" | ||
| "inquirer": "^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0 || ^14.0.0" | ||
| }, | ||
|
Comment on lines
45
to
52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 4. No @inquirer/prompts dependency The package still declares inquirer as a peer dependency and does not add a direct dependency on @inquirer/prompts as required by the migration plan. This keeps consumers coupled to inquirer rather than the intended prompt engine. Agent Prompt
Comment on lines
49
to
52
|
||
| "config": { | ||
| "commitizen": { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import { QualifiedRules, UserPromptConfig } from "@commitlint/types"; | ||
| import type { Answers, DistinctQuestion } from "inquirer"; | ||
| import type { PromptAnswers, PromptQuestion } from "./types.js"; | ||
|
|
||
| import { | ||
| combineCommitMessage as combineBody, | ||
|
|
@@ -20,7 +20,7 @@ export default async function ( | |
| rules: QualifiedRules, | ||
| prompts: UserPromptConfig, | ||
| inquirer: { | ||
| prompt(questions: DistinctQuestion[]): Promise<Answers>; | ||
| prompt(questions: PromptQuestion[]): Promise<PromptAnswers>; | ||
| }, | ||
| ): Promise<string> { | ||
| setRules(rules); | ||
|
Comment on lines
20
to
26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1. Still uses inquirer.prompt() The runtime still depends on an injected inquirer/inquirerIns instance and executes questions via inquirer.prompt(questions), rather than migrating to @inquirer/prompts for sequential prompting. This keeps internals coupled to a legacy inquirer instance and blocks the required compliance migration away from legacy prompt execution. Agent Prompt
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,30 +1,34 @@ | ||
| import { PromptMessages, PromptName } from "@commitlint/types"; | ||
| import pc from "picocolors"; | ||
| import inquirer, { Answers, ChoiceCollection, DistinctQuestion } from "inquirer"; | ||
| import inquirer from "inquirer"; | ||
|
|
||
| import { PromptAnswers, PromptQuestion } from "./types.js"; | ||
| import { CaseFn } from "./utils/case-fn.js"; | ||
| import { FullStopFn } from "./utils/full-stop-fn.js"; | ||
|
|
||
| export type QuestionConfig = { | ||
| enumList?: Array< | ||
| | string | ||
| | { | ||
| name: string; | ||
| value: string; | ||
| } | ||
| > | null; | ||
| title: string; | ||
| messages: PromptMessages; | ||
| maxLength?: number; | ||
| minLength?: number; | ||
| defaultValue?: string; | ||
| when?: DistinctQuestion["when"]; | ||
| when?: PromptQuestion["when"]; | ||
| skip?: boolean; | ||
| enumList?: ChoiceCollection<{ | ||
| name: string; | ||
| value: string; | ||
| }> | null; | ||
| multipleValueDelimiters?: RegExp; | ||
| multipleSelectDefaultDelimiter?: string; | ||
| fullStopFn?: FullStopFn; | ||
| caseFn?: CaseFn; | ||
| }; | ||
|
|
||
| export default class Question { | ||
| private _question: Readonly<DistinctQuestion>; | ||
| private _question: Readonly<PromptQuestion>; | ||
| private messages: PromptMessages; | ||
| private skip: boolean; | ||
| private _maxLength: number; | ||
|
|
@@ -68,7 +72,7 @@ export default class Question { | |
|
|
||
| if (enumList && Array.isArray(enumList)) { | ||
| this._question = { | ||
| type: multipleSelectDefaultDelimiter ? "checkbox" : "list", | ||
| type: multipleSelectDefaultDelimiter ? "checkbox" : "select", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a project uses a still-supported inquirer 9-12 peer, enum-backed prompts now send There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 5. Select prompt peer mismatch Question now emits type: "select" for single-choice enum questions, but the package still declares peer compatibility with inquirer ^9–^12. Without a fallback/mapping, installs using those still-allowed peer versions may fail at runtime due to an unsupported question type. Agent Prompt
|
||
| choices: skip | ||
| ? [ | ||
| ...enumList, | ||
|
Comment on lines
73
to
78
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2. Uses inquirer.separator() Choice separators are still implemented via new inquirer.Separator() rather than adopting the @inquirer/prompts Separator support required for select/checkbox prompts. This risks UX divergence once prompt execution is migrated. Agent Prompt
|
||
|
|
@@ -105,7 +109,7 @@ export default class Question { | |
| return this.messages[key] ?? ""; | ||
| } | ||
|
|
||
| get question(): Readonly<DistinctQuestion> { | ||
| get question(): Readonly<PromptQuestion> { | ||
| return this._question; | ||
| } | ||
|
|
||
|
|
@@ -125,7 +129,7 @@ export default class Question { | |
| this._minLength = minLength; | ||
| } | ||
|
|
||
| protected beforeQuestionStart(_answers: Answers): void { | ||
| protected beforeQuestionStart(_answers: PromptAnswers): void { | ||
| return; | ||
| } | ||
|
|
||
|
|
@@ -172,7 +176,7 @@ export default class Question { | |
| return this.fullStopFn(toCased); | ||
| } | ||
|
|
||
| protected transformer(input: string, _answers: Answers): string { | ||
| protected transformer(input: string, _answers: PromptAnswers): string { | ||
| const output = this.filter(input); | ||
|
|
||
| if (this.maxLength === Infinity && this.minLength === 0) { | ||
|
|
@@ -183,7 +187,7 @@ export default class Question { | |
| return color("(" + output.length + ") " + output); | ||
| } | ||
|
|
||
| protected decorateMessage(_answers: Answers): string { | ||
| protected decorateMessage(_answers: PromptAnswers): string { | ||
| if (this.beforeQuestionStart) { | ||
| this.beforeQuestionStart(_answers); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3. Docs still require inquirer
📎 Requirement gap⚙ MaintainabilityAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools