这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@Angelmmiguel
Copy link
Contributor

After implementing the logic to retrieve, parse and manage language runtimes and repositories (see #63), this PR introduces the interface for developers to use it. The new runtimes command (the name is still under discussion and we may change it before v1.0.0) includes the following subcommands:

  • list: reads a remote repository and shows the available language runtimes in a table
  • install: install the desired runtime/s in the current project. Depending on the arguments provided, it will apply the following changes:
    • <name> <version>: load the remote repository and install the runtime locally. It will fetch the different files and edit the .wws.toml file to reflect the new runtime
    • No arguments: it loads the .wws.toml file and install the missing runtimes in the local project
  • check: load the .wws.toml file and checks if the required runtimes are installed locally
  • uninstall: remove all the local files related to a runtime and edit the .wws.toml file to remove that dependency.

All these commands will use by default the WebAssembly Language Runtimes project as the target repository. The index.toml files will be deployed as a static site and they will live in that repository.

If you want to use a different repository for listing and installing, you can set the --repo-name and --repo-url flags or set the WWS_REPO_NAME and WWS_REPO_URL environment variables:

export WWS_REPO_NAME=angel
export WWS_REPO_URL=https://raw.githubusercontent.com/Angelmmiguel/wws-index-test/main/index.toml
wws runtimes list
# or
wws runtimes --repo-name=repo --repo-url=https://raw.githubusercontent.com/Angelmmiguel/wws-index-test/main/index.toml list

After installing a runtime, wws stores all the metadata. Any other developer that installs the runtime will download the files from the right repository.

Examples

$ export WWS_REPO_NAME=angel
$ export WWS_REPO_URL=https://raw.githubusercontent.com/Angelmmiguel/wws-index-test/main/index.toml
$ ./wws runtimes check
┌───────────┬──────┬─────────┬───────────┬────────┐
│ Installed │ Name │ Version │ Extension │ Binary │
└───────────┴──────┴─────────┴───────────┴────────┘

💡 Tip: you can check the available language runtimes by running `wws runtimes list`
$ ./wws runtimes list
⚙️  Fetching data from the repository...
┌──────┬────────────────────────┬───────────┬───────────┐
│ Name │ Version                │ Extension │ Binary    │
├──────┼────────────────────────┼───────────┼───────────┤
│ ruby │ 3.2.0+20230118-8aec06d │ rb        │ ruby.wasm │
└──────┴────────────────────────┴───────────┴───────────┘
$ ./wws runtimes install ruby 3.2.0+20230118-8aec06d
⚙️  Fetching data from the repository...
🚀 Installing the runtime...
✅ Done
$ ./wws runtimes check
┌───────────┬──────┬────────────────────────┬───────────┬───────────┐
│ Installed │ Name │ Version                │ Extension │ Binary    │
├───────────┼──────┼────────────────────────┼───────────┼───────────┤
│ ✅        │ ruby │ 3.2.0+20230118-8aec06d │ rb        │ ruby.wasm │
└───────────┴──────┴────────────────────────┴───────────┴───────────┘
$ ./wws runtimes uninstall ruby 3.2.0+20230118-8aec06d
🗑 Uninstalling: angel - ruby / 3.2.0+20230118-8aec06d
✅ Done
$ ./wws runtimes check
┌───────────┬──────┬─────────┬───────────┬────────┐
│ Installed │ Name │ Version │ Extension │ Binary │
└───────────┴──────┴─────────┴───────────┴────────┘

💡 Tip: you can check the available language runtimes by running `wws runtimes list`

It closes #68

@Angelmmiguel Angelmmiguel added the 🚀 enhancement New feature or request label Jan 30, 2023
@Angelmmiguel Angelmmiguel requested a review from a team January 30, 2023 12:14
@Angelmmiguel Angelmmiguel self-assigned this Jan 30, 2023
Copy link
Contributor

@ereslibre ereslibre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, minor comment (unchecked)

@Angelmmiguel Angelmmiguel merged commit 254e151 into main Feb 1, 2023
@Angelmmiguel Angelmmiguel deleted the 68-runtimes-subcommand branch May 8, 2023 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add the new command to install a language runtime

4 participants