@@ -25,7 +25,6 @@ const osNameDict: Record<string, string> = {
25
25
MacOSX : 'macOS' ,
26
26
Linux : 'Linux' ,
27
27
} ;
28
-
29
28
const installerDict : Record < string , HumanReadableInstallerName > = {
30
29
'' : { } ,
31
30
'Windows' : {
@@ -49,6 +48,28 @@ const installerDict: Record<string, HumanReadableInstallerName> = {
49
48
} ,
50
49
} ;
51
50
51
+ const mf3Prefix = 'https://mirrors.zju.edu.cn/miniforge/' ;
52
+ const mf3OsNameDict : Record < string , string > = {
53
+ Windows : 'Windows' ,
54
+ Darwin : 'macOS' ,
55
+ Linux : 'Linux' ,
56
+ } ;
57
+ const mf3InstallerDict : Record < string , HumanReadableInstallerName > = {
58
+ '' : { } ,
59
+ 'Windows' : {
60
+ 'x86_64.exe' : 'x86_64 EXE' ,
61
+ } ,
62
+ 'Darwin' : {
63
+ 'arm64.sh' : 'ARM64 SH (Apple Silicon)' ,
64
+ 'x86_64.sh' : 'x86_64 SH (Intel)' ,
65
+ } ,
66
+ 'Linux' : {
67
+ 'x86_64.sh' : 'x86_64 SH' ,
68
+ 'aarch64.sh' : 'arm64 SH' ,
69
+ 'ppc64le.sh' : 'ppc64le SH' ,
70
+ } ,
71
+ } ;
72
+
52
73
const MinicondaInstaller = ( ) => {
53
74
const [ os , setOS ] = useState ( '' ) ;
54
75
const [ variant , setVariant ] = useState ( '' ) ;
@@ -116,6 +137,72 @@ const MinicondaInstaller = () => {
116
137
) ;
117
138
} ;
118
139
140
+ const Miniforge3Installer = ( ) => {
141
+ const [ os , setOS ] = useState ( '' ) ;
142
+ const [ variant , setVariant ] = useState ( '' ) ;
143
+ const installerName = os && variant ? `Miniforge3-${ os } -${ variant } ` : '' ;
144
+
145
+ const handleOSChange : SelectProps [ 'onChange' ] = event => {
146
+ setOS ( event . target . value as string ) ;
147
+ setVariant ( '' ) ;
148
+ } ;
149
+
150
+ const handleVariantChange : SelectProps [ 'onChange' ] = event => {
151
+ setVariant ( event . target . value as string ) ;
152
+ } ;
153
+
154
+ return (
155
+ < div >
156
+ < FormControl variant = "standard" sx = { { m : 1 , minWidth : 120 } } >
157
+ < InputLabel id = "os-select-label" > 操作系统</ InputLabel >
158
+ < Select
159
+ labelId = "os-select-label"
160
+ id = "os-select"
161
+ value = { os }
162
+ onChange = { handleOSChange }
163
+ label = "操作系统"
164
+ >
165
+ { Object . keys ( mf3OsNameDict ) . map ( osKey => (
166
+ < MenuItem value = { osKey } key = { osKey } >
167
+ { mf3OsNameDict [ osKey ] }
168
+ </ MenuItem >
169
+ ) ) }
170
+ </ Select >
171
+ </ FormControl >
172
+ < FormControl variant = "standard" sx = { { m : 1 , minWidth : 300 } } >
173
+ < InputLabel id = "variant-select-label" >
174
+ 系统架构 及 安装包类型
175
+ </ InputLabel >
176
+ < Select
177
+ labelId = "variant-select-label"
178
+ id = "variant-select"
179
+ value = { variant }
180
+ onChange = { handleVariantChange }
181
+ label = "系统架构及安装包类型"
182
+ >
183
+ { Object . keys ( mf3InstallerDict [ os ] ) . map ( k => (
184
+ < MenuItem value = { k } key = { `${ os } -${ k } ` } >
185
+ { mf3InstallerDict [ os ] [ k ] }
186
+ </ MenuItem >
187
+ ) ) }
188
+ </ Select >
189
+ </ FormControl >
190
+ < br />
191
+ < Button
192
+ variant = "contained"
193
+ startIcon = { < DownloadIcon /> }
194
+ sx = { { m : 1 } }
195
+ disabled = { ! installerName }
196
+ href = { mf3Prefix + installerName }
197
+ >
198
+ < Typography textTransform = "none" >
199
+ 下载 { installerName && `(${ installerName } )` }
200
+ </ Typography >
201
+ </ Button >
202
+ </ div >
203
+ ) ;
204
+ } ;
205
+
119
206
const baseConf = `channels:
120
207
- defaults
121
208
show_channel_urls: true
@@ -207,7 +294,9 @@ const channelOriginToUrl = (origin: ChannelOrigin) => {
207
294
return 'https://mirrors.zju.edu.cn/anaconda-r' ;
208
295
} ;
209
296
210
- const CondaConfigGen = ( ) => {
297
+ const CondaConfigGen : React . FC < {
298
+ isMiniforge3 ?: boolean ;
299
+ } > = ( { isMiniforge3 } ) => {
211
300
const [ showCustom , setShowCustom ] = useState ( false ) ;
212
301
const [ channelStatus , setChannelStatus ] = useState ( defaultChannelStatus ) ;
213
302
@@ -221,7 +310,7 @@ const CondaConfigGen = () => {
221
310
} ) ;
222
311
} ;
223
312
224
- let conf = baseConf ;
313
+ let conf = isMiniforge3 ? '' : baseConf ;
225
314
if ( Object . values ( channelStatus ) . some ( v => v ) ) {
226
315
conf += 'custom_channels:\n' ;
227
316
}
@@ -243,18 +332,22 @@ const CondaConfigGen = () => {
243
332
</ FormGroup >
244
333
< Collapse in = { showCustom } >
245
334
< FormGroup sx = { { flexDirection : 'row' } } >
246
- < FormControlLabel
247
- control = { < Checkbox defaultChecked disabled /> }
248
- label = "pkgs/main"
249
- />
250
- < FormControlLabel
251
- control = { < Checkbox defaultChecked disabled /> }
252
- label = "pkgs/r"
253
- />
254
- < FormControlLabel
255
- control = { < Checkbox defaultChecked disabled /> }
256
- label = "pkgs/msys2"
257
- />
335
+ { ! isMiniforge3 && (
336
+ < >
337
+ < FormControlLabel
338
+ control = { < Checkbox defaultChecked disabled /> }
339
+ label = "pkgs/main"
340
+ />
341
+ < FormControlLabel
342
+ control = { < Checkbox defaultChecked disabled /> }
343
+ label = "pkgs/r"
344
+ />
345
+ < FormControlLabel
346
+ control = { < Checkbox defaultChecked disabled /> }
347
+ label = "pkgs/msys2"
348
+ />
349
+ </ >
350
+ ) }
258
351
{ Object . keys ( channelStatus ) . map ( channel => {
259
352
return (
260
353
< FormControlLabel
@@ -281,4 +374,4 @@ const CondaConfigGen = () => {
281
374
) ;
282
375
} ;
283
376
284
- export { MinicondaInstaller , CondaConfigGen } ;
377
+ export { MinicondaInstaller , Miniforge3Installer , CondaConfigGen } ;
0 commit comments