feat: add serve command support#910
Conversation
Register the new `serve` SDK command and wire up platform-specific config handling so it works like `build`. Adds positional platform shorthand (e.g. `ti serve ios`) by preferring Commander's positional args over the manual trailing-args logic. Bumps version to 8.2.0.
|
Just opening this for discussion for my plans to integrate a Vite based build into the SDK, there are probably a lot of things i've missed and need more fine tuning, e.g. gracefully handle older SDK versions that don't have a |
Replace custom positional platform detection with Commander's native
.argument('[platform]') API. This lets Commander handle the shorthand
`ti build ios` / `ti serve ios` syntax natively instead of manually
checking argv._[0] after parsing.
The serve command's positional-platform work changed executeCommand() to populate `argv._` from Commander's flat `cmd.args` token list. That collapsed variadic positionals (e.g. `sdk uninstall [versions...]`) from a nested array into individual strings, so `sdk.js` consumers reading `cli.argv._[0]` as the versions array hit `TypeError: versions.filter is not a function` and the command fell back to printing usage. Restore the original `argv._ = args` behavior (Commander's action-handler arguments, where variadic positionals arrive as a nested array). The serve/build positional platform feature does not depend on this — it reads `command.processedArgs` in initBuildPlatform() — so it is unaffected. Add deterministic (no-network) regression tests covering single and multi-version `sdk uninstall` positional parsing.
|
Pushed a fix to this branch: The positional-platform refactor changed Restored the original Merge ordering: this depends on the pnpm toolchain fix #952. Merge #952 to |
cb1kenobi
left a comment
There was a problem hiding this comment.
Code looks awesome! Once we get the test green, we'll merge this and get it in for 9.0.0!
Summary
serveSDK command for the Titanium Vite runtimeinitBuildPlatformto handleservealongsidebuild, enabling platform-specific configti serve iosworks liketi build --platform iosTest plan
ti serve ioscorrectly resolves the platformti serve --platform androidstill worksti buildcommands are unaffected by the argument parsing changesti servewithout a platform prompts for selection