Repository navigation
fix: createNextJSPages throwing preventing copy of store discovery-co… - #3356
Conversation
WalkthroughThe PR refines error handling in the CLI's ChangesError Handling Scope Adjustment
Estimated Code Review Effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/cli/src/utils/generate.ts`:
- Line 257: The unconditional success message is printed even when the prior
operations fail; update the flow in generate.ts so that the success log
(logger.log(`${chalk.green('success')} - Starter files copied`)) only runs when
the try block completes without error — e.g., introduce a boolean success flag
or move that log inside the try after calling copySync and createNextJsPages,
and ensure the catch only logs the error and does not trigger the success
message; reference copySync and createNextJsPages to locate the operations whose
success should gate the log.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 36182082-291d-47b7-ba10-3a678f917353
📒 Files selected for processing (1)
packages/cli/src/utils/generate.ts
| ) | ||
| } | ||
|
|
||
| logger.log(`${chalk.green('success')} - Starter files copied`) |
There was a problem hiding this comment.
Avoid unconditional success log after a caught failure
If copySync/createNextJsPages fails in the try block, Line 257 still logs success, which can hide partial failure. Gate this log behind a success flag (or log separate success messages per step).
Suggested patch
function copyUserStarterToCustomizations(basePath: string) {
@@
- try {
+ let starterCopySucceeded = false
+ try {
if (existsSync(userSrcDir) && readdirSync(userSrcDir).length > 0) {
copySync(userSrcDir, tmpCustomizationsSrcDir, { dereference: true })
createNextJsPages(basePath)
+ starterCopySucceeded = true
}
} catch (err) {
logger.error(`${chalk.red('error')} - ${err}`)
}
@@
- logger.log(`${chalk.green('success')} - Starter files copied`)
+ if (starterCopySucceeded) {
+ logger.log(`${chalk.green('success')} - Starter files copied`)
+ }
}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/cli/src/utils/generate.ts` at line 257, The unconditional success
message is printed even when the prior operations fail; update the flow in
generate.ts so that the success log (logger.log(`${chalk.green('success')} -
Starter files copied`)) only runs when the try block completes without error —
e.g., introduce a boolean success flag or move that log inside the try after
calling copySync and createNextJsPages, and ensure the catch only logs the error
and does not trigger the success message; reference copySync and
createNextJsPages to locate the operations whose success should gate the log.
|

0 New Issues
0 Fixed Issues
0 Accepted Issues
When running cli the step of creating the .faststore folder was not copying the discovery.config of the store because the
createNextJsPagestrhow an error of use trying to create new nextjs pages/apis that is not allowed.The behaviour of not allowing is not changed, only kept the flow of script as it was before fixing the config copy that was being steped in this case.
Summary by CodeRabbit