Skip to content

Commit 1097c3b

Browse files
committed
bugfix
1 parent efd3cf5 commit 1097c3b

File tree

3 files changed

+7
-15
lines changed

3 files changed

+7
-15
lines changed

hooks/available.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
local json = require("json")
2+
local http = require("http")
23
local nodejsUtils = require("nodejs_utils")
34

45
--- Return all available versions provided by this plugin

hooks/pre_use.lua

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,16 @@
1+
local nodejsUtils = require("nodejs_utils")
12
--- When user invoke `use` command, this function will be called to get the
23
--- valid version information.
34
--- @param ctx table Context information
45
function PLUGIN:PreUse(ctx)
5-
local runtimeVersion = ctx.runtimeVersion
66
--- user input version
77
local version = ctx.version
8-
--- user current used version
9-
local previousVersion = ctx.previousVersion
108

11-
--- installed sdks
12-
local sdkInfo = ctx.installedSdks['version']
13-
local path = sdkInfo.path
14-
local name = sdkInfo.name
15-
local version = sdkInfo.version
9+
local shorthands = nodejsUtils.calculate_shorthand(ctx.installedSdks)
1610

17-
--- working directory
18-
local cwd = ctx.cwd
19-
20-
--- user input scope
21-
--- could be one of global/project/session
22-
local scope = ctx.scope
11+
if not nodejsUtils.is_semver_simple(version) then
12+
version = shorthands[version]
13+
end
2314

2415
--- return the version information
2516
return {

metadata.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ PLUGIN = {}
55
--- Plugin name
66
PLUGIN.name = "nodejs"
77
--- Plugin version
8-
PLUGIN.version = "0.0.4"
8+
PLUGIN.version = "0.0.5"
99
--- Plugin repository
1010
PLUGIN.homepage = "https://github.com/version-fox/vfox-nodejs"
1111
--- Plugin license

0 commit comments

Comments
 (0)