Skip to content

Commit

Permalink
feat(api): ✨ add target options to API
Browse files Browse the repository at this point in the history
Closes: #652
  • Loading branch information
joaomoreno committed Nov 22, 2021
1 parent 6a0c946 commit 4d571f2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
},
"conventionalCommits.scopes": ["api"]
}
20 changes: 16 additions & 4 deletions src/api.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { publish as _publish } from './publish';
import { packageCommand, listFiles as _listFiles } from './package';

export interface IVSIXOptions {
export interface IBaseVSIXOptions {
/**
* The base URL for links detected in Markdown files.
*/
Expand All @@ -28,9 +28,16 @@ export interface IVSIXOptions {
* 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;
}

export interface ICreateVSIXOptions extends IVSIXOptions {
export interface ICreateVSIXOptions extends IBaseVSIXOptions {
/**
* The location of the extension in the file system.
*
Expand Down Expand Up @@ -112,7 +119,7 @@ export interface IListFilesOptions {
ignoreFile?: string;
}

export interface IPublishVSIXOptions extends IVSIXOptions {
export interface IPublishVSIXOptions extends IBaseVSIXOptions {
/**
* The Personal Access Token to use.
*
Expand Down Expand Up @@ -146,5 +153,10 @@ export function listFiles(options: IListFilesOptions = {}): Promise<string[]> {
* Publishes a pre-build VSIX.
*/
export function publishVSIX(packagePath: string | string[], options: IPublishVSIXOptions = {}): Promise<any> {
return _publish({ packagePath: typeof packagePath === 'string' ? [packagePath] : packagePath, ...options });
return _publish({
packagePath: typeof packagePath === 'string' ? [packagePath] : packagePath,
...options,
targets: typeof options.target === 'string' ? [options.target] : undefined,

This comment has been minimized.

Copy link
@itsdouges

itsdouges Jul 1, 2024

Is there any reason why target can't be an array? packagePath looks like it can be.

...{ target: undefined },
});
}

0 comments on commit 4d571f2

Please sign in to comment.