Skip to content

Commit

Permalink
cleaner interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomoreno committed Jul 19, 2021
1 parent c56741f commit 2d6d488
Showing 1 changed file with 3 additions and 24 deletions.
27 changes: 3 additions & 24 deletions src/publish.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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<any> {
Expand All @@ -135,19 +124,9 @@ export function publish(options: IPublishOptions = {}): Promise<any> {
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 }) => {
Expand Down

0 comments on commit 2d6d488

Please sign in to comment.