From 2d6d4889192a57cfcfa15db9b8e0e9131ac2fb3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Moreno?= Date: Mon, 19 Jul 2021 17:37:07 +0200 Subject: [PATCH] cleaner interfaces --- src/publish.ts | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/src/publish.ts b/src/publish.ts index e42383b1..d8a774c1 100644 --- a/src/publish.ts +++ b/src/publish.ts @@ -1,6 +1,6 @@ import * as fs from 'fs'; import { ExtensionQueryFlags, PublishedExtension } from 'azure-devops-node-api/interfaces/GalleryInterfaces'; -import { pack, readManifest, IPackage, versionBump } from './package'; +import { pack, readManifest, IPackage, versionBump, IPackageOptions } from './package'; import * as tmp from 'tmp'; import { getPublisher } from './store'; import { getGalleryAPI, read, getPublishedUrl, log, getHubUrl } from './util'; @@ -106,20 +106,9 @@ async function _publish(packagePath: string, pat: string, manifest: Manifest): P log.done(`Published ${fullName}.`); } -export interface IPublishOptions { - readonly packagePath?: string; - readonly version?: string; - readonly commitMessage?: string; - readonly gitTagVersion?: boolean; - readonly cwd?: string; +export interface IPublishOptions extends IPackageOptions { readonly pat?: string; - readonly githubBranch?: string; - readonly gitlabBranch?: string; - readonly baseContentUrl?: string; - readonly baseImagesUrl?: string; - readonly useYarn?: boolean; readonly noVerify?: boolean; - readonly ignoreFile?: string; } export function publish(options: IPublishOptions = {}): Promise { @@ -135,19 +124,9 @@ export function publish(options: IPublishOptions = {}): Promise { packagePath: options.packagePath, })); } else { - const cwd = options.cwd; - const githubBranch = options.githubBranch; - const gitlabBranch = options.gitlabBranch; - const baseContentUrl = options.baseContentUrl; - const baseImagesUrl = options.baseImagesUrl; - const useYarn = options.useYarn; - const ignoreFile = options.ignoreFile; - promise = versionBump(options.cwd, options.version, options.commitMessage, options.gitTagVersion) .then(() => tmpName()) - .then(packagePath => - pack({ packagePath, cwd, githubBranch, gitlabBranch, baseContentUrl, baseImagesUrl, useYarn, ignoreFile }) - ); + .then(packagePath => pack({ ...options, packagePath })); } return promise.then(async ({ manifest, packagePath }) => {