Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
aooohan committed Mar 26, 2024
1 parent efd3cf5 commit 1097c3b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
1 change: 1 addition & 0 deletions hooks/available.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
local json = require("json")
local http = require("http")
local nodejsUtils = require("nodejs_utils")

--- Return all available versions provided by this plugin
Expand Down
19 changes: 5 additions & 14 deletions hooks/pre_use.lua
Original file line number Diff line number Diff line change
@@ -1,25 +1,16 @@
local nodejsUtils = require("nodejs_utils")
--- When user invoke `use` command, this function will be called to get the
--- valid version information.
--- @param ctx table Context information
function PLUGIN:PreUse(ctx)
local runtimeVersion = ctx.runtimeVersion
--- user input version
local version = ctx.version
--- user current used version
local previousVersion = ctx.previousVersion

--- installed sdks
local sdkInfo = ctx.installedSdks['version']
local path = sdkInfo.path
local name = sdkInfo.name
local version = sdkInfo.version
local shorthands = nodejsUtils.calculate_shorthand(ctx.installedSdks)

--- working directory
local cwd = ctx.cwd

--- user input scope
--- could be one of global/project/session
local scope = ctx.scope
if not nodejsUtils.is_semver_simple(version) then
version = shorthands[version]
end

--- return the version information
return {
Expand Down
2 changes: 1 addition & 1 deletion metadata.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PLUGIN = {}
--- Plugin name
PLUGIN.name = "nodejs"
--- Plugin version
PLUGIN.version = "0.0.4"
PLUGIN.version = "0.0.5"
--- Plugin repository
PLUGIN.homepage = "https://github.com/version-fox/vfox-nodejs"
--- Plugin license
Expand Down

0 comments on commit 1097c3b

Please sign in to comment.