Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
风弥漫了夏天
nvm-windows
提交
7a454431
N
nvm-windows
项目概览
风弥漫了夏天
/
nvm-windows
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
nvm-windows
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
7a454431
编写于
7月 01, 2016
作者:
C
Corey Butler
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Cleaned up PR's, added formatting for ls, updated installer to 1.1.1
上级
19f8b228
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
178 addition
and
70 deletion
+178
-70
LICENSE
LICENSE
+1
-2
build.bat
build.bat
+33
-29
nvm.iss
nvm.iss
+3
-3
src/nvm.go
src/nvm.go
+69
-26
src/nvm/node/node.go
src/nvm/node/node.go
+72
-10
未找到文件。
LICENSE
浏览文件 @
7a454431
The MIT License (MIT)
The MIT License (MIT)
Copyright (c) 2014 Corey Butler
Copyright (c) 2014 Corey Butler
and contributors.
Permission is hereby granted, free of charge, to any person obtaining a copy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
of this software and associated documentation files (the "Software"), to deal
...
@@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
...
@@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
build.bat
浏览文件 @
7a454431
...
@@ -4,53 +4,57 @@ SET ORIG=%CD%
...
@@ -4,53 +4,57 @@ SET ORIG=%CD%
SET
GOPATH
=
%CD%
\src
SET
GOPATH
=
%CD%
\src
SET
GOBIN
=
%CD%
\bin
SET
GOBIN
=
%CD%
\bin
SET
GOARCH
=
386
SET
GOARCH
=
386
SET
version
=
1
.1.1
REM Get the version number from the setup file
REM Get the version number from the setup file
for
/f
"tokens=*"
%%i
in
(
'findstr /n .
%INNOSETUP%
^|
findstr
^4
:#define'
)
do
set
L
=
%%i
REM
for /f "tokens=*" %%i in ('findstr /n . %INNOSETUP% ^| findstr ^4:#define') do set L=%%i
set
version
=
%L
:
~
24
,-
1
%
REM
set version=%L:~24,-1%
REM Get the version number from the core executable
REM Get the version number from the core executable
for
/f
"tokens=*"
%%i
in
(
'findstr /n .
%GOPATH%
\nvm.go
^|
findstr
^N
vmVersion
^|
findstr
^2
1
^'
) do set L=
%%i
REM
for /f "tokens=*" %%i in ('findstr /n . %GOPATH%\nvm.go ^| findstr ^NvmVersion^| findstr ^21^') do set L=%%i
set goversion=
%L
:~19,-1
%
REM
set goversion=%L:~19,-1%
IF NOT
%version%
==
%goversion%
GOTO VERSIONMISMATCH
REM
IF NOT %version%==%goversion% GOTO VERSIONMISMATCH
SET
DIST
=
%CD%
\dist\
%version%
SET
DIST
=
%CD%
\dist\
%version%
REM Build the executable
REM Build the executable
echo
Building
NVM
for
Windows
echo
Building
NVM
for
Windows
rm
%GOBIN%
\nvm.exe
REM
rm %GOBIN%\nvm.exe
cd
%GOPATH%
REM
cd %GOPATH%
echo
"=========================================>"
echo
"=========================================>"
echo
%GOBIN%
REM echo %GOBIN%
goxc -arch="386" -os="windows" -n="nvm" -d="
%GOBIN%
" -o="
%GOBIN%
\nvm{{.Ext}}" -tasks-=package
REM goxc -arch="386" -os="windows" -n="nvm" -d="%GOBIN%" -o="%GOBIN%\nvm{{.Ext}}" -tasks-=package
cd
%ORIG%
rm
%GOBIN%
\src.exe
REM cd %ORIG%
rm
%GOPATH%
\src.exe
REM rm %GOBIN%\src.exe
rm
%GOPATH%
\nvm.exe
REM rm %GOPATH%\src.exe
REM rm %GOPATH%\nvm.exe
REM Clean the dist directory
REM Clean the dist directory
rm
-rf
"
%DIST%
"
rm
-rf
"
%DIST%
"
mkdir
"
%DIST%
"
mkdir
"
%DIST%
"
REM Create the "noinstall" zip
echo
Creating
distribution
in
%DIST%
echo Generating nvm-noinstall.zip
if
exist
src
\nvm.exe
(
rm
src
\nvm.exe
)
echo
"Building nvm.exe...."
go
build
src
\nvm.go
mv
nvm
.exe
%GOBIN%
echo
Building
"noinstall"
zip
...
for
/d
%%a
in
(
%GOBIN%
)
do
(
buildtools
\zip
-j
-
9
-r
"
%DIST%
\nvm-noinstall.zip"
"
%CD%
\LICENSE"
"
%%a
\*"
-x
"
%GOBIN%
\nodejs.ico"
)
for
/d
%%a
in
(
%GOBIN%
)
do
(
buildtools
\zip
-j
-
9
-r
"
%DIST%
\nvm-noinstall.zip"
"
%CD%
\LICENSE"
"
%%a
\*"
-x
"
%GOBIN%
\nodejs.ico"
)
REM Create the installer
echo
"Building the primary installer..."
echo Generating nvm-setup.zip
buildtools
\iscc
%INNOSETUP%
/o
%DIST%
buildtools
\iscc
%INNOSETUP%
/o
%DIST%
buildtools
\zip
-j
-
9
-r
"
%DIST%
\nvm-setup.zip"
"
%DIST%
\nvm-setup.exe"
buildtools
\zip
-j
-
9
-r
"
%DIST%
\nvm-setup.zip"
"
%DIST%
\nvm-setup.exe"
REM rm "
%DIST%
\nvm-setup.exe"
echo --------------------------
echo
"Distribution created. Now cleaning up...."
echo Release
%version%
available in
%DIST%
rm
%GOBIN%
/nvm
.exe
GOTO COMPLETE
echo
"Done."
:VERSIONMISMATCH
echo The version number in nvm.iss does not match the version in src\nvm.go
echo - nvm.iss line #4:
%version%
echo - nvm.go line #21:
%goversion%
EXIT /B
:COMPLETE
@echo
on
@echo
on
nvm.iss
浏览文件 @
7a454431
#define MyAppName "NVM for Windows"
#define MyAppName "NVM for Windows"
#define MyAppShortName "nvm"
#define MyAppShortName "nvm"
#define MyAppLCShortName "nvm"
#define MyAppLCShortName "nvm"
#define MyAppVersion "1.1.
0
"
#define MyAppVersion "1.1.
1
"
#define MyAppPublisher "Ecor Ventures
,
LLC"
#define MyAppPublisher "Ecor Ventures LLC"
#define MyAppURL "http://github.com/coreybutler/nvm"
#define MyAppURL "http://github.com/coreybutler/nvm"
#define MyAppExeName "nvm.exe"
#define MyAppExeName "nvm.exe"
#define MyIcon "bin\nodejs.ico"
#define MyIcon "bin\nodejs.ico"
...
@@ -35,7 +35,7 @@ ChangesEnvironment=yes
...
@@ -35,7 +35,7 @@ ChangesEnvironment=yes
DisableProgramGroupPage=yes
DisableProgramGroupPage=yes
ArchitecturesInstallIn64BitMode=x64 ia64
ArchitecturesInstallIn64BitMode=x64 ia64
UninstallDisplayIcon={app}\{#MyIcon}
UninstallDisplayIcon={app}\{#MyIcon}
AppCopyright=Copyright (C) 201
4 Corey Butler
.
AppCopyright=Copyright (C) 201
6 Corey Butler and contributors
.
[Languages]
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "english"; MessagesFile: "compiler:Default.isl"
...
...
src/nvm.go
浏览文件 @
7a454431
...
@@ -8,16 +8,15 @@ import (
...
@@ -8,16 +8,15 @@ import (
"io/ioutil"
"io/ioutil"
"regexp"
"regexp"
"bytes"
"bytes"
"strconv"
"./nvm/web"
"./nvm/web"
"./nvm/arch"
"./nvm/arch"
"./nvm/file"
"./nvm/file"
"./nvm/node"
"./nvm/node"
// "./ansi
"
"github.com/olekukonko/tablewriter
"
)
)
const
(
const
(
NvmVersion
=
"1.1.
0
"
NvmVersion
=
"1.1.
1
"
)
)
type
Environment
struct
{
type
Environment
struct
{
...
@@ -159,7 +158,7 @@ func install(version string, cpuarch string) {
...
@@ -159,7 +158,7 @@ func install(version string, cpuarch string) {
if
cpuarch
!=
"all"
{
if
cpuarch
!=
"all"
{
cpuarch
=
arch
.
Validate
(
cpuarch
)
cpuarch
=
arch
.
Validate
(
cpuarch
)
}
}
// If user specifies "latest" version, find out what version is
// If user specifies "latest" version, find out what version is
if
version
==
"latest"
{
if
version
==
"latest"
{
url
:=
web
.
GetFullNodeUrl
(
"latest/SHASUMS256.txt"
);
url
:=
web
.
GetFullNodeUrl
(
"latest/SHASUMS256.txt"
);
...
@@ -173,7 +172,7 @@ func install(version string, cpuarch string) {
...
@@ -173,7 +172,7 @@ func install(version string, cpuarch string) {
fmt
.
Println
(
"Node.js v"
+
version
+
" is not yet released or available."
)
fmt
.
Println
(
"Node.js v"
+
version
+
" is not yet released or available."
)
return
return
}
}
if
cpuarch
==
"64"
&&
!
web
.
IsNode64bitAvailable
(
version
)
{
if
cpuarch
==
"64"
&&
!
web
.
IsNode64bitAvailable
(
version
)
{
fmt
.
Println
(
"Node.js v"
+
version
+
" is only available in 32-bit."
)
fmt
.
Println
(
"Node.js v"
+
version
+
" is only available in 32-bit."
)
return
return
...
@@ -262,6 +261,8 @@ func uninstall(version string) {
...
@@ -262,6 +261,8 @@ func uninstall(version string) {
return
return
}
}
version
=
cleanVersion
(
version
)
// Determine if the version exists and skip if it doesn't
// Determine if the version exists and skip if it doesn't
if
node
.
IsVersionInstalled
(
env
.
root
,
version
,
"32"
)
||
node
.
IsVersionInstalled
(
env
.
root
,
version
,
"64"
)
{
if
node
.
IsVersionInstalled
(
env
.
root
,
version
,
"32"
)
||
node
.
IsVersionInstalled
(
env
.
root
,
version
,
"64"
)
{
fmt
.
Printf
(
"Uninstalling node v"
+
version
+
"..."
)
fmt
.
Printf
(
"Uninstalling node v"
+
version
+
"..."
)
...
@@ -283,8 +284,25 @@ func uninstall(version string) {
...
@@ -283,8 +284,25 @@ func uninstall(version string) {
return
return
}
}
func
use
(
version
string
,
cpuarch
string
)
{
func
cleanVersion
(
version
string
)
string
{
re
:=
regexp
.
MustCompile
(
"
\\
d+.
\\
d+.
\\
d+"
)
matched
:=
re
.
FindString
(
version
)
if
len
(
matched
)
==
0
{
re
=
regexp
.
MustCompile
(
"
\\
d+.
\\
d+"
)
matched
=
re
.
FindString
(
version
)
if
len
(
matched
)
==
0
{
matched
=
version
+
".0.0"
}
else
{
matched
=
matched
+
".0"
}
fmt
.
Println
(
matched
)
}
return
matched
}
func
use
(
version
string
,
cpuarch
string
)
{
if
version
==
"32"
||
version
==
"64"
{
if
version
==
"32"
||
version
==
"64"
{
cpuarch
=
version
cpuarch
=
version
v
,
_
:=
node
.
GetCurrentVersion
()
v
,
_
:=
node
.
GetCurrentVersion
()
...
@@ -293,6 +311,10 @@ func use(version string, cpuarch string) {
...
@@ -293,6 +311,10 @@ func use(version string, cpuarch string) {
cpuarch
=
arch
.
Validate
(
cpuarch
)
cpuarch
=
arch
.
Validate
(
cpuarch
)
re
:=
regexp
.
MustCompile
(
"
\\
d+.
\\
d+.
\\
d+"
)
version
=
cleanVersion
(
version
)
// Make sure the version is installed. If not, warn.
// Make sure the version is installed. If not, warn.
if
!
node
.
IsVersionInstalled
(
env
.
root
,
version
,
cpuarch
)
{
if
!
node
.
IsVersionInstalled
(
env
.
root
,
version
,
cpuarch
)
{
fmt
.
Println
(
"node v"
+
version
+
" ("
+
cpuarch
+
"-bit) is not installed."
)
fmt
.
Println
(
"node v"
+
version
+
" ("
+
cpuarch
+
"-bit) is not installed."
)
...
@@ -407,35 +429,56 @@ func list(listtype string) {
...
@@ -407,35 +429,56 @@ func list(listtype string) {
fmt
.
Println
(
"No installations recognized."
)
fmt
.
Println
(
"No installations recognized."
)
}
}
}
else
{
}
else
{
_
,
lts
,
stable
,
_
:=
node
.
GetAvailable
()
_
,
lts
,
current
,
stable
,
un
stable
,
_
:=
node
.
GetAvailable
()
releases
:=
len
(
stable
)
releases
:=
20
fmt
.
Println
(
"
\n
Showing the "
+
strconv
.
Itoa
(
releases
)
+
" latest available releases.
\n
"
)
data
:=
make
([][]
string
,
releases
,
releases
+
5
)
for
i
:=
0
;
i
<
releases
;
i
++
{
release
:=
make
([]
string
,
4
,
6
)
fmt
.
Println
(
" LTS | STABLE "
)
release
[
0
]
=
""
fmt
.
Println
(
" ---------------------------"
)
release
[
1
]
=
""
release
[
2
]
=
""
release
[
3
]
=
""
if
len
(
current
)
>
i
{
if
len
(
current
[
i
])
>
0
{
release
[
0
]
=
current
[
i
]
}
}
for
i
:=
0
;
i
<
releases
;
i
++
{
str
:=
" "
if
len
(
lts
)
>
i
{
if
len
(
lts
)
>
i
{
str
=
"v"
+
lts
[
i
]
if
len
(
lts
[
i
])
>
0
{
for
ii
:=
10
-
len
(
str
);
ii
>
0
;
ii
--
{
release
[
1
]
=
lts
[
i
]
str
=
" "
+
str
}
}
}
}
str2
:=
""
if
len
(
stable
)
>
i
{
if
len
(
stable
)
>
i
{
str2
=
"v"
+
stable
[
i
]
if
len
(
stable
[
i
])
>
0
{
for
ii
:=
10
-
len
(
str2
);
ii
>
0
;
ii
--
{
release
[
2
]
=
stable
[
i
]
str2
=
" "
+
str2
}
}
if
len
(
unstable
)
>
i
{
if
len
(
unstable
[
i
])
>
0
{
release
[
3
]
=
unstable
[
i
]
}
}
}
}
fmt
.
Println
(
" "
+
str
+
" | "
+
str2
)
data
[
i
]
=
release
}
}
fmt
.
Println
(
"
\n
For a complete list, visit https://nodejs.org/download/release"
)
fmt
.
Println
(
""
)
table
:=
tablewriter
.
NewWriter
(
os
.
Stdout
)
table
.
SetHeader
([]
string
{
" Current "
,
" LTS "
,
" Old Stable "
,
"Old Unstable"
})
table
.
SetBorders
(
tablewriter
.
Border
{
Left
:
true
,
Top
:
false
,
Right
:
true
,
Bottom
:
false
})
table
.
SetAlignment
(
tablewriter
.
ALIGN_CENTER
)
table
.
SetCenterSeparator
(
"|"
)
table
.
AppendBulk
(
data
)
// Add Bulk Data
table
.
Render
()
fmt
.
Println
(
"
\n
This is a partial list. For a complete list, visit https://nodejs.org/download/release"
)
}
}
}
}
...
@@ -477,8 +520,8 @@ func help() {
...
@@ -477,8 +520,8 @@ func help() {
fmt
.
Println
(
" nvm off : Disable node.js version management."
)
fmt
.
Println
(
" nvm off : Disable node.js version management."
)
fmt
.
Println
(
" nvm proxy [url] : Set a proxy to use for downloads. Leave [url] blank to see the current proxy."
)
fmt
.
Println
(
" nvm proxy [url] : Set a proxy to use for downloads. Leave [url] blank to see the current proxy."
)
fmt
.
Println
(
" Set [url] to
\"
none
\"
to remove the proxy."
)
fmt
.
Println
(
" Set [url] to
\"
none
\"
to remove the proxy."
)
fmt
.
Println
(
" nvm node_mirror [url] : Set
a mirror
to https://nodejs.org/dist/. Leave [url] blank to use default url."
)
fmt
.
Println
(
" nvm node_mirror [url] : Set
the node mirror. Defaults
to https://nodejs.org/dist/. Leave [url] blank to use default url."
)
fmt
.
Println
(
" nvm npm_mirror [url] : Set
a mirror
to https://github.com/npm/npm/archive/. Leave [url] blank to default url."
)
fmt
.
Println
(
" nvm npm_mirror [url] : Set
the npm mirror. Defaults
to https://github.com/npm/npm/archive/. Leave [url] blank to default url."
)
fmt
.
Println
(
" nvm uninstall <version> : The version must be a specific version."
)
fmt
.
Println
(
" nvm uninstall <version> : The version must be a specific version."
)
// fmt.Println(" nvm update : Automatically update nvm to the latest version.")
// fmt.Println(" nvm update : Automatically update nvm to the latest version.")
fmt
.
Println
(
" nvm use [version] [arch] : Switch to use the specified version. Optionally specify 32/64bit architecture."
)
fmt
.
Println
(
" nvm use [version] [arch] : Switch to use the specified version. Optionally specify 32/64bit architecture."
)
...
@@ -492,7 +535,7 @@ func help() {
...
@@ -492,7 +535,7 @@ func help() {
// Given a node.js version, returns the associated npm version
// Given a node.js version, returns the associated npm version
func
getNpmVersion
(
nodeversion
string
)
string
{
func
getNpmVersion
(
nodeversion
string
)
string
{
_
,
_
,
_
,
npm
:=
node
.
GetAvailable
()
_
,
_
,
_
,
_
,
_
,
npm
:=
node
.
GetAvailable
()
return
npm
[
nodeversion
]
return
npm
[
nodeversion
]
}
}
...
...
src/nvm/node/node.go
浏览文件 @
7a454431
...
@@ -69,7 +69,7 @@ func IsVersionInstalled(root string, version string, cpu string) bool {
...
@@ -69,7 +69,7 @@ func IsVersionInstalled(root string, version string, cpu string) bool {
func
IsVersionAvailable
(
v
string
)
bool
{
func
IsVersionAvailable
(
v
string
)
bool
{
// Check the service to make sure the version is available
// Check the service to make sure the version is available
avail
,
_
,
_
,
_
:=
GetAvailable
()
avail
,
_
,
_
,
_
,
_
,
_
:=
GetAvailable
()
for
_
,
b
:=
range
avail
{
for
_
,
b
:=
range
avail
{
if
b
==
v
{
if
b
==
v
{
...
@@ -107,12 +107,73 @@ func (s BySemanticVersion) Less(i, j int) bool {
...
@@ -107,12 +107,73 @@ func (s BySemanticVersion) Less(i, j int) bool {
return
v1
.
GTE
(
v2
)
return
v1
.
GTE
(
v2
)
}
}
func
GetAvailable
()
([]
string
,
[]
string
,
[]
string
,
map
[
string
]
string
)
{
// Identifies a version as "LTS"
func
isLTS
(
element
map
[
string
]
interface
{})
bool
{
switch
datatype
:=
element
[
"lts"
]
.
(
type
)
{
case
bool
:
return
datatype
case
string
:
return
true
}
return
false
}
// Identifies a version as "current"
func
isCurrent
(
element
map
[
string
]
interface
{})
bool
{
if
isLTS
(
element
)
{
return
false
}
version
,
_
:=
semver
.
New
(
element
[
"version"
]
.
(
string
)[
1
:
])
benchmark
,
_
:=
semver
.
New
(
"1.0.0"
)
if
version
.
LT
(
benchmark
)
{
return
false
}
return
version
.
Major
%
2
==
0
}
// Identifies a stable old version.
func
isStable
(
element
map
[
string
]
interface
{})
bool
{
if
isCurrent
(
element
)
{
return
false
}
version
,
_
:=
semver
.
New
(
element
[
"version"
]
.
(
string
)[
1
:
])
if
(
version
.
Major
!=
0
)
{
return
false
}
return
version
.
Minor
%
2
==
0
}
// Identifies an unstable old version.
func
isUnstable
(
element
map
[
string
]
interface
{})
bool
{
if
isStable
(
element
)
{
return
false
}
version
,
_
:=
semver
.
New
(
element
[
"version"
]
.
(
string
)[
1
:
])
if
(
version
.
Major
!=
0
)
{
return
false
}
return
version
.
Minor
%
2
!=
0
}
// Retrieve the remotely available versions
func
GetAvailable
()
([]
string
,
[]
string
,
[]
string
,
[]
string
,
[]
string
,
map
[
string
]
string
)
{
all
:=
make
([]
string
,
0
)
all
:=
make
([]
string
,
0
)
lts
:=
make
([]
string
,
0
)
lts
:=
make
([]
string
,
0
)
current
:=
make
([]
string
,
0
)
stable
:=
make
([]
string
,
0
)
stable
:=
make
([]
string
,
0
)
unstable
:=
make
([]
string
,
0
)
npm
:=
make
(
map
[
string
]
string
)
npm
:=
make
(
map
[
string
]
string
)
url
:=
web
.
GetFullNodeUrl
(
"index.json"
)
url
:=
web
.
GetFullNodeUrl
(
"index.json"
)
// Check the service to make sure the version is available
// Check the service to make sure the version is available
text
:=
web
.
GetRemoteTextFile
(
url
)
text
:=
web
.
GetRemoteTextFile
(
url
)
...
@@ -120,7 +181,7 @@ func GetAvailable() ([]string, []string, []string, map[string]string) {
...
@@ -120,7 +181,7 @@ func GetAvailable() ([]string, []string, []string, map[string]string) {
var
data
=
make
([]
map
[
string
]
interface
{},
0
)
var
data
=
make
([]
map
[
string
]
interface
{},
0
)
json
.
Unmarshal
([]
byte
(
text
),
&
data
);
json
.
Unmarshal
([]
byte
(
text
),
&
data
);
for
_
,
element
:=
range
data
{
for
_
,
element
:=
range
data
{
var
version
=
element
[
"version"
]
.
(
string
)[
1
:
]
var
version
=
element
[
"version"
]
.
(
string
)[
1
:
]
all
=
append
(
all
,
version
)
all
=
append
(
all
,
version
)
...
@@ -129,15 +190,16 @@ func GetAvailable() ([]string, []string, []string, map[string]string) {
...
@@ -129,15 +190,16 @@ func GetAvailable() ([]string, []string, []string, map[string]string) {
npm
[
version
]
=
val
npm
[
version
]
=
val
}
}
switch
v
:=
element
[
"lts"
]
.
(
type
)
{
if
isLTS
(
element
)
{
case
bool
:
if
v
==
false
{
stable
=
append
(
stable
,
version
)
}
case
string
:
lts
=
append
(
lts
,
version
)
lts
=
append
(
lts
,
version
)
}
else
if
isCurrent
(
element
)
{
current
=
append
(
current
,
version
)
}
else
if
isStable
(
element
)
{
stable
=
append
(
stable
,
version
)
}
else
if
isUnstable
(
element
)
{
unstable
=
append
(
unstable
,
version
)
}
}
}
}
return
all
,
lts
,
stable
,
npm
return
all
,
lts
,
current
,
stable
,
un
stable
,
npm
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录