Skip to content

Commit 8e193c9

Browse files
authoredAug 29, 2022
feat: expose all options to packaging and publishing APIs (#759)
* feat: expose all options to packaging api * feat: expose all options to the publishing api * fix: remove extraneous version property * feat: re-export `IPackageOptions` * chore: move comments * fix: export type `IPackageOptions`
1 parent 5110bcf commit 8e193c9

File tree

3 files changed

+85
-96
lines changed

3 files changed

+85
-96
lines changed
 

‎src/api.ts

+18-96
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,20 @@
1-
import { publish as _publish } from './publish';
2-
import { packageCommand, listFiles as _listFiles } from './package';
1+
import { publish as _publish, IPublishOptions as _IPublishOptions } from './publish';
2+
import { packageCommand, listFiles as _listFiles, IPackageOptions } from './package';
33

4-
export interface IBaseVSIXOptions {
5-
/**
6-
* The base URL for links detected in Markdown files.
7-
*/
8-
baseContentUrl?: string;
9-
10-
/**
11-
* The base URL for images detected in Markdown files.
12-
*/
13-
baseImagesUrl?: string;
14-
15-
/**
16-
* Github branch used to publish the package. Used to automatically infer
17-
* the base content and images URI.
18-
*/
19-
githubBranch?: string;
20-
21-
/**
22-
* Gitlab branch used to publish the package. Used to automatically infer
23-
* the base content and images URI.
24-
*/
25-
gitlabBranch?: string;
26-
27-
/**
28-
* Should use Yarn instead of NPM.
29-
*/
30-
useYarn?: boolean;
31-
32-
/**
33-
* Optional target the extension should run on.
34-
*
35-
* https://code.visualstudio.com/api/working-with-extensions/publishing-extension#platformspecific-extensions
36-
*/
37-
target?: string;
38-
39-
/**
40-
* Mark this package as a pre-release
41-
*/
42-
preRelease?: boolean;
43-
}
44-
45-
export interface ICreateVSIXOptions extends IBaseVSIXOptions {
46-
/**
47-
* The location of the extension in the file system.
48-
*
49-
* Defaults to `process.cwd()`.
50-
*/
51-
cwd?: string;
52-
53-
/**
54-
* The destination of the packaged the VSIX.
55-
*
56-
* Defaults to `NAME-VERSION.vsix`.
57-
*/
58-
packagePath?: string;
59-
}
60-
61-
export interface IPublishOptions {
62-
/**
63-
* The location of the extension in the file system.
64-
*
65-
* Defaults to `process.cwd()`.
66-
*/
67-
cwd?: string;
68-
69-
/**
70-
* The Personal Access Token to use.
71-
*
72-
* Defaults to the stored one.
73-
*/
74-
pat?: string;
75-
76-
/**
77-
* The base URL for links detected in Markdown files.
78-
*/
79-
baseContentUrl?: string;
4+
export type { IPackageOptions } from './package';
805

81-
/**
82-
* The base URL for images detected in Markdown files.
83-
*/
84-
baseImagesUrl?: string;
6+
/**
7+
* @deprecated prefer IPackageOptions instead
8+
*/
9+
export type IBaseVSIXOptions = Pick<
10+
IPackageOptions,
11+
'baseContentUrl' | 'baseImagesUrl' | 'githubBranch' | 'gitlabBranch' | 'useYarn' | 'target' | 'preRelease'
12+
>;
8513

86-
/**
87-
* Should use Yarn instead of NPM.
88-
*/
89-
useYarn?: boolean;
90-
}
14+
/**
15+
* @deprecated prefer IPackageOptions instead
16+
*/
17+
export type ICreateVSIXOptions = Pick<IPackageOptions, 'cwd' | 'packagePath'> & IBaseVSIXOptions;
9118

9219
/**
9320
* The supported list of package managers.
@@ -124,19 +51,14 @@ export interface IListFilesOptions {
12451
ignoreFile?: string;
12552
}
12653

127-
export interface IPublishVSIXOptions extends IBaseVSIXOptions {
128-
/**
129-
* The Personal Access Token to use.
130-
*
131-
* Defaults to the stored one.
132-
*/
133-
pat?: string;
134-
}
54+
export type IPublishVSIXOptions = IPublishOptions & Pick<IPackageOptions, 'target'>;
55+
56+
export type IPublishOptions = _IPublishOptions;
13557

13658
/**
13759
* Creates a VSIX from the extension in the current working directory.
13860
*/
139-
export function createVSIX(options: ICreateVSIXOptions = {}): Promise<any> {
61+
export function createVSIX(options: IPackageOptions = {}): Promise<any> {
14062
return packageCommand(options);
14163
}
14264

‎src/package.ts

+43
Original file line numberDiff line numberDiff line change
@@ -67,24 +67,67 @@ export interface IAsset {
6767
}
6868

6969
export interface IPackageOptions {
70+
/**
71+
* The destination of the packaged the VSIX.
72+
*
73+
* Defaults to `NAME-VERSION.vsix`.
74+
*/
7075
readonly packagePath?: string;
7176
readonly version?: string;
77+
78+
/**
79+
* Optional target the extension should run on.
80+
*
81+
* https://code.visualstudio.com/api/working-with-extensions/publishing-extension#platformspecific-extensions
82+
*/
7283
readonly target?: string;
7384
readonly commitMessage?: string;
7485
readonly gitTagVersion?: boolean;
7586
readonly updatePackageJson?: boolean;
87+
88+
/**
89+
* The location of the extension in the file system.
90+
*
91+
* Defaults to `process.cwd()`.
92+
*/
7693
readonly cwd?: string;
94+
95+
/**
96+
* Github branch used to publish the package. Used to automatically infer
97+
* the base content and images URI.
98+
*/
7799
readonly githubBranch?: string;
100+
101+
/**
102+
* Gitlab branch used to publish the package. Used to automatically infer
103+
* the base content and images URI.
104+
*/
78105
readonly gitlabBranch?: string;
106+
79107
readonly rewriteRelativeLinks?: boolean;
108+
/**
109+
* The base URL for links detected in Markdown files.
110+
*/
80111
readonly baseContentUrl?: string;
112+
113+
/**
114+
* The base URL for images detected in Markdown files.
115+
*/
81116
readonly baseImagesUrl?: string;
117+
118+
/**
119+
* Should use Yarn instead of NPM.
120+
*/
82121
readonly useYarn?: boolean;
83122
readonly dependencyEntryPoints?: string[];
84123
readonly ignoreFile?: string;
85124
readonly gitHubIssueLinking?: boolean;
86125
readonly gitLabIssueLinking?: boolean;
87126
readonly dependencies?: boolean;
127+
128+
/**
129+
* Mark this package as a pre-release
130+
*/
88131
readonly preRelease?: boolean;
89132
readonly allowStarActivation?: boolean;
90133
readonly allowMissingRepository?: boolean;

‎src/publish.ts

+24
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,38 @@ export interface IPublishOptions {
1919
readonly commitMessage?: string;
2020
readonly gitTagVersion?: boolean;
2121
readonly updatePackageJson?: boolean;
22+
23+
/**
24+
* The location of the extension in the file system.
25+
*
26+
* Defaults to `process.cwd()`.
27+
*/
2228
readonly cwd?: string;
2329
readonly githubBranch?: string;
2430
readonly gitlabBranch?: string;
31+
32+
/**
33+
* The base URL for links detected in Markdown files.
34+
*/
2535
readonly baseContentUrl?: string;
36+
37+
/**
38+
* The base URL for images detected in Markdown files.
39+
*/
2640
readonly baseImagesUrl?: string;
41+
42+
/**
43+
* Should use Yarn instead of NPM.
44+
*/
2745
readonly useYarn?: boolean;
2846
readonly dependencyEntryPoints?: string[];
2947
readonly ignoreFile?: string;
48+
49+
/**
50+
* The Personal Access Token to use.
51+
*
52+
* Defaults to the stored one.
53+
*/
3054
readonly pat?: string;
3155
readonly noVerify?: boolean;
3256
readonly dependencies?: boolean;

0 commit comments

Comments
 (0)
Please sign in to comment.