Repository navigation
fix(prompts): start every command on csdx 2.x, whose inquirer 12 broke registerSearchList - #278
Closed
SakshiKoli-CS wants to merge 1 commit into
Closed
SakshiKoli-CS wants to merge 1 commit into
SakshiKoli-CS wants to merge 1 commit into
Conversation
…e registerSearchList
csdx 2.x's bin/run.js makes every plugin resolve @contentstack/cli-utilities
to csdx's own 2.x copy, which ships inquirer 12. registerSearchList(), run by
every command at init, assumed inquirer 8: it called a top-level
registerPrompt, which inquirer 12 only has on its default export, and loaded
inquirer/lib/prompts/{list,checkbox}, which inquirer 12's package exports
hide. So every launch:* command failed on csdx 2.x with "inquirer.registerPrompt
is not a function".
registerSearchList now registers on whichever of the module or its default
export has registerPrompt, and keeps inquirer's own list and checkbox when
their lib/prompts files are absent or not exported. Any other load error
still throws. On csdx 1.x nothing changes.
Refs CL-8328
#claude_code#
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ Vulnerabilities Without Available Fixes (Informational Only)The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:
✅ BUILD PASSED - All security checks passed |
Contributor
Author
|
Closing in favour of upgrading Launch CLI V2 to @contentstack/cli-utilities 2.x (inquirer 12) under CL-8328, rather than keeping a compatibility shim for inquirer 8. A new PR will follow. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
On csdx 2.x (
@contentstack/cli2.0.2, npmlatest), everylaunch:*command failed at startup witherror: inquirer.registerPrompt is not a function. The newLaunch-cli-v2-dev11-integration-sanityGoCD pipeline hit it on its first run.Why it broke
bin/run.jsmakes every plugin resolve@contentstack/cli-utilitiesto csdx's own 2.x copy, which ships inquirer 12. Launch CLI's own^1.18.5pin is bypassed.registerSearchList(), which every command runs at init, assumed inquirer 8 in two ways:registerPrompt, which inquirer 12 only has on itsdefaultexport;inquirer/lib/prompts/{list,checkbox}, which inquirer 12's packageexportshide (ERR_PACKAGE_PATH_NOT_EXPORTED).Fix (
src/core/search-list.ts)defaultexport hasregisterPrompt.lib/prompts/{list,checkbox}is absent (MODULE_NOT_FOUND) or not exported (ERR_PACKAGE_PATH_NOT_EXPORTED), keep inquirer's own list and checkbox. Any other load error still throws.search-listis still registered on both csdx versions.What changes for users: nothing on csdx 1.x. On csdx 2.x, commands start, and
list/checkboxpage with inquirer 12's built-in paging instead of launch-cli's custom scroller.Tests
search-list.test.ts:registerPromptonly ondefault);lib/promptshidden by package exports or missing, so onlysearch-listis registered and nothing throws;inquirer.registerPrompt is not a function; the fixed build registers the launchsearch-list.listandcheckboxare still launch's paginated prompts.npm test: 193 suites, 3821 tests passed.npm run lintclean.Launch-cli-v2-dev11-integration-sanityrun (csdx 2.0.2) should get pastprojects:create.Jira: https://contentstack.atlassian.net/browse/CL-8328 (found by CL-7176's sanity pipeline)
#claude_code#
🤖 Generated with Claude Code