-
Notifications
You must be signed in to change notification settings - Fork 30
Refactor preview site updating to depend on CLI #1223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor preview site updating to depend on CLI #1223
Conversation
…end-on-cli-preview-site-updating
…end-on-cli-preview-site-updating
@@ -14,7 +14,6 @@ import { PromptUsageProvider } from 'src/hooks/use-prompt-usage'; | |||
import { SiteDetailsProvider } from 'src/hooks/use-site-details'; | |||
import { SnapshotProvider } from 'src/hooks/use-snapshots'; | |||
import { ThemeDetailsProvider } from 'src/hooks/use-theme-details'; | |||
import { DemoSiteUpdateProvider } from 'src/hooks/use-update-demo-site'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😍
thunkAPI | ||
) => { | ||
const state = thunkAPI.getState() as RootState; | ||
const snapshot = state.snapshot.snapshots.find( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
state.snapshot.snapshots.find(
NIT but I am thinking - maybe we should use a less generic slice name, instead of snapshot
, maybe to add some postfix, to simplify reading code. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
snapshot.snapshots
could be somewhat confusing at first glance, but changing the store name to something like snapshotStore
or snapshotSlice
seems redundant to me, and for consistency's sake, it would also require us to change the other slice names (adding even more redundant naming). Given that, I would prefer to keep the name as-is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM and updating works es expected 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested as described
LGTM 👍
@@ -0,0 +1,79 @@ | |||
import crypto from 'crypto'; | |||
import { z } from 'zod'; | |||
import { CreateLoggerAction } from 'cli/commands/preview/logger-actions'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that we have the common
folder let's try to move code there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in #1230 👍
* [WIP] Refactor Studio to depend on CLI for preview site creation * More changes * Fix * Use node's child_process module to fork CLI process * Tests * useGetSnapshotUsage * Build CLI before starting dev version of app * Tweaks * Fixes * preview ➡️ snapshot * Improved progress bar * Display notice when operation completes * Update zod * Remove useArchiveSite hook * Fix test * Modify exitCode in Logger::reportError * Set exit code on error and fix outputFormat parsing * Shorten * Fix outputFormat parsing * Clarify naming * Refactor preview site updating to depend on CLI * Clean up * Tweak * Tweaks
Related issues
Proposed Changes
Testing Instructions
Pre-merge Checklist