@@ -1,13 +1,13 @@
1#!/usr/bin/env node
1#!/usr/bin/env node
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');
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.
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.
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:
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');
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)
30−var binaryPath = path.resolve(__dirname, package.bin) + (process.platform === 'win32' ? '.exe' : '');
30+var binaryPath = path.resolve(__dirname, 'elm') + (process.platform === 'win32' ? '.exe' : '');
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.