on master help sign in
get the npm installer working better on Windows
79bac94Evan Czaplicki
installers/npm/bin/elm+5−5
@@ -1,13 +1,13 @@
1#!/usr/bin/env node
1#!/usr/bin/env node
2
2
3var child_process = require('child_process');
3var child_process = require('child_process');
4−var package = require('../package.json');
5var path = require('path');
4var path = require('path');
6var fs = require('fs');
5var fs = require('fs');
7
6
8
7
9−// Some npm users enable --ignore-scripts (a good security measure)
8+// Some npm users enable --ignore-scripts (a good security measure) so
10−// They do not run the post-install hook, so install.js does not run.
9+// they do not run the post-install hook and install.js does not run.
10+// Instead they will run this script.
11//
11//
12// On Mac and Linux, we download the elm executable into the exact same
12// On Mac and Linux, we download the elm executable into the exact same
13// location as this file. Since npm uses symlinks on these platforms,
13// location as this file. Since npm uses symlinks on these platforms,
@@ -15,7 +15,7 @@ var fs = require('fs');
15// runs will call the elm binary directly.
15// runs will call the elm binary directly.
16//
16//
17// On Windows, we must download a file named elm.exe for it to run properly.
17// On Windows, we must download a file named elm.exe for it to run properly.
18−// Instead of symlinks, they create two files:
18+// Instead of symlinks, npm creates two files:
19//
19//
20// - node_modules/.bin/elm (a bash file)
20// - node_modules/.bin/elm (a bash file)
21// - node_modules/.bin/elm.cmd (a batch file)
21// - node_modules/.bin/elm.cmd (a batch file)
@@ -27,7 +27,7 @@ var fs = require('fs');
27
27
28// figure out where to put the binary (calls path.resolve() to get path separators right on Windows)
28// figure out where to put the binary (calls path.resolve() to get path separators right on Windows)
29//
29//
30−var binaryPath = path.resolve(__dirname, package.bin) + (process.platform === 'win32' ? '.exe' : '');
30+var binaryPath = path.resolve(__dirname, 'elm') + (process.platform === 'win32' ? '.exe' : '');
31
31
32// Run the command directly if possible, otherwise download and then run.
32// Run the command directly if possible, otherwise download and then run.
33// This check is important for Windows where this file will be run all the time.
33// This check is important for Windows where this file will be run all the time.
installers/npm/package.json+1−1
@@ -25,7 +25,7 @@
25 "install.js",
25 "install.js",
26 "download.js",
26 "download.js",
27 "bin",
27 "bin",
28− "bin/elm.exe"
28+ "bin/elm"
29 ],
29 ],
30 "keywords": [
30 "keywords": [
31 "bin",
31 "bin",