feat: add appkit codemod on-plugins-ready CLI#291
Open
MarioCadenas wants to merge 2 commits intofeat/customize-callbackfrom
Open
feat: add appkit codemod on-plugins-ready CLI#291MarioCadenas wants to merge 2 commits intofeat/customize-callbackfrom
MarioCadenas wants to merge 2 commits intofeat/customize-callbackfrom
Conversation
Add `appkit codemod on-plugins-ready` command that auto-migrates old autoStart/extend/start patterns to the new onPluginsReady callback. Handles Pattern A (.then chain) and Pattern B (await + imperative). Bails with a warning for complex cases (non-server usage of appkit handle, multiple extend calls). Includes fixes from review: - Use raw slice offset for brace matching (not trimmed) - Use brace-aware parsing for .catch() handlers with arrow functions - Bail out when multiple .extend() calls detected in Pattern B Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
- Remove entire `await appkit.server.start();` statements instead of just stripping `.start()` (which left dangling `await appkit.server;`) - Detect async callbacks in .then() and emit `async onPluginsReady` so await expressions inside the body remain valid Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
appkit codemod on-plugins-readyCLI command to auto-migrate apps from the oldautoStart/extend/startpattern to the newonPluginsReadycallback.Depends on #280.
Usage
What it does
.start(), injects asonPluginsReadyproperty, preserves.catch()handlers (including arrow functions with parens)onPluginsReady, removes standalone statements. Bails with warning for complex cases (non-server usage of appkit handle, multiple extend calls)autoStart: true/falsefrom allserver()configs, preserves other propertiescreateAppfrom@databricks/appkit--writeflag to apply changesTest plan
Demo
codemod-demo.mp4