webcontainer-core icon indicating copy to clipboard operation
webcontainer-core copied to clipboard

webcontainer how to use git command

Open zFitness opened this issue 1 year ago • 3 comments
trafficstars

webcontainer how to use git command?

zFitness avatar Feb 19 '24 08:02 zFitness

Hi @zFitness, can you describe your problem?

We can't answer this question, since it is too vague and ambiguous.

fvsch avatar Feb 19 '24 09:02 fvsch

Hi @zFitness, can you describe your problem?

We can't answer this question, since it is too vague(含糊) and ambiguous(暧昧).

sorry now, We can use the git command in the terminal of stackblitz, but not in webcontainer

zFitness avatar Feb 20 '24 03:02 zFitness

in the terminal of stackblitz, but not in webcontainer

Hi, can you elaborate which terminals are you referring to?

jrvidal avatar Feb 20 '24 12:02 jrvidal

on the stackblitz website there are additional libraries and capabilities available in the webcontainer running there. For example hooking up git, or running commands that generate zip files. image

If running a web container elsewhere for example like https://hax.cloud/ and typing git status or running commands to generate a zip, these do not work. Is there a documented API for how to add additional capabilities to the container or are these proprietary container enhancements beyond the open source version here?

btopro avatar Oct 21 '24 14:10 btopro

Is there a documented API for how to add additional capabilities to the container or are these proprietary container enhancements beyond the open source version here?

You should be able to add files to the WebContainer filesystem and make them executable. Looks like $PATH is set to /bin:/usr/bin:/usr/local/bin, but adding a file to /usr/local/bin might not be possible. So you might need to add it somewhere else and call it with ./path/to/my-executable.

Since only Node.js and WASM code are supported, you would need to make it a Node script or a WASM executable (though I/O may be limited, unless WebContainer has some level of WASI support).

For Git, maybe isomorphic-git might work?

fvsch avatar Oct 21 '24 16:10 fvsch