fix: add predev script to resolve @repo/email import error #2113
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.
Summary
Adds a
predev
script to the API workspace that automatically builds the email package before starting the development server. This resolves the "Cannot find module '@repo/email'" error that occurs when developers fresh clone the repository and runbun dev
without manually building the email package first.Fixes #2112 (introduced in #2110)
Changes
"predev": "bun --filter @repo/email build"
toapps/api/package.json
@ai-sdk/[email protected]
,[email protected]
- Latest AI SDK releases[email protected]
- Changelog@react-email/[email protected]
,@react-email/[email protected]
,[email protected]
[email protected]
- Changelog@typescript-eslint/*@8.43.0
- Release notes[email protected]
- Changelog[email protected]
,@cloudflare/[email protected]
,[email protected]
Problem
When users clone the repository and run
bun dev
, the API server fails to start with:This happens because:
@repo/email
./dist/
(compiled TypeScript output)dist
folder is gitignored and doesn't exist on fresh clonebun email:build
firstSolution
The
predev
script leverages npm/Bun's lifecycle hooks to automatically build the email package before thedev
script runs. This works with both:bun dev
(fromapps/api/
)bun api:dev
(from repository root)Testing
Verified the fix by:
apps/email/dist
folder to simulate fresh clone statebun api:dev
andbun dev
(from API directory)Result: Developers can now run
bun dev
immediately after cloning without any manual setup steps.Code Quality Integration
lint-staged Configuration: The repository uses lint-staged with Husky pre-commit hooks for automated code quality checks:
bunx lint-staged
on all staged files*.{js,jsx,ts,tsx,mjs,cjs}
for linting and*
for formattingThis integration ensures all commits maintain consistent code style and pass linting rules before reaching the repository.