File tree 3 files changed +23
-0
lines changed
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 @@ -172,6 +172,7 @@ export interface VSIX {
172
172
localizedLanguages : string ;
173
173
preRelease : boolean ;
174
174
sponsorLink : string ;
175
+ pricing : string ;
175
176
}
176
177
177
178
export class BaseProcessor implements IProcessor {
@@ -475,6 +476,7 @@ export class ManifestProcessor extends BaseProcessor {
475
476
target,
476
477
engine : manifest . engines [ 'vscode' ] ,
477
478
description : manifest . description ?? '' ,
479
+ pricing : manifest . pricing ?? 'Free' ,
478
480
categories : ( manifest . categories ?? [ ] ) . join ( ',' ) ,
479
481
flags : flags . join ( ' ' ) ,
480
482
links : {
@@ -1191,6 +1193,10 @@ export function validateManifest(manifest: Manifest): Manifest {
1191
1193
throw new Error ( 'Manifest missing field: version' ) ;
1192
1194
}
1193
1195
1196
+ if ( manifest . pricing && ! [ 'Free' , 'Trial' ] . includes ( manifest . pricing ) ) {
1197
+ throw new Error ( 'Pricing should be Free or Trial' ) ;
1198
+ }
1199
+
1194
1200
validateVersion ( manifest . version ) ;
1195
1201
1196
1202
if ( ! manifest . engines ) {
@@ -1404,6 +1410,8 @@ export async function toVsixManifest(vsix: VSIX): Promise<string> {
1404
1410
: ''
1405
1411
}
1406
1412
<Property Id="Microsoft.VisualStudio.Services.GitHubFlavoredMarkdown" Value="${ escape ( vsix . githubMarkdown ) } " />
1413
+ <Property Id="Microsoft.VisualStudio.Services.Content.Pricing" Value="${ escape ( vsix . pricing ) } "/>
1414
+
1407
1415
${
1408
1416
vsix . enableMarketplaceQnA !== undefined
1409
1417
? `<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