From 5c24f27dd4364f847f87df47be3221c152a8e465 Mon Sep 17 00:00:00 2001 From: Taylor Bartlett Date: Mon, 10 Feb 2025 22:12:37 -0700 Subject: [PATCH 1/4] fix: remove bash extension in cmds, fix resolve +x --- lib/commands/{command-nodebuild.bash => command-nodebuild} | 2 +- lib/commands/{command-resolve.bash => command-resolve} | 2 +- .../{command-update-nodebuild.bash => command-update-nodebuild} | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename lib/commands/{command-nodebuild.bash => command-nodebuild} (98%) rename lib/commands/{command-resolve.bash => command-resolve} (95%) mode change 100644 => 100755 rename lib/commands/{command-update-nodebuild.bash => command-update-nodebuild} (98%) diff --git a/lib/commands/command-nodebuild.bash b/lib/commands/command-nodebuild similarity index 98% rename from lib/commands/command-nodebuild.bash rename to lib/commands/command-nodebuild index d849bfa..b446a05 100755 --- a/lib/commands/command-nodebuild.bash +++ b/lib/commands/command-nodebuild @@ -1,4 +1,4 @@ -#! /usr/bin/env bash +#!/usr/bin/env bash set -eu -o pipefail diff --git a/lib/commands/command-resolve.bash b/lib/commands/command-resolve old mode 100644 new mode 100755 similarity index 95% rename from lib/commands/command-resolve.bash rename to lib/commands/command-resolve index 7927993..6813d9a --- a/lib/commands/command-resolve.bash +++ b/lib/commands/command-resolve @@ -1,4 +1,4 @@ -#! /usr/bin/env bash +#!/usr/bin/env bash set -eu -o pipefail diff --git a/lib/commands/command-update-nodebuild.bash b/lib/commands/command-update-nodebuild similarity index 98% rename from lib/commands/command-update-nodebuild.bash rename to lib/commands/command-update-nodebuild index a3ae8a4..ce860c8 100755 --- a/lib/commands/command-update-nodebuild.bash +++ b/lib/commands/command-update-nodebuild @@ -1,4 +1,4 @@ -#! /usr/bin/env bash +#!/usr/bin/env bash set -eu -o pipefail From 059eb31cb7519ceabc5cc27f22e86a6bd41a07d7 Mon Sep 17 00:00:00 2001 From: Taylor Bartlett Date: Mon, 10 Feb 2025 22:13:12 -0700 Subject: [PATCH 2/4] fix: fix lts resolution and cmd names --- lib/utils.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/utils.sh b/lib/utils.sh index db8f5b9..5683807 100644 --- a/lib/utils.sh +++ b/lib/utils.sh @@ -41,7 +41,7 @@ colored() { export RED=31 GREEN=32 YELLOW=33 BLUE=34 MAGENTA=35 CYAN=36 nodebuild_wrapped() { - "$ASDF_NODEJS_PLUGIN_DIR/lib/commands/command-nodebuild.bash" "$@" + "$ASDF_NODEJS_PLUGIN_DIR/lib/commands/command-nodebuild" "$@" } try_to_update_nodebuild() { @@ -51,7 +51,7 @@ try_to_update_nodebuild() { local exit_code=0 - "$ASDF_NODEJS_PLUGIN_DIR/lib/commands/command-update-nodebuild.bash" 2>/dev/null || exit_code=$? + "$ASDF_NODEJS_PLUGIN_DIR/lib/commands/command-update-nodebuild" 2>/dev/null || exit_code=$? if [ "$exit_code" != 0 ]; then printf " @@ -152,6 +152,9 @@ resolve_version() { if [ "$query" = lts ] || [ "$query" = "lts/*" ]; then query="${nodejs_codenames[${#nodejs_codenames[@]} - 1]#*:}" + local all_versions + all_versions=$("$ASDF_NODEJS_PLUGIN_DIR/bin/list-all" 2>/dev/null | tr ' ' '\n') + query=$(echo "$all_versions" | grep "^$query\." | tail -n1) fi if [ "${ASDF_NODEJS_LEGACY_FILE_DYNAMIC_STRATEGY-}" ]; then From cf9d021948cd15415b34c958aead420d7c50d462 Mon Sep 17 00:00:00 2001 From: Taylor Bartlett Date: Mon, 10 Feb 2025 22:29:41 -0700 Subject: [PATCH 3/4] fix: update README to reflect v0.16 subcommands --- README.md | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 71479ab..9106dfe 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ You can specify a non-default location of this file by setting a `ASDF_NPM_DEFAU We provide a command for running the installed `node-build` command: ```bash -asdf nodejs nodebuild --version +asdf cmd nodejs nodebuild --version ``` ### node-build advanced variations @@ -122,7 +122,7 @@ Some of them will work out of the box, and some will need a bit of investigation To list all the available variations run: ```bash -asdf nodejs nodebuild --definitions +asdf cmd nodejs nodebuild --definitions ``` _Note that this command only lists the current `node-build` definitions. You might want to [update the local `node-build` repository](#updating-node-build-definitions) before listing them._ @@ -132,7 +132,7 @@ _Note that this command only lists the current `node-build` definitions. You mig Every new node version needs to have a definition file in the `node-build` repository. `asdf-nodejs` already tries to update `node-build` on every new version installation, but if you want to update `node-build` manually for some reason we provide a command just for that: ```bash -asdf nodejs update-nodebuild +asdf cmd nodejs update-nodebuild ``` ### Integrity/signature check @@ -141,21 +141,24 @@ In the past `asdf-nodejs` checked for signatures and integrity by querying live ### Resolving latest available LTS version in a script -This plugin adds a custom subcommand `asdf nodejs resolve lts`. If you want to know what is the latest available LTS major version number you can do this: +This plugin adds a custom subcommand `asdf cmd nodejs resolve lts`. If you want to know what is the latest available LTS major version number you can do this: + ```sh # Before checking for aliases, update nodebuild to check for newly releasead versions -asdf nodejs update-nodebuild +asdf cmd nodejs update-nodebuild -asdf nodejs resolve lts +asdf cmd nodejs resolve lts # outputs: 22.11.0 ``` + You also have the option of forcing a resolution strategy by using the flags `--latest-installed` and `--latest-available` + ```bash # Outputs the latest version installed locally which is a LTS -asdf nodejs resolve lts --latest-installed +asdf cmd nodejs resolve lts --latest-installed # Outputs the latest version available for download which is a LTS -asdf nodejs resolve lts --latest-available +asdf cmd nodejs resolve lts --latest-available ``` ## Corepack From 7cbcb5078ff3d19153e378b5c6cb1cbb35777ce9 Mon Sep 17 00:00:00 2001 From: Taylor Bartlett Date: Mon, 10 Feb 2025 22:31:41 -0700 Subject: [PATCH 4/4] fix: node version in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9106dfe..c1f8ab9 100644 --- a/README.md +++ b/README.md @@ -148,7 +148,7 @@ This plugin adds a custom subcommand `asdf cmd nodejs resolve lts`. If you want asdf cmd nodejs update-nodebuild asdf cmd nodejs resolve lts -# outputs: 22.11.0 +# outputs: 22.13.1 ``` You also have the option of forcing a resolution strategy by using the flags `--latest-installed` and `--latest-available`