Skip to content

Commit

Permalink
Merge pull request #281 from sri/master
Browse files Browse the repository at this point in the history
Show URL of published extension when it is successful
  • Loading branch information
joaomoreno committed Aug 20, 2018
2 parents 9035c7d + 335f166 commit 435cd40
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ExtensionQueryFlags, PublishedExtension, ExtensionQueryFilterType, Pagi
import { pack, readManifest, IPackageResult } from './package';
import * as tmp from 'tmp';
import { getPublisher } from './store';
import { getGalleryAPI, read } from './util';
import { getGalleryAPI, read, getPublishedUrl } from './util';
import { validatePublisher } from './validation';
import { Manifest } from './manifest';
import * as denodeify from 'denodeify';
Expand Down Expand Up @@ -57,7 +57,8 @@ function _publish(packagePath: string, pat: string, manifest: Manifest): Promise

const packageStream = fs.createReadStream(packagePath);

const fullName = `${manifest.publisher}.${manifest.name}@${manifest.version}`;
const name = `${manifest.publisher}.${manifest.name}`;
const fullName = `${name}@${manifest.version}`;
console.log(`Publishing ${fullName}...`);

return api.getExtension(manifest.publisher, manifest.name, null, ExtensionQueryFlags.IncludeVersions)
Expand All @@ -73,7 +74,7 @@ function _publish(packagePath: string, pat: string, manifest: Manifest): Promise

return promise
.catch(err => Promise.reject(err.statusCode === 409 ? `${fullName} already exists.` : err))
.then(() => console.log(`Successfully published ${fullName}!`));
.then(() => console.log(`Successfully published ${fullName}!\nYour extension will live at ${getPublishedUrl(name)} (might take a few seconds for it to show up).`));
})
.catch(err => {
const message = err && err.message || '';
Expand Down
4 changes: 4 additions & 0 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ export function read(prompt: string, options: _read.Options = {}): Promise<strin

const marketplaceUrl = process.env['VSCE_MARKETPLACE_URL'] || 'https://marketplace.visualstudio.com';

export function getPublishedUrl(extension: string): string {
return `${marketplaceUrl}/items?itemName=${extension}`;
}

export function getGalleryAPI(pat: string): IGalleryApi {
const authHandler = getBasicHandler('oauth', pat);
const vsoapi = new WebApi('oauth', authHandler);
Expand Down

0 comments on commit 435cd40

Please sign in to comment.