From 371bc3204a79d13a6397506271913d5d1cdac819 Mon Sep 17 00:00:00 2001 From: Jeff Dickey <216188+jdxcode@users.noreply.github.com> Date: Fri, 20 Apr 2018 15:07:34 -0700 Subject: [PATCH] fix: set binpath --- package.json | 10 +++++----- src/commands/update.ts | 11 ++++++++--- yarn.lock | 32 ++++++++++++++++++-------------- 3 files changed, 31 insertions(+), 22 deletions(-) diff --git a/package.json b/package.json index b7a3d9d1..0f026bcb 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "dependencies": { "@heroku-cli/color": "^1.1.3", "@oclif/command": "^1.4.13", - "@oclif/config": "^1.6.4", + "@oclif/config": "^1.6.6", "@oclif/errors": "^1.0.4", "@types/semver": "^5.5.0", "cli-ux": "^3.3.31", @@ -25,14 +25,14 @@ "@oclif/plugin-help": "^1.2.4", "@oclif/test": "^1.0.5", "@oclif/tslint": "^1.1.0", - "@types/chai": "^4.1.2", + "@types/chai": "^4.1.3", "@types/cross-spawn": "^6.0.0", "@types/execa": "^0.9.0", "@types/fs-extra": "^5.0.2", "@types/glob": "^5.0.35", "@types/lodash": "^4.14.107", - "@types/mocha": "^5.1.0", - "@types/node": "^9.6.5", + "@types/mocha": "^5.2.0", + "@types/node": "^9.6.6", "@types/supports-color": "^5.3.0", "@types/write-json-file": "^2.2.1", "chai": "^4.1.2", @@ -42,7 +42,7 @@ "ts-node": "6.0.0", "tslib": "^1.9.0", "tslint": "^5.9.1", - "typescript": "^2.8.1" + "typescript": "^2.8.3" }, "engines": { "node": ">=8.0.0" diff --git a/src/commands/update.ts b/src/commands/update.ts index 47884b7d..cf7bfb06 100644 --- a/src/commands/update.ts +++ b/src/commands/update.ts @@ -177,10 +177,15 @@ export default class UpdateCommand extends Command { } private async createBin(version: string) { - let dst = this.clientBin + const dst = this.clientBin + const {bin} = this.config + const binPathEnvVar = this.config.scopedEnvVarKey('BINPATH') + const redirectedEnvVar = this.config.scopedEnvVarKey('REDIRECTED') if (this.config.windows) { let body = `@echo off -"%~dp0\\..\\${version}\\bin\\${this.config.bin}.cmd" %* +set ${redirectedEnvVar}="1" +set ${binPathEnvVar}="%~dp0${bin}" +"%~dp0..\\${version}\\bin\\${bin}.cmd" %* ` await fs.outputFile(dst, body) } else { @@ -199,7 +204,7 @@ get_script_dir () { echo "$DIR" } DIR=$(get_script_dir) -HEROKU_CLI_REDIRECTED=1 "$DIR/../${version}/bin/${this.config.bin}" "$@" +${binPathEnvVar}="\$DIR/${bin}" ${redirectedEnvVar}=1 "$DIR/../${version}/bin/${bin}" "$@" ` await fs.remove(dst) diff --git a/yarn.lock b/yarn.lock index 4ac92e1c..76a94c18 100644 --- a/yarn.lock +++ b/yarn.lock @@ -49,6 +49,12 @@ dependencies: debug "^3.1.0" +"@oclif/config@^1.6.6": + version "1.6.6" + resolved "https://registry.yarnpkg.com/@oclif/config/-/config-1.6.6.tgz#8a5aed05018b6294ce4a46cba75aacebb1a3bf16" + dependencies: + debug "^3.1.0" + "@oclif/dev-cli@^1.13.1": version "1.13.1" resolved "https://registry.yarnpkg.com/@oclif/dev-cli/-/dev-cli-1.13.1.tgz#3a40b2c5890c86413ef3a2fcf232178cff7e897c" @@ -115,9 +121,9 @@ dependencies: tslint-xo "^0.7.0" -"@types/chai@^4.1.2": - version "4.1.2" - resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.1.2.tgz#f1af664769cfb50af805431c407425ed619daa21" +"@types/chai@^4.1.3": + version "4.1.3" + resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.1.3.tgz#b8a74352977a23b604c01aa784f5b793443fb7dc" "@types/cross-spawn@^6.0.0": version "6.0.0" @@ -157,19 +163,17 @@ version "3.0.3" resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" -"@types/mocha@^5.1.0": - version "5.1.0" - resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-5.1.0.tgz#591f158012ec30de978b00065239a84fb1ce4380" - dependencies: - "@types/node" "*" +"@types/mocha@^5.2.0": + version "5.2.0" + resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-5.2.0.tgz#b3c8e69f038835db1a7fdc0b3d879fc50506e29e" "@types/node@*": version "7.0.60" resolved "https://registry.yarnpkg.com/@types/node/-/node-7.0.60.tgz#5406c35961e4f9e2d5a1b9482daa14501754ecda" -"@types/node@^9.6.5": - version "9.6.5" - resolved "https://registry.yarnpkg.com/@types/node/-/node-9.6.5.tgz#ee700810fdf49ac1c399fc5980b7559b3e5a381d" +"@types/node@^9.6.6": + version "9.6.6" + resolved "https://registry.yarnpkg.com/@types/node/-/node-9.6.6.tgz#439b91f9caf3983cad2eef1e11f6bedcbf9431d2" "@types/semver@^5.5.0": version "5.5.0" @@ -1749,9 +1753,9 @@ type-detect@^4.0.0: version "4.0.8" resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" -typescript@^2.8.1: - version "2.8.1" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.8.1.tgz#6160e4f8f195d5ba81d4876f9c0cc1fbc0820624" +typescript@^2.8.3: + version "2.8.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.8.3.tgz#5d817f9b6f31bb871835f4edf0089f21abe6c170" union-value@^1.0.0: version "1.0.0"