-
Notifications
You must be signed in to change notification settings - Fork 72
feat: sync files from WebContainer to editor #334
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
Conversation
|
Deploying tutorialkit-demo-page with
|
Latest commit: |
c716577
|
Status: | ✅ Deploy successful! |
Preview URL: | https://987bfb79.tutorialkit-demo-page.pages.dev |
Branch Preview URL: | https://joan-sync-files-from-fs.tutorialkit-demo-page.pages.dev |
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.
Couple of comments/questions before going through the code. Code review coming tomorrow, but overall it looks good.
- Does this enable users to create files from terminal/commands so that they appear in file editor? If not, maybe this doesn't close Update _files content with scrips command #208?
- We should keep feat: add
template.visibleFiles
option #165 in mind during this PR. I think that could befilesystem.visible: string | string[]
. - Naming of
filesystem.syncChanges
. As this could in future also allow globs for watched files, should we rename this tofilesystem.watch
instead?
Thanks for the questions! 😃 Answering inline:
It does not at the moment. I was thinking we would do this later. Maybe as part of the What do you think?
I think it does. Or at least based on what the first comment says:
I think we can consider it closed when we merge this PR.
Oh I really like that naming! 🌟
Ah yeah this makes more sense, I'll rename it 👍 |
docs/tutorialkit.dev/src/content/docs/reference/configuration.mdx
Outdated
Show resolved
Hide resolved
e2e/src/content/tutorial/tests/filesystem-sync/happy-path/_files/a/b/baz.txt
Outdated
Show resolved
Hide resolved
Sounds good to me, let's leave it to the next PR. |
Co-authored-by: Ari Perkkiö <[email protected]>
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.
Looks good to me, nice work!
But one last thing before merging this: It would be good to add test case for verifying that when filesystem.watch
is false
or the default value, changes from webcontainer are not reflected to store. As this can have an impact on performance, we should be careful not to always enable this feature by accident.
Oh very good point!! Dang, I knew there was something missing with testing and this PR 😅 , I'll add it 👍 |
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.
Test case looks good, thanks for adding it! 💯
This PR adds a new property
filesystem
to the metadata of a Tutorial / Chapter / Lesson:When
syncChanges
is set totrue
, if files are modified on WebContainer via a terminal or by a process spawned manually via thewebcontainer
export ontutorialkit:core
, the changes will be reflected in the editor.Closes #208
This is opt-in because it can have a performance impact on the UI if lots of files are being modified / generated.
In the future we will likely accept
boolean | string
forsyncChanges
to be able to narrow down the watched files and improve performance.