on master help sign in
try out elm.cmd trick to see if it works on mac and windows
commit127a28ec0311efad8728aef351ecccfb0ce4b7e6 authorEvan Czaplicki <evancz@users.noreply.github.com> dateFri 30 Aug 2019, 11:03 (7 years ago) parent8e60142
4 files changed+7−12
installers/npm/bin/elm → installers/npm/bin/elm.cmd+3−3 installers/npm/download.js+1−6 installers/npm/install.js+1−1 installers/npm/package.json+2−2
installers/npm/bin/elm → installers/npm/bin/elm.cmdrenamed+3−3
@@ -18,12 +18,12 @@ var fs = require('fs');
1818
1919// Make sure we get the right path even if we're executing from the symlinked
2020// node_modules/.bin/ executable
21−var pathToThisFile = fs.realpathSync(process.argv[1]);
21+var targetPath = fs.realpathSync(process.argv[1]);
2222
23−download(pathToThisFile, function() {
23+download(targetPath, function() {
2424 // Need double quotes and { shell: true } when there are spaces in the path on windows:
2525 // https://github.com/nodejs/node/issues/7367#issuecomment-229721296
2626 child_process
27− .spawn('"' + pathToThisFile + '"', process.argv.slice(2), { stdio: 'inherit', shell: true })
27+ .spawn('"' + targetPath + '"', process.argv.slice(2), { stdio: 'inherit', shell: true })
2828 .on('exit', process.exit);
2929});
installers/npm/download.js+1−6
@@ -17,13 +17,8 @@ module.exports = function(destinationPath, callback)
1717 var version = package.version.replace(/^(\d+\.\d+\.\d+).*$/, '$1'); // turn '1.2.3-alpha' into '1.2.3'
1818 var os = { 'darwin': 'mac', 'win32': 'windows', 'linux': 'linux' }[process.platform];
1919 var arch = { 'x64': '64-bit', 'ia32': '32-bit' }[process.arch];
20− var path = process.platform === 'win32' ? destinationPath + '.exe' : destinationPath;
2120 var url = 'https://github.com/elm/compiler/releases/download/' + version + '/binary-for-' + os + '-' + arch + '.gz';
22−
23− // check if exists for bin/elm running for the Nth time on Windows
24− fs.existsSync(path)
25− ? callback()
26− : download(path, url, callback);
21+ download(destinationPath, url, callback);
2722};
2823
2924
installers/npm/install.js+1−1
@@ -5,6 +5,6 @@ var path = require('path');
55
66
77// get slashes right for Windows
8−var targetPath = path.resolve(__dirname, Object.values(package.bin)[0]);
8+var targetPath = path.resolve(__dirname, package.bin['elm']);
99
1010download(targetPath, function() {});
installers/npm/package.json+2−2
@@ -25,7 +25,7 @@
2525 "install.js",
2626 "download.js",
2727 "bin",
28− "bin/elm"
28+ "bin/elm.cmd"
2929 ],
3030 "keywords": [
3131 "bin",
@@ -36,7 +36,7 @@
3636 "installer"
3737 ],
3838 "bin": {
39− "elm": "bin/elm"
39+ "elm": "bin/elm.cmd"
4040 },
4141 "dependencies": {
4242 }