feat: add customize callback to createApp, remove autoStart#280
feat: add customize callback to createApp, remove autoStart#280MarioCadenas wants to merge 4 commits intomainfrom
Conversation
Replace the post-await extend/start ceremony with a declarative `customize` callback on createApp config. The callback runs after plugin setup but before the server starts, giving access to the full appkit handle for registering custom routes or async setup. - Add `customize` option to createApp config - Server start is now orchestrated by createApp (lookup by name) - Remove `autoStart` from public API, ServerConfig, and manifest - Remove `start()` from server plugin exports - Remove autoStart guards from extend() and getServer() - Remove ServerError.autoStartConflict() - Migrate dev-playground, template, and all tests Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
d49f16d to
33e0b86
Compare
|
I think this is a step in the right direction and we should have this ASAP. That being said, as we talked on Slack (just surfacing this here), the API name could change. The use case we need to cover immediately is |
… detection Rename the lifecycle hook from `customize` to `onPluginsReady` to clearly communicate when it fires (after plugins are ready, before server starts). Add `appkit codemod customize-callback` CLI command that auto-migrates old autoStart/extend/start patterns to the new onPluginsReady callback. Supports both .then() chain (Pattern A) and await + imperative (Pattern B, with bail-out for complex cases). Add runtime detection that throws helpful errors when users pass autoStart to server() or call server.start() after upgrading, directing them to run the codemod. Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
The test fixture .ts files import @databricks/appkit which doesn't exist in the shared package, causing tsc to fail in CI. Exclude the fixtures directory from the shared tsconfig. Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
Remove the codemod CLI from this PR to keep the review focused on the core lifecycle change. The codemod will land as a follow-up with bug fixes from review. Runtime detection (constructor autoStart throw + exports().start() trap) stays since it's part of the migration story. Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
Summary
onPluginsReadylifecycle hook tocreateAppthat runs after plugin setup but before the server starts, replacing theautoStart: false+.extend()+.start()ceremonycreateApp(looks up"server"plugin by name), makingautoStartand manualstart()unnecessaryautoStartfrom public API (ServerConfig,DEFAULT_CONFIG, manifest) andstart()from server exportsappkit codemod customize-callbackCLI command to auto-migrate existing appsBefore / After
Before:
After:
Migration
Auto-detects server entry files and rewrites both
.then()chain andawait+ imperative patterns. Dry-run by default (omit--writeto preview).Test plan
onPluginsReady(sync, async, without server plugin)