lethang7794 / asdf-demo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

asdf-demo

What is asdf?

asdf1 is a tool version manager.

All tool version definitions are contained within one file (.tool-versions2) which you can check in to your project's Git repository to share with your team.

Why use asdf?

asdf

  • ensures teams are using the exact same versions of tools (for each project)
  • supports Github Actions (you can use the same configuration for local dev machine and CI/CD workflows)
  • support for many tools via a plugin system3
  • is simple (it's a single Shell script you include in your Shell config)

Getting started

  • Install asdf core4: official guide5

  • Install asdf plugins & the tools for each project

    • For each of the projects, e.g. node-19, node-20

      • "Install" asdf plugins6 for tools defined in .tool-versions

        cat .tool-versions | awk '{print $1}' | xargs -I _ asdf plugin add _

        [!IMPORTANT] You need to "install" plugin for a tool, before using asdf to install a version of that tool.

        e.g.

        asdf plugin add node

        [!TIP] Plugins are how asdf knows to handle different tools like Node.js, Ruby, ...

    • For each of the tool, install the version defined in .tool-versions

    asdf install

    [!TIP] In asdf words, asdf install "Installs all the package versions listed in the .tool-versions file"

  • Confirm that for each project, the correct version of tool is invoked

    cd node-19
    node -v       # Should be v19.0.0
    cd ../node-20 #
    node -v       # Should be v20.0.0
    cd kubectl-1.28.3
    kubectl version      # Client Version: v1.28.3
    cd ../kubectl-1.29.4 #
    kubectl version      # Client Version: v1.29.4

Caution

A completions that match a version of a tool is still an unsolved problem7.

Footnotes

  1. https://asdf-vm.com/

  2. https://asdf-vm.com/manage/configuration.html#tool-versions

  3. https://github.com/asdf-community

  4. https://asdf-vm.com/manage/core.html

  5. https://asdf-vm.com/guide/getting-started.html

  6. https://asdf-vm.com/manage/plugins.html

  7. Support command completions from installed tools - Issue #752

About

License:MIT License