@@ -16,9 +16,17 @@ module.exports = function(callback)
16
16
{
17
17
// figure out URL of binary
18
18
var version = package . version . replace ( / ^ ( \d + \. \d + \. \d + ) .* $ / , '$1' ) ; // turn '1.2.3-alpha' into '1.2.3'
19
- var os = { 'darwin' : 'mac' , 'win32' : 'windows' , 'linux' : 'linux' } [ process . platform ] ;
20
- var arch = { 'x64' : '64-bit' , 'arm64' : '64-bit' , 'ia32' : '32-bit' } [ process . arch ] ;
21
- var url = 'https://github.com/elm/compiler/releases/download/' + version + '/binary-for-' + os + '-' + arch + '.gz' ;
19
+
20
+ var platform = {
21
+ darwin_x64 : 'mac-64-bit' ,
22
+ darwin_arm64 : 'mac-64-bit' ,
23
+ win32_x64 : 'windows-64-bit' ,
24
+ linux_x64 : 'linux-64-bit'
25
+ } [ process . platform + '_' + process . arch ] ;
26
+
27
+ verifyPlatform ( version , platform ) ;
28
+
29
+ var url = 'https://github.com/elm/compiler/releases/download/' + version + '/binary-for-' + platform + '.gz' ;
22
30
23
31
reportDownload ( version , url ) ;
24
32
@@ -50,6 +58,30 @@ module.exports = function(callback)
50
58
51
59
52
60
61
+ // VERIFY PLATFORM
62
+
63
+
64
+ function verifyPlatform ( version , platform )
65
+ {
66
+ if ( platform ) return ;
67
+
68
+ var situation = process . platform + '_' + process . arch ;
69
+ console . error (
70
+ '-- ERROR -----------------------------------------------------------------------\n\n'
71
+ + 'I am detecting that your computer (' + situation + ') may not be compatible with any\n'
72
+ + 'of the official pre-built binaries.\n\n'
73
+ + 'I recommend against using the npm installer for your situation. Check out the\n'
74
+ + 'alternative installers at https://github.com/elm/compiler/releases/tag/' + version + '\n'
75
+ + 'to see if there is something that will work better for you.\n\n'
76
+ + 'From there I recommend asking for guidance on Slack or Discourse to find someone\n'
77
+ + 'who can help with your specific situation.\n\n'
78
+ + '--------------------------------------------------------------------------------\n'
79
+ ) ;
80
+ process . exit ( 1 ) ;
81
+ }
82
+
83
+
84
+
53
85
// EXIT FAILURE
54
86
55
87
0 commit comments