Skip to content

Clarify "allowCommands" setup #190

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
eric-burel opened this issue Jul 30, 2024 · 3 comments
Closed

Clarify "allowCommands" setup #190

eric-burel opened this issue Jul 30, 2024 · 3 comments

Comments

@eric-burel
Copy link
Contributor

eric-burel commented Jul 30, 2024

Is your feature request related to a problem?

I am hitting an error jsh: permission denied: astro when switching from the Vite default template to an Astro app.
After some digging, this seems to be a security system that prevents the terminal to run random commands in the webcontainer. And it seems that the allowCommands configuration field should help with that, but I fail to figure it out based on the current documentation.

image

Describe the solution you'd like.

  • We may be able to define some default allowed commands at template level, or at tutorial level
  • The allowCommands setting should be made explicit in the Vite demo so we quickly figure how to tweak it for a new technology (if it's the right setting which I am not sure of yet)
  • The permission denied error could be made more explicit
  • Tiny improvements : highlight and ctrl+c doesn't seem to work in the terminal, also I observe a freeze just before the webcontainer starts installing package, not sure of the cause yet
  • I am pretty sure I didn't observe the same behaviour on my other computer, the Next app was running with no setting from me. I don't have a reliable reproduction yet, perhaps you updated the project since.

Describe alternatives you've considered.

I've tried setting up my lesson frontmatter like so, no luck:

---
type: lesson
title: Welcome to AstroPatterns
terminal:
  panels: "output"
  allowCommands: ["astro"]

Additional context

I think the error is related to allowCommands but perhaps the "jsh" error stems from another issue I don't know about.

@AriPerkkio
Copy link
Member

If this was coming from allowComands you should see error jsh: the 'astro' command is disabled and cannot be used..

Could you check if you are running into similar issue as #187 by checking that src/templates/** has no node_modules?

@eric-burel
Copy link
Contributor Author

Awesome, closing in favour of #187
It does have a node_modules indeed, I create new templates by running commands which usually install node_modules too

@AriPerkkio
Copy link
Member

This is now fixed in 0.1.2 versions. Now node_modules of templates are not copied to lesson code. It's safe to have node_module present on file system for testing purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants