Skip to content

refactor: shared package #1030

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

Closed
wants to merge 4 commits into from
Closed

Conversation

AndriiAndreiev
Copy link
Collaborator

🧰 Changes

  • Created a new shared package (@readme/api-shared) inside the monorepo to host common utilities.
  • Extracted the logger implementation from api into this shared package to enable reuse across multiple packages.

This setup is especially needed to support logging in debugging mode across the monorepo, including adding logging capabilities to the api-core package. (PR #1029). The shared package will also serve as a place to add new features/utilities intended for use in multiple packages throughout the monorepo.

@AndriiAndreiev AndriiAndreiev changed the title refactor: extract logger from api package to shared refactor: shared package May 19, 2025
@AndriiAndreiev AndriiAndreiev marked this pull request as ready for review May 19, 2025 13:45
@erunion
Copy link
Member

erunion commented May 27, 2025

@AndriiAndreiev what's the intent behind this package? How will it be used in the future?

@AndriiAndreiev
Copy link
Collaborator Author

@erunion In short: this package is needed to avoid code duplication. It will contain code that we can reuse across all our internal packages (api, core, http-snippet-client-api).

For example: right now, logger.ts is located in the api package. But for the debugging mode (Issue #789), it would also make sense to have logging in api-core - like if we want to log HAR files. Instead of creating another logger or duplicating the code, we can just reuse it by moving it into a shared package. That way, the same code can be used across all three packages. This approach will also be helpful for future changes where the logic is shared among all three packages.

@AndriiAndreiev AndriiAndreiev requested a review from erunion as a code owner May 28, 2025 11:36
@erunion
Copy link
Member

erunion commented May 28, 2025

@AndriiAndreiev why not move these shared utilities into core and then have httpsnippet-client-api depend on that?

@AndriiAndreiev
Copy link
Collaborator Author

@erunion Seemed like a good solution, thank you! Closing this PR in favor of #1029.

@erunion erunion deleted the refactor/shared-package branch May 29, 2025 15:16
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.

2 participants