Repository navigation
feat: Support platform specific scripts - #4471
Conversation
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
📝 WalkthroughWalkthroughThe changes introduce platform-aware script definitions and execution to the Serverpod CLI. The Script class is refactored to support separate Windows and POSIX commands defined per-platform in YAML. The RunCommand validates platform availability at runtime and lists only compatible scripts. The exception type for script parsing is renamed, and comprehensive tests cover platform-specific parsing, validation, and execution flows. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant CLI as Serverpod CLI
participant ScriptLoader as Script Loader
participant Platform as Platform Detection
participant Executor as Script Executor
User->>CLI: Run 'serverpod run <script>'
CLI->>ScriptLoader: Load script from pubspec.yaml
ScriptLoader->>ScriptLoader: Parse YAML (single or per-platform)
ScriptLoader-->>CLI: Script object (with windows/posix commands)
CLI->>Platform: Check current platform support
Platform-->>CLI: Platform check result
alt Platform Supported
CLI->>Executor: Execute script command
Executor-->>CLI: Command output
CLI-->>User: Success
else Platform Unsupported
CLI->>CLI: Log error (platform not supported)
CLI-->>User: Error & Exit
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes
Possibly related issues
Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
bc12ebd to
6528e23
Compare
|
Ignoring flaky windows test |
SandPod
left a comment
There was a problem hiding this comment.
Changes looks good! Have a couple of questions and suggestions.
710f1e3 to
9ac3c51
Compare
SandPod
left a comment
There was a problem hiding this comment.
Nice addition!
Leaving the last comment open as an optional thing to fix. I still think it might be good to address to ensure the exception and implementation stays in sync in the future.
706757b to
be44c7d
Compare
…te function instead
be44c7d to
903b73f
Compare
903b73f to
3ed4e55
Compare
9316595 to
5f29b23
Compare
|
Disregarding flaky tests |
Add platform-specific script support for
serverpod runAdds support for defining platform-specific commands in
pubspec.yamlscripts, enabling cross-platform script definitions.Changes
windowsandposixkeys for platform-specific commandsScript.fromYaml()factory for parsing both simple and platform-specific formatssupportsCurrentPlatformgetter andUnsupportedPlatformExceptionserverpod run --listshows "(not available on $platform)" for unsupported scriptsScriptsParseExceptiontoScriptParseExceptionExample
Fixes #XXXX
Fixes #4439
Pre-launch Checklist
///).Breaking changes
None
Summary by CodeRabbit
New Features
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.