r-wasm / rwasm

Build R packages for WebAssembly and create a CRAN-like repo for distribution.
https://r-wasm.github.io/rwasm/
Other
54 stars 4 forks source link

Mounting filesystem images vignette unclear #24

Open JosiahParry opened 5 months ago

JosiahParry commented 5 months ago

The vignette for mounting file system images seems like it will help me understand how to build an R package for webr but im quite lost while reading it. It indicates that we should use rwasm::add_pkg() to build a package repo. Though the context is unclear. https://github.com/r-wasm/rwasm/blob/c60e4eb4ed2338763dadd32140840de7a1c24846/vignettes/mount-fs-image.Rmd#L16-L20

Should the rwasm be installed from pak into a webr interpreter? If so, how is that done? Should rwasm be used from a normal R session and then the output added into an active webr session?

If additional context about where these commands should be ran that would be very helpful!

georgestagg commented 5 months ago

The vignette for mounting file system images seems like it will help me understand how to build an R package for webr but im quite lost while reading it.

Have you read the Getting Started document yet? It tries to lead you through creating a package repository and is targeted more towards beginners.

The "Mounting filesystem images" method is only really beneficial over creating a package repository if you have arbitrary data you'd like to include on the virtual filesystem. If you're only really interested in building R packages, you don't strictly need to build a full filesystem image with rwasm::make_vfs_library() and can do without the steps described in that vignette.

Should the rwasm be installed from pak into a webr interpreter?

No, rwasm should be installed in a traditional R system so that R packages can be cross-compiled for WebAssembly in an environment where the WebAssembly build tools are available. Hopefully, this is made clearer in the Getting Started document.

Should rwasm be used from a normal R session and then the output added into an active webr session?

Correct. Again, the Getting Started vignette describes both a "local testing" method and "static deployment" method to make the R packages available to webR.