Skip to content

Commit

Permalink
fix: use another npm endpoint to check for package existence (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
RasPhilCo authored Jun 17, 2020
1 parent 3599c91 commit a1aa2c0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export default class Plugins {
private async npmHasPackage(name: string): Promise<boolean> {
try {
const http: typeof HTTP = require('http-call').HTTP
const url = `${this.npmRegistry}/-/package/${name.replace('/', '%2f')}/dist-tags`
const url = `${this.npmRegistry}/${name.replace('/', '%2f')}`
await http.get(url)
return true
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion test/commands/plugins/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('command', () => {

test
.nock('https://registry.npmjs.org', api => api
.get('/-/package/@heroku-cli%2fplugin-stubbed/dist-tags')
.get('/@heroku-cli%2fplugin-stubbed')
.reply(503, ''))
.command(['plugins:install', 'stubbed'], {reset: true})
.catch(/HTTP Error 503/)
Expand Down

0 comments on commit a1aa2c0

Please sign in to comment.