From c9b4c2053d055e4cfccd072182f31dda24f162f9 Mon Sep 17 00:00:00 2001 From: Nicolas Hedger Date: Sat, 23 Jul 2022 19:57:29 +0200 Subject: [PATCH 1/6] feat: expose all options to packaging api --- src/api.ts | 101 +++++++---------------------------------------------- 1 file changed, 13 insertions(+), 88 deletions(-) diff --git a/src/api.ts b/src/api.ts index 87ec33fc..b0036027 100644 --- a/src/api.ts +++ b/src/api.ts @@ -1,93 +1,18 @@ import { publish as _publish } from './publish'; -import { packageCommand, listFiles as _listFiles } from './package'; +import { packageCommand, listFiles as _listFiles, IPackageOptions } from './package'; -export interface IBaseVSIXOptions { - /** - * The base URL for links detected in Markdown files. - */ - baseContentUrl?: string; - - /** - * The base URL for images detected in Markdown files. - */ - baseImagesUrl?: string; - - /** - * Github branch used to publish the package. Used to automatically infer - * the base content and images URI. - */ - githubBranch?: string; - - /** - * Gitlab branch used to publish the package. Used to automatically infer - * the base content and images URI. - */ - gitlabBranch?: string; - - /** - * Should use Yarn instead of NPM. - */ - useYarn?: boolean; - - /** - * Optional target the extension should run on. - * - * https://code.visualstudio.com/api/working-with-extensions/publishing-extension#platformspecific-extensions - */ - target?: string; - - /** - * Mark this package as a pre-release - */ - preRelease?: boolean; -} - -export interface ICreateVSIXOptions extends IBaseVSIXOptions { - /** - * The location of the extension in the file system. - * - * Defaults to `process.cwd()`. - */ - cwd?: string; - - /** - * The destination of the packaged the VSIX. - * - * Defaults to `NAME-VERSION.vsix`. - */ - packagePath?: string; -} - -export interface IPublishOptions { - /** - * The location of the extension in the file system. - * - * Defaults to `process.cwd()`. - */ - cwd?: string; - - /** - * The Personal Access Token to use. - * - * Defaults to the stored one. - */ - pat?: string; - - /** - * The base URL for links detected in Markdown files. - */ - baseContentUrl?: string; - - /** - * The base URL for images detected in Markdown files. - */ - baseImagesUrl?: string; +/** + * @deprecated prefer IPackageOptions instead + */ +export type IBaseVSIXOptions = Pick< + IPackageOptions, + 'baseContentUrl' | 'baseImagesUrl' | 'githubBranch' | 'gitlabBranch' | 'useYarn' | 'target' | 'preRelease' | 'version' +>; - /** - * Should use Yarn instead of NPM. - */ - useYarn?: boolean; -} +/** + * @deprecated prefer IPackageOptions instead + */ +export type ICreateVSIXOptions = Pick & IBaseVSIXOptions; /** * The supported list of package managers. @@ -136,7 +61,7 @@ export interface IPublishVSIXOptions extends IBaseVSIXOptions { /** * Creates a VSIX from the extension in the current working directory. */ -export function createVSIX(options: ICreateVSIXOptions = {}): Promise { +export function createVSIX(options: IPackageOptions = {}): Promise { return packageCommand(options); } From d1b6b2b24ac90c6d173431d89a06adaa4283d5da Mon Sep 17 00:00:00 2001 From: Nicolas Hedger Date: Sat, 23 Jul 2022 19:58:16 +0200 Subject: [PATCH 2/6] feat: expose all options to the publishing api --- src/api.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/api.ts b/src/api.ts index b0036027..8be76f35 100644 --- a/src/api.ts +++ b/src/api.ts @@ -1,4 +1,4 @@ -import { publish as _publish } from './publish'; +import { publish as _publish, IPublishOptions as _IPublishOptions } from './publish'; import { packageCommand, listFiles as _listFiles, IPackageOptions } from './package'; /** @@ -49,14 +49,9 @@ export interface IListFilesOptions { ignoreFile?: string; } -export interface IPublishVSIXOptions extends IBaseVSIXOptions { - /** - * The Personal Access Token to use. - * - * Defaults to the stored one. - */ - pat?: string; -} +export type IPublishVSIXOptions = IPublishOptions & Pick; + +export type IPublishOptions = _IPublishOptions; /** * Creates a VSIX from the extension in the current working directory. From 01e06791a117ac3b3f5adf1cc069981bc11ade78 Mon Sep 17 00:00:00 2001 From: Nicolas Hedger Date: Sat, 23 Jul 2022 20:21:05 +0200 Subject: [PATCH 3/6] fix: remove extraneous version property --- src/api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api.ts b/src/api.ts index 8be76f35..6f5e15e1 100644 --- a/src/api.ts +++ b/src/api.ts @@ -6,7 +6,7 @@ import { packageCommand, listFiles as _listFiles, IPackageOptions } from './pack */ export type IBaseVSIXOptions = Pick< IPackageOptions, - 'baseContentUrl' | 'baseImagesUrl' | 'githubBranch' | 'gitlabBranch' | 'useYarn' | 'target' | 'preRelease' | 'version' + 'baseContentUrl' | 'baseImagesUrl' | 'githubBranch' | 'gitlabBranch' | 'useYarn' | 'target' | 'preRelease' >; /** From af161ccacff9744089f3ffe4cb8265ee0651bbdf Mon Sep 17 00:00:00 2001 From: Nicolas Hedger Date: Sat, 23 Jul 2022 20:26:15 +0200 Subject: [PATCH 4/6] feat: re-export `IPackageOptions` --- src/api.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/api.ts b/src/api.ts index 6f5e15e1..71cbd713 100644 --- a/src/api.ts +++ b/src/api.ts @@ -1,6 +1,8 @@ import { publish as _publish, IPublishOptions as _IPublishOptions } from './publish'; import { packageCommand, listFiles as _listFiles, IPackageOptions } from './package'; +export { IPackageOptions }; + /** * @deprecated prefer IPackageOptions instead */ From ed251d536463a478ed1decb4a27a279792083176 Mon Sep 17 00:00:00 2001 From: Nicolas Hedger Date: Sat, 23 Jul 2022 20:37:00 +0200 Subject: [PATCH 5/6] chore: move comments --- src/package.ts | 43 +++++++++++++++++++++++++++++++++++++++++++ src/publish.ts | 24 ++++++++++++++++++++++++ 2 files changed, 67 insertions(+) diff --git a/src/package.ts b/src/package.ts index e27f9f1e..677c764d 100644 --- a/src/package.ts +++ b/src/package.ts @@ -67,24 +67,67 @@ export interface IAsset { } export interface IPackageOptions { + /** + * The destination of the packaged the VSIX. + * + * Defaults to `NAME-VERSION.vsix`. + */ readonly packagePath?: string; readonly version?: string; + + /** + * Optional target the extension should run on. + * + * https://code.visualstudio.com/api/working-with-extensions/publishing-extension#platformspecific-extensions + */ readonly target?: string; readonly commitMessage?: string; readonly gitTagVersion?: boolean; readonly updatePackageJson?: boolean; + + /** + * The location of the extension in the file system. + * + * Defaults to `process.cwd()`. + */ readonly cwd?: string; + + /** + * Github branch used to publish the package. Used to automatically infer + * the base content and images URI. + */ readonly githubBranch?: string; + + /** + * Gitlab branch used to publish the package. Used to automatically infer + * the base content and images URI. + */ readonly gitlabBranch?: string; + readonly rewriteRelativeLinks?: boolean; + /** + * The base URL for links detected in Markdown files. + */ readonly baseContentUrl?: string; + + /** + * The base URL for images detected in Markdown files. + */ readonly baseImagesUrl?: string; + + /** + * Should use Yarn instead of NPM. + */ readonly useYarn?: boolean; readonly dependencyEntryPoints?: string[]; readonly ignoreFile?: string; readonly gitHubIssueLinking?: boolean; readonly gitLabIssueLinking?: boolean; readonly dependencies?: boolean; + + /** + * Mark this package as a pre-release + */ readonly preRelease?: boolean; readonly allowStarActivation?: boolean; readonly allowMissingRepository?: boolean; diff --git a/src/publish.ts b/src/publish.ts index adb0f070..6517ca24 100644 --- a/src/publish.ts +++ b/src/publish.ts @@ -19,14 +19,38 @@ export interface IPublishOptions { readonly commitMessage?: string; readonly gitTagVersion?: boolean; readonly updatePackageJson?: boolean; + + /** + * The location of the extension in the file system. + * + * Defaults to `process.cwd()`. + */ readonly cwd?: string; readonly githubBranch?: string; readonly gitlabBranch?: string; + + /** + * The base URL for links detected in Markdown files. + */ readonly baseContentUrl?: string; + + /** + * The base URL for images detected in Markdown files. + */ readonly baseImagesUrl?: string; + + /** + * Should use Yarn instead of NPM. + */ readonly useYarn?: boolean; readonly dependencyEntryPoints?: string[]; readonly ignoreFile?: string; + + /** + * The Personal Access Token to use. + * + * Defaults to the stored one. + */ readonly pat?: string; readonly noVerify?: boolean; readonly dependencies?: boolean; From 42424891b32b3596409aa4187c9b6277d88f1e44 Mon Sep 17 00:00:00 2001 From: Nicolas Hedger Date: Sun, 24 Jul 2022 10:25:23 +0200 Subject: [PATCH 6/6] fix: export type `IPackageOptions` --- src/api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api.ts b/src/api.ts index 71cbd713..1dafb675 100644 --- a/src/api.ts +++ b/src/api.ts @@ -1,7 +1,7 @@ import { publish as _publish, IPublishOptions as _IPublishOptions } from './publish'; import { packageCommand, listFiles as _listFiles, IPackageOptions } from './package'; -export { IPackageOptions }; +export type { IPackageOptions } from './package'; /** * @deprecated prefer IPackageOptions instead