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(ts): implement grpc-js client services (#184) #158

Merged
merged 2 commits into from
May 3, 2024
Merged

Conversation

ygrishajev
Copy link
Contributor

@ygrishajev ygrishajev commented Apr 30, 2024

This pull request introduces enhancements to our TypeScript codebase, focusing on improved gRPC service integration.

Key Changes

  1. gRPC Code Generation: Added ts-proto specifically tailored for @grpc/grpc-js. This ensures that our TypeScript code seamlessly integrates with gRPC services.

  2. Service Implementation Merging: Merged only the service implementations into the default generated code from ts-proto, optimizing the structure and utility of our generated modules.

  3. Script Refactoring: Extracted merging shell scripts into a dedicated file

Some reasoning

  1. Node.js Dependencies in Default Exports: It is not possible to generate services for @grpc/grpc-js in dedicated files. This approach leads to Node.js native dependencies being imported across all default exports, which unfortunately breaks browser support.

  2. Dedicated Cache Directory for @grpc/grpc-js Code Generation: To manage the issue of dependencies, the code generation for grpc-js is directed into a dedicated cache directory. This setup isolates the @grpc/grpc-js specific code, allowing us to maintain a clear separation from the default codebase. The only difference with the default generated code in this case is services we need to integrate with @grpc/grpc-js.

  3. Relocation and Indexing of Services: Post generation, the grpc-js services are moved to the ts/src/generated directory within the project structure. Each service is given its own index file to facilitate clean exports from the package.

script/protocgen-legacy.sh Outdated Show resolved Hide resolved
baktun14
baktun14 previously approved these changes Apr 30, 2024
script/protocgen-legacy.sh Outdated Show resolved Hide resolved
script/ts-proto.sh Outdated Show resolved Hide resolved
Redm4x
Redm4x previously approved these changes May 2, 2024
script/protocgen-legacy.sh Outdated Show resolved Hide resolved
@ygrishajev ygrishajev force-pushed the feat/ts-grpc-js branch 2 times, most recently from f3eb061 to fd63c6d Compare May 3, 2024 16:49
script/protocgen-legacy.sh Outdated Show resolved Hide resolved
also improve formatting to make sure it works from the root dir
@troian troian merged commit c0913e0 into main May 3, 2024
9 checks passed
@troian troian deleted the feat/ts-grpc-js branch May 3, 2024 17:29
Copy link

github-actions bot commented May 3, 2024

🎉 This PR is included in version 1.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants