fix(cli): point to init when dev or update runs without a project#3929
Conversation
🦋 Changeset detectedLatest commit: a5c9119 The changes in this PR will be included in the next version bump. This PR includes changesets to release 25 packages
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 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (32)
WalkthroughThis PR prevents raw stack traces when running trigger.dev dev/update/etc. outside a project. resolveConfig now checks for a real trigger.config before invoking filesystem resolvers. updateTriggerPackages wraps getPackageJson in a try/catch to detect a missing package.json, prints guidance to run 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install timed out. The project may have too many dependencies for the sandbox. 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. Comment |
Running dev or update before a project existed crashed with a raw "Cannot find matching package.json" stack trace. The embedded version check and the config loader both resolved files up the tree before any friendly guidance could run; they now detect the missing project and point at npx trigger.dev@latest init.
fbb3065 to
a5c9119
Compare
@trigger.dev/build
trigger.dev
@trigger.dev/core
@trigger.dev/python
@trigger.dev/react-hooks
@trigger.dev/redis-worker
@trigger.dev/rsc
@trigger.dev/schema-to-json
@trigger.dev/sdk
commit: |
Summary
Running
trigger.dev devbefore setting up a project crashed with a rawCannot find matching package.jsonstack trace from a transitive dependency, instead of telling the user what to do next. It happens wheneverdev(orupdate) runs in a directory with nopackage.jsonin it or any parent directory, for example right after creating an empty project folder, or wheninitwas exited before it scaffolded anything.The CLI now detects the missing project and prints actionable guidance pointing at
init.Fix
devruns an embedded package-version check before it loads any project config. That check resolvedpackage.jsonthrough a helper that throws when nothing is found up the tree, and nothing caught it. It is now wrapped, so a missingpackage.jsonproduces a clear "run init" message and a clean exit.The config loader had the same latent crash on the
--skip-update-checkpath. Its resolvers forpackage.json, the lockfile, and the workspace root all ran before the friendly "couldn't find your trigger.config.ts" check, so any of them throwing masked it. That check now runs first and short-circuits before the resolvers touch the filesystem.Verified live: in an empty directory,
dev,dev --skip-update-check, andupdateall print a "run init" message and exit cleanly; in a configured project,devstill resolves config and boots normally.