-
Notifications
You must be signed in to change notification settings - Fork 66
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
feat: sync new files from WebContainer to editor #394
feat: sync new files from WebContainer to editor #394
Conversation
Run & review this pull request in StackBlitz Codeflow. |
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.
In #334 it was discussed whether we should allow fs.watch: [<glob>, <glob>]
. I think instead of adding new addNewFilesInPaths
, we should instead make this a default functionality of fs.watch
. And add pattern matching for fs.watch
to avoid performance issues.
@Nemikolh has better understanding of fs.watch
so let's wait for his comments before any changes.
That API would work for me. I'm happy to implement it once @Nemikolh has a chance to review. |
Hey! Thanks a ton for the PR 😃 The proposal of having In terms of performance concerns, we won't be able to provide that down to |
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 pretty good!
Once this is implemented using watch
, we can merge it ✨
b920c77
to
00f514a
Compare
PR and description updated to allow an array in the |
|
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.
Fantastic work on this @isaacplmann ! 🤩
Love it 😍
Co-authored-by: Jòan <[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.
Yup the code looks good to me. I'll do some manual testing before next release. Probably tomorrow.
/pkg-pr-new
|
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.
There's a bug in new file/folder creation. Empty folders are added/duplicated. Is this just related to the test case or an actual bug?
tk-fs-bug.mov
Updated documentation as well |
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, thanks @isaacplmann! 💯
Released in |
I work at Nx and in order to use tutorialkit for our tutorials, we need the editor to show files that are created by terminal commands.
This PR shows a prototype that enables the editor to show new files in the webcontainer that are created in a specific set of paths. This is needed to use tutorialkit for Nx tutorials.
Updates the
watch
lesson property to take either aboolean
orstring[]
. If passing astring[]
it is interpreted as a list of globs.I added e2e tests for the new functionality as well.
If
watch
is false or undefined, existing files are not synced and new files are not created.If
watch
is true, existing files are synced, but new files are not created.If
watch
is an array of glob strings, existing files are synced and new files whose paths match one of the globs listed in thewatch
array are created in the editor. Files that are deleted in one of the glob patterns are removed from the editor. New files that are not in those paths do not get added to the editor.