Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show URL of published extension when it is successful #281

Merged
merged 1 commit into from Aug 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/publish.ts
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
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