Skip to content

fix(create-refine-app): report a failed install as incomplete, not success - #7689

Open
Goldloli wants to merge 1 commit into
refinedev:mainfrom
Goldloli:fix/create-refine-app-report-install-failure
Open

Goldloli wants to merge 1 commit into
refinedev:mainfrom
Goldloli:fix/create-refine-app-report-install-failure

Conversation

@Goldloli

Copy link
Copy Markdown

What is the current behavior?

create-refine-app --example prints a green Success! box even when npm install failed, and exits with code 0.

Following the tutorial's Quick Setup (npm create refine-app@latest -- --example starter-vite, documentation/tutorial/essentials/setup/index.md:18) currently ends with:

- Installing packages. This might take a couple of minutes.
✖ Failed to install packages. You can try again manually.
- Initializing Git in ./my-refine-app.
✔ Created Git repository with initial commit.

╭───────────────────────────── Success! ─────────────────────────────╮
│   Created starter-vite at ./my-refine-app                          │
│                                                                    │
│   Start using your new refine app by running:                      │
│                                                                    │
│     cd ./my-refine-app                                             │
│     npm run dev                                                    │
╰────────────────────────────────────────────────────────────────────╯

The install failure itself is swallowed by installDependencies(), which uses stdio: "ignore" and only returns a boolean (packages/create-refine-app/src/example/install-dependencies.ts). The final box is built from chalk\{bold.green Success!}` unconditionally (packages/create-refine-app/src/example/index.ts), and process.exitCode` is never set, so a broken project is reported — and scripted — as a working one.

The tutorial's starter-vite template pins "@refinedev/core": "^5.2.0", and 5.1.0/5.2.0 were never published to npm (latest is 5.0.12), so the documented Quick Setup hits this path every time. That version pin is a release issue tracked separately in the linked report; this PR fixes the reporting, which is what makes the failure diagnosable at all.

What is the new behavior?

The final box now follows the install result:

  • Install succeeded — unchanged: green Success! box, cd + dev, exit code 0.
  • Install failed — yellow Incomplete box that says dependencies were not installed and lists cd → install → dev, and the process exits with code 1.

The spinner message on failure now names the package manager command to run in the project directory (Run "npm install" in the project directory to see the error and retry.), because stdio: "ignore" means the actual error was never shown.

- Installing packages. This might take a couple of minutes.
✖ Failed to install packages. Run "npm install" in the project directory to see the error and retry.
- Initializing Git in ./my-refine-app.
✔ Created Git repository with initial commit.

╭──────────────────────────── Incomplete ────────────────────────────╮
│   Created starter-vite at ./my-refine-app                          │
│                                                                    │
│   Dependencies were not installed, so the project will not run yet. │
│   Install them, then start the app:                                │
│                                                                    │
│     cd ./my-refine-app                                             │
│     npm install                                                    │
│     npm run dev                                                    │
╰────────────────────────────────────────────────────────────────────╯

Verification

Local, Node 24.12.0, npm 11.6.2, macOS (darwin 27.2.0 arm64).

  1. Reproduced the failure end to end with the built CLI and the real template:

    node packages/create-refine-app/dist/index.js --example starter-vite e2e-out
    

    Before the change this printed the Success! box above. After the change it prints the Incomplete box and echo $? gives 1.

  2. Confirmed the failure is the unreleased range, not a local environment problem — the same package.json with @refinedev/core set to ^5.0.12 installs cleanly:

    added 571 packages in 35s
    npx tsc --noEmit        # exit 0
    npm run build           # tsc && refine build, 329 modules transformed, dist written
    
  3. Tests (npm test in packages/create-refine-app, 2 passed):

    • reports success when dependencies install — Success! and npm run dev present, exit code untouched.
    • does not report success when dependency install fails — no Success!, Incomplete and npm install present, exit code 1.

    Reverting only the product code and re-running makes the second test fail on expect(printed).not.toContain("Success!"), so the test is pinned to the fix rather than to the refactor.

  4. npx tsc --noEmit -p tsconfig.json passes. vitest is added to the package devDependencies because the package tsconfig.json includes src, and the new spec file imports it; the declarations build already excludes **/*.spec.ts.

  5. biome check on both changed files reports no issues.

Notes for reviewers

  • Scope. Only the reporting path is changed. The @refinedev/core@^5.2.0 pin in examples/starter-vite/package.json is untouched — it is regenerated by the changesets version commit (fb4084e bumped it from ^5.1.0), so it needs the release that publishes 5.1/5.2 rather than a manual edit here.
  • process.exitCode is set instead of calling process.exit(1) so the git step and existing output still flush.
  • The changeset is create-refine-app: patch; the config's ignore list explicitly keeps create-refine-app versioned.

Fixes #7687

…ccess

`create-refine-app --example` installed the example's dependencies and then
printed a green `Success!` box regardless of the result. When the install
failed (for example the starter-vite template pinning an unpublished
`@refinedev/core` range), the user was told to run `dev` on a project that
could not start, with a zero exit code.

The final box now depends on the install result: failure prints an
`Incomplete` box that lists `install` before `dev` and sets a non-zero exit
code, and the spinner points at the package manager command to reproduce the
error. A test covers both branches.

Fixes refinedev#7687
@changeset-bot

changeset-bot Bot commented Nov 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: eda58a8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
create-refine-app Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DOC] Tutorial "Your First Refine App" -> "Quick Setup" is broken

1 participant