Skip to content

Not able to create new files from terminal #419

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

Closed
shhdharmen opened this issue Nov 16, 2024 · 3 comments
Closed

Not able to create new files from terminal #419

shhdharmen opened this issue Nov 16, 2024 · 3 comments
Labels
question Question related to TutorialKit that doesn't require changes in codebase.

Comments

@shhdharmen
Copy link

shhdharmen commented Nov 16, 2024

Describe the bug

Even after keeping allowRedirects: true (under terminals > panels) and watch: true (under filesystem), we are not able to create new files from terminal. Example: echo hello > world.txt. Observe that file is created in webcontainer fs, but not getting reflected in editor's file-tree.

Link to a StackBlitz project which shows the error

https://stackblitz.com/edit/tutorialkit-api-use-helpbutton-yfxyqb?file=src%2Fcontent%2Ftutorial%2F1-basics%2F1-introduction%2F1-welcome%2Fcontent.mdx

Steps to reproduce

  1. Go to https://stackblitz.com/edit/tutorialkit-api-use-helpbutton-yfxyqb?file=src%2Fcontent%2Ftutorial%2F1-basics%2F1-introduction%2F1-welcome%2Fcontent.mdx
  2. Click on "Toggle Terminal"
  3. Go to interactive "Terminal"
  4. Write command to create file, example echo hello > world.txt
  5. Observe that file is created in webcontainer's fs using ls
  6. Observe that file is not reflected in editor's file-tree

Expected behavior

If we keep allowRedirects: true, it should show newly created file in editor's file-tree

For example, if we write echo hello > world.txt in interactive terminal, it should create file named "world.txt" in editor's file-tree.

Screenshots

Screen.Recording.2024-11-16.144557.mp4

Platform

  • TutorialKit version: 1.3.0
  • OS: Window
  • Browser: Edge
  • Version: 130.0.2849.80

Additional context

No response

Copy link

@AriPerkkio
Copy link
Member

To include new added files into watch, you need pass glob patterns that match these files. It's recommended to be as specific as possible with these patterns. So based on your reproduction something like below should work:

filesystem:
  watch: ['/hello.txt']

Watching whole file system for new files is expensive for performance - that's why filesystem.watch: true won't consider newly added files, it only watches existing files.

https://tutorialkit.dev/reference/configuration/#filesystem

@AriPerkkio AriPerkkio added the question Question related to TutorialKit that doesn't require changes in codebase. label Nov 16, 2024
@shhdharmen
Copy link
Author

Thanks for your prompt response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question related to TutorialKit that doesn't require changes in codebase.
Projects
None yet
Development

No branches or pull requests

2 participants