File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ export interface Manifest {
79
79
dependencies ?: { [ name : string ] : string } ;
80
80
devDependencies ?: { [ name : string ] : string } ;
81
81
private ?: boolean ;
82
+ pricing ?: string ;
82
83
83
84
// vsce
84
85
vsce ?: any ;
Original file line number Diff line number Diff line change @@ -129,6 +129,7 @@ export interface VSIX {
129
129
localizedLanguages : string ;
130
130
preRelease : boolean ;
131
131
sponsorLink : string ;
132
+ pricing : string ;
132
133
}
133
134
134
135
export class BaseProcessor implements IProcessor {
@@ -432,6 +433,7 @@ export class ManifestProcessor extends BaseProcessor {
432
433
target,
433
434
engine : manifest . engines [ 'vscode' ] ,
434
435
description : manifest . description ?? '' ,
436
+ pricing : manifest . pricing ?? 'Free' ,
435
437
categories : ( manifest . categories ?? [ ] ) . join ( ',' ) ,
436
438
flags : flags . join ( ' ' ) ,
437
439
links : {
@@ -1148,6 +1150,10 @@ export function validateManifest(manifest: Manifest): Manifest {
1148
1150
throw new Error ( 'Manifest missing field: version' ) ;
1149
1151
}
1150
1152
1153
+ if ( manifest . pricing && ! [ 'Free' , 'Trial' ] . includes ( manifest . pricing ) ) {
1154
+ throw new Error ( 'Pricing should be Free or Trial' ) ;
1155
+ }
1156
+
1151
1157
validateVersion ( manifest . version ) ;
1152
1158
1153
1159
if ( ! manifest . engines ) {
@@ -1361,6 +1367,8 @@ export async function toVsixManifest(vsix: VSIX): Promise<string> {
1361
1367
: ''
1362
1368
}
1363
1369
<Property Id="Microsoft.VisualStudio.Services.GitHubFlavoredMarkdown" Value="${ escape ( vsix . githubMarkdown ) } " />
1370
+ <Property Id="Microsoft.VisualStudio.Services.Content.Pricing" Value="${ escape ( vsix . pricing ) } "/>
1371
+
1364
1372
${
1365
1373
vsix . enableMarketplaceQnA !== undefined
1366
1374
? `<Property Id="Microsoft.VisualStudio.Services.EnableMarketplaceQnA" Value="${ escape (
Original file line number Diff line number Diff line change @@ -390,6 +390,13 @@ describe('validateManifest', () => {
390
390
validateManifest ( createManifest ( { sponsor : { url : 'https://foo.bar' } } ) ) ;
391
391
validateManifest ( createManifest ( { sponsor : { url : 'http://www.foo.com' } } ) ) ;
392
392
} ) ;
393
+
394
+ it ( 'should validate pricing' , ( ) => {
395
+ assert . throws ( ( ) => validateManifest ( createManifest ( { pricing : 'Paid' } ) ) ) ;
396
+ validateManifest ( createManifest ( { pricing : 'Trial' } ) ) ;
397
+ validateManifest ( createManifest ( { pricing : 'Free' } ) ) ;
398
+ validateManifest ( createManifest ( ) ) ;
399
+ } ) ;
393
400
} ) ;
394
401
395
402
describe ( 'toVsixManifest' , ( ) => {
@@ -1724,6 +1731,13 @@ describe('toVsixManifest', () => {
1724
1731
1725
1732
throw new Error ( 'Should not reach here' ) ;
1726
1733
} ) ;
1734
+
1735
+ it ( 'should identify trial version of an extension' , async ( ) => {
1736
+ const manifest = createManifest ( { pricing : 'Trial' } ) ;
1737
+ var raw = await _toVsixManifest ( manifest , [ ] ) ;
1738
+ const xmlManifest = await parseXmlManifest ( raw ) ;
1739
+ assertProperty ( xmlManifest , 'Microsoft.VisualStudio.Services.Content.Pricing' , 'Trial' ) ;
1740
+ } ) ;
1727
1741
} ) ;
1728
1742
1729
1743
describe ( 'qna' , ( ) => {
You can’t perform that action at this time.
0 commit comments