feat: sync new files from WebContainer to editor#394
feat: sync new files from WebContainer to editor#394AriPerkkio merged 11 commits intostackblitz:mainfrom
Conversation
|
|
AriPerkkio
left a comment
There was a problem hiding this comment.
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 |
Nemikolh
left a comment
There was a problem hiding this comment.
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 |
|
Nemikolh
left a comment
There was a problem hiding this comment.
Fantastic work on this @isaacplmann ! 🤩
Love it 😍
Co-authored-by: Jòan <Nemikolh@users.noreply.github.com>
AriPerkkio
left a comment
There was a problem hiding this comment.
Yup the code looks good to me. I'll do some manual testing before next release. Probably tomorrow.
|
/pkg-pr-new
|
AriPerkkio
left a comment
There was a problem hiding this comment.
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 |
AriPerkkio
left a comment
There was a problem hiding this comment.
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
watchlesson property to take either abooleanorstring[]. If passing astring[]it is interpreted as a list of globs.I added e2e tests for the new functionality as well.
If
watchis false or undefined, existing files are not synced and new files are not created.If
watchis true, existing files are synced, but new files are not created.If
watchis an array of glob strings, existing files are synced and new files whose paths match one of the globs listed in thewatcharray 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.