Skip to content

fix(install): load @clack/prompts via dynamic import to avoid ERR_REQ…#1652

Merged
mazhe-nerd merged 1 commit into
mainfrom
fix/install-wizard-esm-1636
Jun 29, 2026
Merged

fix(install): load @clack/prompts via dynamic import to avoid ERR_REQ…#1652
mazhe-nerd merged 1 commit into
mainfrom
fix/install-wizard-esm-1636

Conversation

@mazhe-nerd

@mazhe-nerd mazhe-nerd commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Bug Fixes
    • Improved startup compatibility by loading the prompt library dynamically.
    • Made error handling more reliable when initialization fails, with a fallback to standard error logging and a clean exit code.

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ea913c11-a8d5-4ca9-81d2-8dd06358829b

📥 Commits

Reviewing files that changed from the base of the PR and between 602c788 and d4c3ed7.

📒 Files selected for processing (1)
  • scripts/install-wizard.js

📝 Walkthrough

Walkthrough

scripts/install-wizard.js replaces the top-level require("@clack/prompts") with a dynamic await import(...) inside an async IIFE, deferring initialization of p for ESM compatibility. Error handling now conditionally calls p.cancel(...) if p was initialized, otherwise falls back to console.error.

Changes

ESM compatibility fix for @clack/prompts

Layer / File(s) Summary
Dynamic import and IIFE entrypoint
scripts/install-wizard.js
p is declared uninitialized; an async IIFE dynamically imports @clack/prompts into p before calling main(). The catch handler conditionally uses p.cancel(...) when available, falling back to console.error, and always exits with code 1.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested reviewers

  • liangshuo-1

Poem

🐇 A rabbit once required with haste,
But ESM left no time to waste!
Now import() defers with care,
And p awaits before we dare—
No more crashes, smooth as air! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning No pull request description was provided, so the required Summary, Changes, Test Plan, and Related Issues sections are missing. Add the template sections with a brief summary, bullet list of changes, test plan steps, and related issue references or 'None'.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: switching @clack/prompts to dynamic import for install script ESM compatibility.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/install-wizard-esm-1636

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the size/M Single-domain feat or fix with limited business impact label Jun 29, 2026
@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.69%. Comparing base (602c788) to head (d4c3ed7).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1652   +/-   ##
=======================================
  Coverage   74.69%   74.69%           
=======================================
  Files         808      808           
  Lines       81527    81527           
=======================================
  Hits        60896    60896           
  Misses      16093    16093           
  Partials     4538     4538           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@d4c3ed74972618718e08b4836effd20d865e1e80

🧩 Skill update

npx skills add larksuite/cli#fix/install-wizard-esm-1636 -y -g

@mazhe-nerd
mazhe-nerd merged commit 21905b0 into main Jun 29, 2026
35 of 37 checks passed
@mazhe-nerd
mazhe-nerd deleted the fix/install-wizard-esm-1636 branch June 29, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants