Commit Graph

139 Commits

Author SHA1 Message Date
Tobias Kellner
95133cb1d0 Don't perform any changes when trying to use current node version 2024-08-02 20:46:51 +02:00
Corey Butler
7af9934eaf Add error messages for failed version lookups (when nodejs.org returns partial/no results. Resolves #1064. 2023-11-22 10:41:38 -06:00
Corey Butler
4854ee0832 Merge branch 'master' of github.com:coreybutler/nvm-windows 2023-11-07 12:22:49 -06:00
Corey Butler
3c736ab164 Add debugging option to identify IPv6 configurations and remind users it is slow. 2023-11-07 12:22:12 -06:00
Corey Butler
9c37af6290 Merge pull request #965 from nineninesevenfour/fix-932-path-with-spaces
fix issue #932
2023-10-10 17:19:34 +00:00
Eng Zer Jun
683357f2f3 Avoid unnecessary byte/string conversion
We can use `(*regexp.Regexp).MatchString` instead of
`(*regexp.Regexp).Match([]byte(...))` to avoid unnecessary `[]byte`
conversions and reduce allocations.

Example benchmark:

func BenchmarkMatch(b *testing.B) {
	reg, _ := regexp.Compile("[^0-9]")

	for i := 0; i < b.N; i++ {
		if match := reg.Match([]byte("v")); !match {
			b.Fail()
		}
	}
}

func BenchmarkMatchString(b *testing.B) {
	reg, _ := regexp.Compile("[^0-9]")

	for i := 0; i < b.N; i++ {
		if match := reg.MatchString("v"); !match {
			b.Fail()
		}
	}
}

BenchmarkMatch-16          	19712776	        65.47 ns/op	       1 B/op	       1 allocs/op
BenchmarkMatchString-16    	24261463	        51.16 ns/op	       0 B/op	       0 allocs/op

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2023-10-10 18:53:32 +08:00
Shengyuan Ye
53283980d5 Modified folder detection code against #1031 2023-09-20 09:49:57 +08:00
Corey Butler
c1a633745c prevent invalid zip file from exracting files to arbitrary locations. 2023-04-27 11:31:01 -05:00
Corey Butler
0990c1fa75 Added a debug check to identify invalid Node installations. 2023-04-20 09:44:15 -05:00
Harald Fassler
6c175fabaf fix issue #932
Signed-off-by: Harald Fassler <harald.fassler+9974@gmail.com>
2023-04-15 12:36:21 +02:00
Tester798
11625ec131 Fix symlink detect if it points to nothing 2023-04-13 15:25:59 +03:00
Corey Butler
3f0dba16dc Updated go-where dependency and cleaned up debug output. 2023-04-12 22:28:01 -05:00
Corey Butler
9dff81433c Added extra debug details. 2023-04-12 20:40:26 -05:00
Corey Butler
fa811e098d Updated build process. 2023-04-11 12:58:48 -05:00
Corey Butler
b54163cf78 Move test command to 'debug'. Fixes #955 and #942. Addresses #945 with new encoding for settings (forcing UTF-8). 2023-04-11 12:53:34 -05:00
dependabot[bot]
195f9539c2 Bump golang.org/x/text from 0.3.2 to 0.3.8 in /src
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.3.2 to 0.3.8.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.3.2...v0.3.8)

---
updated-dependencies:
- dependency-name: golang.org/x/text
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-02 15:34:38 +00:00
Corey Butler
ed0bce2ca6 Merge pull request #936 from coreybutler/dependabot/go_modules/src/golang.org/x/sys-0.1.0
Bump golang.org/x/sys from 0.0.0-20190813064441-fde4db37ae7a to 0.1.0 in /src
2023-04-02 10:33:54 -05:00
秋来冬风
a2cea8fd91 Avoid panic after connection failure
Download function, when client.Do returns err= Nil, return false after printing the error message to avoid panic
2023-03-19 13:04:07 +08:00
dependabot[bot]
cb0d573441 Bump golang.org/x/sys in /src
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.0.0-20190813064441-fde4db37ae7a to 0.1.0.
- [Release notes](https://github.com/golang/sys/releases)
- [Commits](https://github.com/golang/sys/commits/v0.1.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-25 03:54:24 +00:00
Corey Butler
16afa15d7d Added custom UTF-8 converter for settings file. 2023-02-24 12:31:57 -06:00
Corey Butler
8d2af15f77 Remove unreacheable code. Closes PR #926. 2023-02-13 19:44:34 -06:00
Corey Butler
9366b98d10 Add checks for network connectivity 2023-02-13 19:41:21 -06:00
Corey Butler
6e2c8da2dc Updated error output for bad version aliases and atttempt to resolve desired alias. 2023-02-04 19:17:35 -06:00
Corey Butler
98fa1e5ca3 Added support for codenames 2023-01-26 21:50:16 -06:00
Corey Butler
7852e0c8ea Prevent alphabetical characters only for unknown version aliases. Closes #907. 2023-01-26 20:55:03 -06:00
Corey Butler
fdbf31dfdd Fixed PATH check logic 2023-01-26 20:51:17 -06:00
Corey Butler
7a52c4cbc4 Added initial environment check. Also prevent versions starting with non-numeric values other than 'v' that aren't a known alias. This closes #919 2023-01-26 20:03:39 -06:00
Corey Butler
f31dd2ab90 Updated elevation approach 2022-10-31 18:55:01 -05:00
Corey Butler
9c2b3b4835 Add aliases/flags for version. Closes #855. 2022-10-31 18:18:58 -05:00
Corey Butler
68df36c974 Merged several PRs. Adds support for partial version matching in 'use' and 'install' commands. Closes #766. 2022-10-31 18:17:10 -05:00
Corey Butler
e050a10736 Added HTTP request exception handling to clearly identify bad URLs. A patch was also applied to catch a bad npm URL for npm v6.14.17, which returns multiple results (status code 300). Resolves #766 2022-05-28 10:03:06 -05:00
Corey Butler
dfa2e5f105 Update dependencies 2022-05-28 09:58:54 -05:00
sayefreyadh
faed1f3cf2 minor typo fixed in comments 2022-05-14 03:42:15 +06:00
Corey Butler
e75c744de6 Merge pull request #709 from vladonemo/use_command_enhacement
Allow `nvm use` to be called with the part of the semver
2022-05-12 07:26:29 -05:00
Vladimir Nemergut
9f3af8a6f5 Allow nvm use to be called with the part of the semver
For instance, the `nvm use 12` will switch to the latest installed version of 12.*. Similarly, `nvm use 12.22` will switch to the latest installed version of 12.22.*

Fixes #708
2022-04-21 21:30:48 +02:00
Corey Butler
a7f30f5e12 Update go.mod 2022-02-01 13:33:47 -06:00
0liver
3cbd0f7b11 Update error message when missing version argument
Also added a dots to the end of a few log messages.
2022-01-17 13:01:27 +01:00
coreybutler
0f2fcaccde Auto-expand partial versions for install command. Resolves #706. 2021-12-15 20:06:31 -06:00
coreybutler
f792f4ec5e Version bump 2021-12-10 12:36:36 -06:00
coreybutler
a0cdde9971 Add alt admin check - currently removed by tree shaking, but left for reference. 2021-12-10 12:19:01 -06:00
coreybutler
997759ebee Add partial version matching for using latest INSTALLED version. Resolves #683. 2021-12-09 13:34:12 -06:00
coreybutler
c8f25ce17f Use proxy value from settings. Resolves #670. 2021-12-08 15:04:09 -06:00
coreybutler
5751e53159 Added code-signing capability. Also updated aliases to elevate command when needed (issue #700) 2021-12-07 17:00:12 -06:00
coreybutler
c4a157cad3 Abstract version extraction into its own method. This will help with issue #691 2021-11-12 17:36:06 -06:00
Corey Butler
7646a541d0 Update nvm.go
Updated link to available versions. Closes #688.
2021-11-12 17:07:28 -06:00
Crhistian Ramirez
eec8beeeb0 Fix broken link to nodejs versions
Nodejs must have updated their URLs
2021-10-10 13:35:08 -04:00
coreybutler
a15c774ca2 refactored Download abort PR (upon failed download) 2021-09-11 01:22:59 -05:00
Corey Butler
7c519c44a8 Merge pull request #416 from detailyang/patch-1
web.download: return false ASAP if meet the error
2021-09-11 01:21:11 -05:00
coreybutler
749fef0e7a refactored PR for fixing mirror URLs 2021-09-11 01:15:47 -05:00
Corey Butler
10c117e345 Merge pull request #427 from clarkttfu/master
fix: mirror address not end with '/'
2021-09-11 01:13:13 -05:00