Skip to content

Commit

Permalink
fix: allow plugins:uninstall to use paths
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed May 10, 2018
1 parent 57bd0c0 commit 3fa8dd8
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 38 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"@heroku-cli/color": "^1.1.3",
"@oclif/command": "^1.4.21",
"chalk": "^2.4.1",
"cli-ux": "^4.0.1",
"cli-ux": "^4.2.1",
"debug": "^3.1.0",
"fs-extra": "^6.0.0",
"fs-extra": "^6.0.1",
"http-call": "^5.1.2",
"load-json-file": "^5.0.0",
"npm-run-path": "^2.0.2",
Expand All @@ -20,8 +20,8 @@
},
"devDependencies": {
"@oclif/config": "^1.6.17",
"@oclif/dev-cli": "^1.13.19",
"@oclif/errors": "^1.0.10",
"@oclif/dev-cli": "^1.13.20",
"@oclif/errors": "^1.0.11",
"@oclif/plugin-help": "^1.2.10",
"@oclif/test": "^1.0.6",
"@oclif/tslint": "^1.1.1",
Expand Down
3 changes: 2 additions & 1 deletion src/commands/plugins/uninstall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ export default class PluginsUninstall extends Command {
$ <%- config.bin %> plugins:uninstall <%- config.pjson.oclif.examplePlugin || "myplugin" %>
`
static variableArgs = true
static args = [{name: 'plugin', description: 'plugin to uninstall', required: true}]
static args = [{name: 'plugin', description: 'plugin to uninstall'}]
static aliases = ['plugins:unlink', 'plugins:remove']

plugins = new Plugins(this.config)

async run() {
const {argv} = this.parse(PluginsUninstall)
this.plugins = new Plugins(this.config)
if (!argv.length) argv.push('.')
for (let plugin of argv) {
const friendly = this.plugins.friendlyName(plugin)
cli.action.start(`Uninstalling ${friendly}`)
Expand Down
8 changes: 7 additions & 1 deletion src/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,13 @@ export default class Plugins {

async hasPlugin(name: string) {
const list = await this.list()
return list.find(p => this.friendlyName(p.name) === this.friendlyName(name))
return list.find(p => {
if (this.friendlyName(p.name) === this.friendlyName(name)) return true
if (p.type === 'link') {
if (path.resolve(p.root) === path.resolve(name)) return true
}
return false
})
}

async yarnNodeVersion(): Promise<string | undefined> {
Expand Down
66 changes: 34 additions & 32 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,26 @@
dependencies:
debug "^3.1.0"

"@oclif/dev-cli@^1.13.19":
version "1.13.19"
resolved "https://registry.yarnpkg.com/@oclif/dev-cli/-/dev-cli-1.13.19.tgz#da43d784d5a3a97922533ab4a9bb3f7c2435d6d0"
"@oclif/dev-cli@^1.13.20":
version "1.13.20"
resolved "https://registry.yarnpkg.com/@oclif/dev-cli/-/dev-cli-1.13.20.tgz#176d78a2b3b7f937f68d418ddf86dddc8c48fb2f"
dependencies:
"@oclif/command" "^1.4.21"
"@oclif/config" "^1.6.17"
"@oclif/errors" "^1.0.9"
"@oclif/errors" "^1.0.11"
"@oclif/plugin-help" "^1.2.10"
cli-ux "^4.0.0"
cli-ux "^4.2.0"
debug "^3.1.0"
fs-extra "^6.0.0"
fs-extra "^6.0.1"
lodash "^4.17.10"
normalize-package-data "^2.4.0"
qqjs "^0.3.8"
require-resolve "^0.0.2"
tslib "^1.9.0"

"@oclif/errors@^1.0.10":
version "1.0.10"
resolved "https://registry.yarnpkg.com/@oclif/errors/-/errors-1.0.10.tgz#ad57a0158f279ef11e175179995a6281a181b275"
"@oclif/errors@^1.0.11":
version "1.0.11"
resolved "https://registry.yarnpkg.com/@oclif/errors/-/errors-1.0.11.tgz#567785e311cb076b8e323ebec377d4fa7146d53d"
dependencies:
clean-stack "^1.3.0"
fs-extra "^6.0.0"
Expand Down Expand Up @@ -414,28 +414,9 @@ clean-stack@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-1.3.0.tgz#9e821501ae979986c46b1d66d2d432db2fd4ae31"

cli-ux@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/cli-ux/-/cli-ux-4.0.0.tgz#8c68b3761332f3714ef3bdf517b5aacda53486b4"
dependencies:
"@oclif/linewrap" "^1.0.0"
"@oclif/screen" "^1.0.2"
ansi-styles "^3.2.1"
cardinal "^2.0.0"
chalk "^2.4.1"
clean-stack "^1.3.0"
extract-stack "^1.0.0"
fs-extra "^6.0.0"
indent-string "^3.2.0"
lodash "^4.17.10"
password-prompt "^1.0.5"
semver "^5.5.0"
strip-ansi "^4.0.0"
supports-color "^5.4.0"

cli-ux@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/cli-ux/-/cli-ux-4.0.1.tgz#100f863fc5738db85f031d261276c6c688ef9e81"
cli-ux@^4.2.0, cli-ux@^4.2.1:
version "4.2.1"
resolved "https://registry.yarnpkg.com/cli-ux/-/cli-ux-4.2.1.tgz#d6a14ce85cdacd136e6cafc73674ca84f4557cda"
dependencies:
"@oclif/linewrap" "^1.0.0"
"@oclif/screen" "^1.0.2"
Expand All @@ -445,12 +426,14 @@ cli-ux@^4.0.1:
clean-stack "^1.3.0"
extract-stack "^1.0.0"
fs-extra "^6.0.0"
hyperlinker "^1.0.0"
indent-string "^3.2.0"
lodash "^4.17.10"
password-prompt "^1.0.5"
semver "^5.5.0"
strip-ansi "^4.0.0"
supports-color "^5.4.0"
supports-hyperlinks "^1.0.1"

collection-visit@^1.0.0:
version "1.0.0"
Expand Down Expand Up @@ -738,6 +721,14 @@ fs-extra@^6.0.0:
jsonfile "^4.0.0"
universalify "^0.1.0"

fs-extra@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-6.0.1.tgz#8abc128f7946e310135ddc93b98bddb410e7a34b"
dependencies:
graceful-fs "^4.1.2"
jsonfile "^4.0.0"
universalify "^0.1.0"

fs.realpath@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
Expand Down Expand Up @@ -879,6 +870,10 @@ http-call@^5.1.2:
is-stream "^1.1.0"
tunnel-agent "^0.6.0"

hyperlinker@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/hyperlinker/-/hyperlinker-1.0.0.tgz#23dc9e38a206b208ee49bc2d6c8ef47027df0c0e"

ignore@^3.3.5:
version "3.3.7"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.7.tgz#612289bfb3c220e186a58118618d5be8c1bab021"
Expand Down Expand Up @@ -1692,12 +1687,19 @@ supports-color@^3.2.3:
dependencies:
has-flag "^1.0.0"

supports-color@^5.1.0, supports-color@^5.3.0, supports-color@^5.4.0:
supports-color@^5.0.0, supports-color@^5.1.0, supports-color@^5.3.0, supports-color@^5.4.0:
version "5.4.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.4.0.tgz#1c6b337402c2137605efe19f10fec390f6faab54"
dependencies:
has-flag "^3.0.0"

supports-hyperlinks@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/supports-hyperlinks/-/supports-hyperlinks-1.0.1.tgz#71daedf36cc1060ac5100c351bb3da48c29c0ef7"
dependencies:
has-flag "^2.0.0"
supports-color "^5.0.0"

tar-fs@^1.16.0:
version "1.16.0"
resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-1.16.0.tgz#e877a25acbcc51d8c790da1c57c9cf439817b896"
Expand Down

0 comments on commit 3fa8dd8

Please sign in to comment.