You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(llc): improve script for generating Feeds client
This commit introduces significant improvements to the script used for generating the Dart client for Stream Feeds.
Key changes:
- **Configuration:** Moved the `CHAT_DIR` configuration to the top of the script for easier modification by developers.
- **Path Handling:** Implemented more robust path handling using `SCRIPT_DIR` and `REPO_ROOT` to make the script less dependent on absolute paths.
- **Validation:** Added checks for the existence of `CHAT_DIR`, `renamed-models.json`, and the presence of `go` and `dart` in the system PATH.
- **Clarity:** Added `echo` statements to provide better feedback to the user during the generation process.
- **Sed Portability:** Replaced `sed -i ''` with a more portable `sed_inplace` function that works on both macOS and Linux.
- **Scoped Build & Format:** Limited `build_runner` and `dart format` to only run on the `stream_feeds` package, improving efficiency.
- **Output Directory:** Ensured the output directory for generated code is created if it doesn't exist.
- **Error Handling:** Utilized `set -euo pipefail` for better script error handling.
- **Melos Integration:** Added a new melos script `gen:feeds` to trigger this generation script.
The script now performs the following steps:
1. Generates the OpenAPI spec and Dart client from the chat repository.
2. Applies post-generation fixes (e.g., removing duplicate fields in generated models).
3. Runs `build_runner` specifically for the `stream_feeds` package.
4. Formats the generated code within the `stream_feeds` package.
0 commit comments