Skip to content

Feature/issue 214 add show command#215

Merged
joaomoreno merged 13 commits intomicrosoft:masterfrom
raix:feature/issue-214-add-show-command
Nov 20, 2017
Merged

Feature/issue 214 add show command#215
joaomoreno merged 13 commits intomicrosoft:masterfrom
raix:feature/issue-214-add-show-command

Conversation

@raix
Copy link
Contributor

@raix raix commented Nov 16, 2017

This pr. contains the initial proposal for a “show” extension metadata command

Usage:

$ vsce show <extensionId>

# or as json

$ vsce show <extensionId> --json

image
image

Morten Henriksen added 2 commits November 16, 2017 23:07
It will grab an available `pat` and query extensio gallary (ro)
Initial version of show command

Usage:
```bash
$ vsce show gitlens.eamodio

# or as json

$ vsce show gitlens.eamodio --json
```
@msftclas
Copy link

msftclas commented Nov 16, 2017

CLA assistant check
All CLA requirements met.

@joaomoreno joaomoreno added this to the Backlog milestone Nov 17, 2017
@joaomoreno joaomoreno self-requested a review November 17, 2017 09:17
@joaomoreno joaomoreno self-assigned this Nov 17, 2017
Copy link
Member

@joaomoreno joaomoreno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good.

Though it doesn't work for me:

image

.description('Remove a publisher from the known publishers list')
.action(name => main(logoutPublisher(name)));

program
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use extensionid, just like unpublish.

src/show.ts Outdated
ExtensionQueryFlags.IncludeMetadata |
ExtensionQueryFlags.IncludeStatistics |
ExtensionQueryFlags.IncludeVersions;
return getExtension(extensionPublisher, extensionName, undefined, flags)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We gotta do some error handling here.

image

Something like Extension 'joao' not found would be better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah - also taking into account that it doesn't work for you, would be nice to have more debugging.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+options

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joaomoreno I'm wondering why it errors Invalid Resource could you do npm list vso-node-api to see what version of the api you are on?
(I'm at [email protected])

src/show.ts Outdated
export type ViewTable = ViewTableRow[];

export function show(extensionUniqIdentifier: string, json: boolean = false): Promise<any> {
const [extensionPublisher, extensionName] = extensionUniqIdentifier.split(/\.(.+)?/, 2);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kind of a strange regex here. You just need .split('.').

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After second thought, extensionName could have dots - but it would not be valid. eg.: vsce show mortenhenriksen.perl-debug.foo would return the package perl-debug. I've made the extensionId "parsing" more readable so it throws on invalid extension names.

Copy link
Member

@joaomoreno joaomoreno Nov 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Publishers and extension names can't have dots. 👍 The Marketplace doesn't support it.

Morten Henriksen added 3 commits November 17, 2017 14:25
* naming consistency "extensionUniqIdentifier" -> "extensionid"
* Make extensionid parser more readable
This can happen if access token is invalid/has expired.

The solution added in this commit:
* Try each available token until success or all failed.

Not ideal but we require a PAT since we access `_apis/gallery` and not `_apis/public/gallery/extensionquery`
@joaomoreno
Copy link
Member

@raix Got the same [email protected] dependency. Hmmm.

@raix
Copy link
Contributor Author

raix commented Nov 17, 2017

@joaomoreno I've added error handler for the "Invalid Resource" error with the current constraints, would be nice if the public api was available in vso-node-api.

@joaomoreno
Copy link
Member

joaomoreno commented Nov 17, 2017

Yup, that was it! I had an old access token. Interesting, I wonder if we can get this to work without depending on login.

Love those unicode stars! ★ ★ ★ ★ ★

@raix
Copy link
Contributor Author

raix commented Nov 17, 2017

We could just make a post call directly to the public api v3.preview

Morten Henriksen added 4 commits November 17, 2017 21:47
* add minimal `PublicGalleryAPI`
* no PAT requirements
It will deprecate in the future + not that useful
@raix
Copy link
Contributor Author

raix commented Nov 17, 2017

@joaomoreno I've added PublicGalleryAPI this doesn't require a pat, let me know what you think

(one could ague that it belongs in vso-node-api)

Morten Henriksen added 3 commits November 18, 2017 07:56
@raix raix changed the title WIP: Feature/issue 214 add show command Feature/issue 214 add show command Nov 18, 2017
@joaomoreno joaomoreno merged commit bf162ac into microsoft:master Nov 20, 2017
@joaomoreno
Copy link
Member

Great stuff. Thanks! 🍻

@joaomoreno
Copy link
Member

@modigrv Is there any way we can use the vso-node-api in an unauthenticated way? I've tried passing a no-op AuthHandler to the WebApi but the extension query request eventually fails while getting versioning data.

@raix
Copy link
Contributor Author

raix commented Nov 20, 2017

( Currently using the public /_apis/public the /gallery/extensionquery - similar to whats done in vs code)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants