Merge commit 'refs/pull/405/head' of github.com:microsoft/vscode-vsce into pr/405

This commit is contained in:
Joao Moreno 2019-12-02 09:57:43 +01:00
commit aa73aacb0e
No known key found for this signature in database
GPG key ID: 9494F5E6167A8E6B
2 changed files with 11 additions and 4 deletions

View file

@ -93,7 +93,8 @@ module.exports = function (argv: string[]): void {
.command('unpublish [<extensionid>]')
.description('Unpublishes an extension. Example extension id: microsoft.csharp.')
.option('-p, --pat <token>', 'Personal Access Token')
.action((id, { pat }) => main(unpublish({ id, pat })));
.option('-f, --force', 'Forces Unpublished Extension')
.action((id, { pat, force }) => main(unpublish({ id, pat, force })));
program
.command('ls-publishers')

View file

@ -92,6 +92,7 @@ export interface IPublishOptions {
commitMessage?: string;
cwd?: string;
pat?: string;
force?: boolean;
baseContentUrl?: string;
baseImagesUrl?: string;
useYarn?: boolean;
@ -187,14 +188,19 @@ export function unpublish(options: IUnpublishOptions = {}): Promise<any> {
}
return promise.then(({ publisher, name }) => {
const fullName = `${publisher}.${name}`;
const pat = options.pat
? Promise.resolve(options.pat)
: getPublisher(publisher).then(p => p.pat);
return read(`This will FOREVER delete '${fullName}'! Are you sure? [y/N] `)
.then(answer => /^y$/i.test(answer) ? null : Promise.reject('Aborted'))
.then(() => pat)
const force = options.force;
return (!force ? (
read(`This will FOREVER delete '${fullName}'! Are you sure? [y/N] `)
.then(answer => /^y$/i.test(answer) ? pat : Promise.reject('Aborted'))
//.then(() => pat)
) : pat)
.then(getGalleryAPI)
.then(api => api.deleteExtension(publisher, name))
.then(() => log.done(`Deleted extension: ${fullName}!`));