Skip to content

Commit 9f3b282

Browse files
authored
fix(mirror): handle osx-*-tar naming in Node.js index.json (#227)
1 parent 7adf0e8 commit 9f3b282

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

scripts/mirror-binaries/node.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,10 @@ func (s *NodeOfficialSource) fetchShasums(version string) (nodeShasums, error) {
124124
}
125125

126126
func (s *NodeOfficialSource) mapFileToPlatform(file string) (platform, ext string) {
127-
// Node.js file naming: linux-x64, darwin-x64, win-x64, etc.
127+
// Node.js file naming in index.json:
128+
// - Linux: linux-x64, linux-arm64, linux-armv7l
129+
// - macOS: osx-x64-tar, osx-arm64-tar (v15+), darwin-x64, darwin-arm64 (legacy)
130+
// - Windows: win-x64-zip, win-arm64-zip, win-x86-zip
128131
// We want: linux-amd64, darwin-amd64, windows-amd64, etc.
129132

130133
switch file {
@@ -136,7 +139,12 @@ func (s *NodeOfficialSource) mapFileToPlatform(file string) (platform, ext strin
136139
case "linux-armv7l":
137140
return "linux-armv7", ".tar.gz"
138141

139-
// macOS
142+
// macOS (osx-*-tar naming used since v15+)
143+
case "osx-x64-tar":
144+
return "darwin-amd64", ".tar.gz"
145+
case "osx-arm64-tar":
146+
return "darwin-arm64", ".tar.gz"
147+
// Legacy macOS naming (pre-v15)
140148
case "darwin-x64":
141149
return "darwin-amd64", ".tar.gz"
142150
case "darwin-arm64":
@@ -158,16 +166,17 @@ func (s *NodeOfficialSource) mapFileToPlatform(file string) (platform, ext strin
158166

159167
func (s *NodeOfficialSource) getArchiveName(version, file string) string {
160168
// Convert file type to actual archive filename
169+
// Note: osx-*-tar entries map to darwin-* archive names (the files on disk use darwin-)
161170
switch file {
162171
case "linux-x64":
163172
return fmt.Sprintf("node-%s-linux-x64.tar.gz", version)
164173
case "linux-arm64":
165174
return fmt.Sprintf("node-%s-linux-arm64.tar.gz", version)
166175
case "linux-armv7l":
167176
return fmt.Sprintf("node-%s-linux-armv7l.tar.gz", version)
168-
case "darwin-x64":
177+
case "osx-x64-tar", "darwin-x64":
169178
return fmt.Sprintf("node-%s-darwin-x64.tar.gz", version)
170-
case "darwin-arm64":
179+
case "osx-arm64-tar", "darwin-arm64":
171180
return fmt.Sprintf("node-%s-darwin-arm64.tar.gz", version)
172181
case "win-x64-zip":
173182
return fmt.Sprintf("node-%s-win-x64.zip", version)

0 commit comments

Comments
 (0)