Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement npm workspaces #208

Merged
merged 7 commits into from
May 31, 2024
Merged

feat: implement npm workspaces #208

merged 7 commits into from
May 31, 2024

Conversation

ygrishajev
Copy link
Contributor

@ygrishajev ygrishajev commented May 20, 2024

This PR ensures a proper monorepo approach utilizing npm workspaces. This way we have a consistent approach to directory structure separating packages and apps.

Key Changes

  1. Dockerfile Relocation for Indexer and API:

    • Dockerfiles for the indexer and api are moved to the root directory. These Dockerfiles only work in the context of workspaces with common local package dependencies. They are not transferable within the app context.
  2. Transferrable Dockerfiles for Other Apps:

    • Dockerfiles for other apps remain in their respective app contexts as they are fully transferable. These can be copied elsewhere and will work independently.
  3. Staged Builds for Dockerfiles:

    • Implemented staged builds in Dockerfiles for api and indexer to ensure proper Docker cache utilization and reduced image size.

Benefits

  1. Dependency Unification:

    • Ensures consistent dependency versions across all apps and packages. For example, using the same TypeScript version across apps/packages allows for a single base config. This unification extends to other tools like Jest (with centralized configuration and coverage), Prettier, ESLint, and more.
  2. Dependency Sharing and Deduplication:

    • Another crucial benefit is dependency sharing and deduplication, which was previously an issue.
  3. Framework for Future Enhancements:

    • Provides a solid foundation for moving forward with other improvements like CI/CD. This unified approach will also streamline deployments.
  4. Monorepo Orchestration Tools:

    • On top of this, we can utilize monorepo orchestration tools like Turborepo if needed.

Notes

  • Next.js Builds: I haven't tested deploy-web Next.js builds as it fails for me locally due to an OS architecture mismatch. It would be helpful if someone else could try building and running these locally to ensure they work as expected.

@ygrishajev ygrishajev force-pushed the feature/workspaces branch 11 times, most recently from 095ed0b to 711f511 Compare May 21, 2024 09:11
@ygrishajev ygrishajev changed the title WIP feat: implement npm workspaces May 21, 2024
@ygrishajev ygrishajev marked this pull request as ready for review May 21, 2024 09:12
@ygrishajev ygrishajev requested review from Redm4x and baktun14 May 21, 2024 09:12
@ygrishajev ygrishajev force-pushed the feature/workspaces branch 4 times, most recently from 39a5fe2 to e7a494f Compare May 27, 2024 07:32
@baktun14 baktun14 force-pushed the feature/workspaces branch from d577134 to 970b4aa Compare May 31, 2024 19:22
@baktun14 baktun14 merged commit c403dc1 into main May 31, 2024
6 checks passed
@baktun14 baktun14 deleted the feature/workspaces branch May 31, 2024 19:38
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.

3 participants