diff --git a/download/src/index.js b/download/src/index.js index 1f80998..b18f869 100644 --- a/download/src/index.js +++ b/download/src/index.js @@ -10,6 +10,7 @@ import zlib from 'zlib' import onDeath from 'death' import fetch from 'node-fetch' import retry from 'async-retry' +import which from 'which-promise' // Utilities import plusxSync from './chmod' @@ -151,19 +152,27 @@ async function main() { if (platform === 'win32') { // Now.exe is executed only fs.unlinkSync(now) - // Workaround for https://github.com/npm/cmd-shim/pull/25 - const gitBashFile = path.join(process.env.APPDATA, 'npm/now') - fs.writeFileSync( - gitBashFile, - '#!/bin/sh\n' + - 'basedir=$(dirname "$(echo "$0" | sed -e \'s,\\\\,/,g\')")\n' + - '\n' + - 'case `uname` in\n' + - ' *CYGWIN*) basedir=`cygpath -w "$basedir"`;;\n' + - 'esac\n' + - '\n' + - fs.readFileSync(gitBashFile, 'utf8') - ) + try { + // Workaround for https://github.com/npm/cmd-shim/pull/25 + const globalPath = path.dirname(await which('npm')) + const gitBashFile = path.join(globalPath, 'now') + fs.writeFileSync( + gitBashFile, + '#!/bin/sh\n' + + 'basedir=$(dirname "$(echo "$0" | sed -e \'s,\\\\,/,g\')")\n' + + '\n' + + 'case `uname` in\n' + + ' *CYGWIN*) basedir=`cygpath -w "$basedir"`;;\n' + + 'esac\n' + + '\n' + + fs.readFileSync(gitBashFile, 'utf8') + ) + } catch (err) { + if (err.code !== 'ENOENT') { + // Not a problem. only git cmd will not work + console.error(err) + } + } } else { plusxSync(now) } diff --git a/package-lock.json b/package-lock.json index 6296e90..d1f5a58 100644 --- a/package-lock.json +++ b/package-lock.json @@ -424,7 +424,7 @@ "path-is-absolute": "1.0.1", "private": "0.1.7", "slash": "1.0.0", - "source-map": "0.5.6" + "source-map": "0.5.7" }, "dependencies": { "debug": { @@ -462,7 +462,7 @@ "detect-indent": "4.0.0", "jsesc": "1.3.0", "lodash": "4.17.4", - "source-map": "0.5.6", + "source-map": "0.5.7", "trim-right": "1.0.1" } }, @@ -1163,7 +1163,7 @@ "buffer-xor": "1.0.3", "cipher-base": "1.0.4", "create-hash": "1.1.3", - "evp_bytestokey": "1.0.0", + "evp_bytestokey": "1.0.2", "inherits": "2.0.3" } }, @@ -1175,7 +1175,7 @@ "requires": { "browserify-aes": "1.0.6", "browserify-des": "1.0.0", - "evp_bytestokey": "1.0.0" + "evp_bytestokey": "1.0.2" } }, "browserify-des": { @@ -1492,9 +1492,9 @@ } }, "cli-width": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.1.0.tgz", - "integrity": "sha1-sjTKIJsp72b8UY2bmNWEewDt8Ao=", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", + "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", "dev": true }, "clipboardy": { @@ -1879,7 +1879,7 @@ "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", "dev": true, "requires": { - "es5-ext": "0.10.29" + "es5-ext": "0.10.30" } }, "dashdash": { @@ -2366,9 +2366,9 @@ } }, "es5-ext": { - "version": "0.10.29", - "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.29.tgz", - "integrity": "sha512-KXla9NXo5sdaEkGSmbFPYgjH6m75kxsthL6GDRSug/Y2OiMoYm0I9giL39j4cgmaFmAbkIFJ6gG+SGKnLSmOvA==", + "version": "0.10.30", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.30.tgz", + "integrity": "sha1-cUGhaDZpfbq/qq7uQUlc4p9SyTk=", "dev": true, "requires": { "es6-iterator": "2.0.1", @@ -2382,7 +2382,7 @@ "dev": true, "requires": { "d": "1.0.0", - "es5-ext": "0.10.29", + "es5-ext": "0.10.30", "es6-symbol": "3.1.1" } }, @@ -2393,7 +2393,7 @@ "dev": true, "requires": { "d": "1.0.0", - "es5-ext": "0.10.29", + "es5-ext": "0.10.30", "es6-iterator": "2.0.1", "es6-set": "0.1.5", "es6-symbol": "3.1.1", @@ -2407,7 +2407,7 @@ "dev": true, "requires": { "d": "1.0.0", - "es5-ext": "0.10.29", + "es5-ext": "0.10.30", "es6-iterator": "2.0.1", "es6-symbol": "3.1.1", "event-emitter": "0.3.5" @@ -2420,7 +2420,7 @@ "dev": true, "requires": { "d": "1.0.0", - "es5-ext": "0.10.29" + "es5-ext": "0.10.30" } }, "es6-weak-map": { @@ -2430,7 +2430,7 @@ "dev": true, "requires": { "d": "1.0.0", - "es5-ext": "0.10.29", + "es5-ext": "0.10.30", "es6-iterator": "2.0.1", "es6-symbol": "3.1.1" } @@ -2651,7 +2651,7 @@ "dev": true, "requires": { "d": "1.0.0", - "es5-ext": "0.10.29" + "es5-ext": "0.10.30" } }, "events": { @@ -2661,12 +2661,13 @@ "dev": true }, "evp_bytestokey": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.0.tgz", - "integrity": "sha1-SXtmrZ/vZc18CKYYCCS6FHa2blM=", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.2.tgz", + "integrity": "sha512-ni0r0lrm7AOzsh2qC5mi9sj8S0gmj5fLNjfFpxN05FB4tAVZEKotbkjOtLPqTCX/CXT7NsUr6juZb4IFJeNNdA==", "dev": true, "requires": { - "create-hash": "1.1.3" + "md5.js": "1.3.4", + "safe-buffer": "5.1.1" } }, "execa": { @@ -2733,7 +2734,7 @@ "integrity": "sha512-u+SQgsubraE6zItfVA0tBuCBhfU9ogSRnsvygI7wht9TS510oLkBRXBsqopeUG/GBOIQyKZO9wjTqIu/sf5zFA==", "dev": true, "requires": { - "mime-db": "1.29.0" + "mime-db": "1.30.0" } }, "ext-name": { @@ -2984,7 +2985,7 @@ "dev": true, "optional": true, "requires": { - "nan": "2.6.2", + "nan": "2.7.0", "node-pre-gyp": "0.6.36" }, "dependencies": { @@ -4285,7 +4286,7 @@ "ansi-escapes": "2.0.0", "chalk": "2.1.0", "cli-cursor": "2.1.0", - "cli-width": "2.1.0", + "cli-width": "2.2.0", "external-editor": "2.0.4", "figures": "2.0.0", "lodash": "4.17.4", @@ -5185,6 +5186,28 @@ "pify": "2.3.0" } }, + "md5.js": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.4.tgz", + "integrity": "sha1-6b296UogpawYsENA/Fdk1bCdkB0=", + "dev": true, + "requires": { + "hash-base": "3.0.4", + "inherits": "2.0.3" + }, + "dependencies": { + "hash-base": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", + "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", + "dev": true, + "requires": { + "inherits": "2.0.3", + "safe-buffer": "5.1.1" + } + } + } + }, "mem": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", @@ -5259,9 +5282,9 @@ } }, "mime-db": { - "version": "1.29.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.29.0.tgz", - "integrity": "sha1-SNJtI1WJZRcErFkWygYAGRQmaHg=", + "version": "1.30.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz", + "integrity": "sha1-dMZD2i3Z1qRTmZY0ZbJtXKfXHwE=", "dev": true }, "mime-types": { @@ -5271,6 +5294,14 @@ "dev": true, "requires": { "mime-db": "1.29.0" + }, + "dependencies": { + "mime-db": { + "version": "1.29.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.29.0.tgz", + "integrity": "sha1-SNJtI1WJZRcErFkWygYAGRQmaHg=", + "dev": true + } } }, "mimic-fn": { @@ -5359,9 +5390,9 @@ "dev": true }, "nan": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.6.2.tgz", - "integrity": "sha1-5P805slf37WuzAjeZZb0NgWn20U=", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.7.0.tgz", + "integrity": "sha1-2Vv3IeyHfgjbJ27T/G63j5CDrUY=", "dev": true, "optional": true }, @@ -5824,7 +5855,7 @@ "asn1.js": "4.9.1", "browserify-aes": "1.0.6", "create-hash": "1.1.3", - "evp_bytestokey": "1.0.0", + "evp_bytestokey": "1.0.2", "pbkdf2": "3.0.13" } }, @@ -6899,9 +6930,9 @@ "dev": true }, "source-map": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", - "integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI=", + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", "dev": true }, "source-map-support": { @@ -6910,7 +6941,7 @@ "integrity": "sha512-A6vlydY7H/ljr4L2UOhDSajQdZQ6dMD7cLH0pzwcmwLyc9u8PNI4WGtnfDDzX7uzGL6c/T+ORL97Zlh+S4iOrg==", "dev": true, "requires": { - "source-map": "0.5.6" + "source-map": "0.5.7" } }, "spawn-sync": { @@ -7425,7 +7456,7 @@ "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", "dev": true, "requires": { - "source-map": "0.5.6", + "source-map": "0.5.7", "uglify-to-browserify": "1.0.2", "yargs": "3.10.0" }, @@ -7463,7 +7494,7 @@ "integrity": "sha1-uVH0q7a9YX5m9j64kUmOORdj4wk=", "dev": true, "requires": { - "source-map": "0.5.6", + "source-map": "0.5.7", "uglify-js": "2.8.29", "webpack-sources": "1.0.1" } @@ -7717,7 +7748,7 @@ "memory-fs": "0.4.1", "mkdirp": "0.5.1", "node-libs-browser": "2.0.0", - "source-map": "0.5.6", + "source-map": "0.5.7", "supports-color": "4.2.1", "tapable": "0.2.8", "uglifyjs-webpack-plugin": "0.4.6", @@ -7756,7 +7787,7 @@ "dev": true, "requires": { "source-list-map": "2.0.0", - "source-map": "0.5.6" + "source-map": "0.5.7" } }, "which": { @@ -7774,6 +7805,34 @@ "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, + "which-promise": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/which-promise/-/which-promise-1.0.0.tgz", + "integrity": "sha1-ILch3wWzW3Bhdv+hCwkJq6RgMDU=", + "dev": true, + "requires": { + "pify": "2.3.0", + "pinkie-promise": "1.0.0", + "which": "1.3.0" + }, + "dependencies": { + "pinkie": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-1.0.0.tgz", + "integrity": "sha1-Wkfyi6EBXQIBvae/DzWOR77Ix+Q=", + "dev": true + }, + "pinkie-promise": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-1.0.0.tgz", + "integrity": "sha1-0dpn9UglY7t89X8oauKCLs+/NnA=", + "dev": true, + "requires": { + "pinkie": "1.0.0" + } + } + } + }, "widest-line": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-1.0.0.tgz", diff --git a/package.json b/package.json index 29b1cf8..ce5f333 100644 --- a/package.json +++ b/package.json @@ -140,6 +140,7 @@ "uid-promise": "1.0.0", "update-notifier": "2.2.0", "webpack": "3.5.5", - "webpack-node-externals": "1.6.0" + "webpack-node-externals": "1.6.0", + "which-promise": "1.0.0" } }