From 1dcedef92c742f8557eed25ec843d363f95ca594 Mon Sep 17 00:00:00 2001 From: Prashant Cholachagudda Date: Fri, 21 Oct 2022 16:52:49 +0530 Subject: [PATCH] feat: support pricing model in the manifest file (#749) * feat: support pricing model in the manifest file * feat: make pricing value case insensitive * Revert "feat: make pricing value case insensitive" This reverts commit 29d1fb4c7a467c787d2b1e574e07d72dd620deb5. --- src/manifest.ts | 1 + src/package.ts | 8 ++++++++ src/test/package.test.ts | 14 ++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/src/manifest.ts b/src/manifest.ts index d7608915..35827065 100644 --- a/src/manifest.ts +++ b/src/manifest.ts @@ -79,6 +79,7 @@ export interface Manifest { dependencies?: { [name: string]: string }; devDependencies?: { [name: string]: string }; private?: boolean; + pricing?: string; // vsce vsce?: any; diff --git a/src/package.ts b/src/package.ts index 9faf7a10..d8a1f3b9 100644 --- a/src/package.ts +++ b/src/package.ts @@ -172,6 +172,7 @@ export interface VSIX { localizedLanguages: string; preRelease: boolean; sponsorLink: string; + pricing: string; } export class BaseProcessor implements IProcessor { @@ -475,6 +476,7 @@ export class ManifestProcessor extends BaseProcessor { target, engine: manifest.engines['vscode'], description: manifest.description ?? '', + pricing: manifest.pricing ?? 'Free', categories: (manifest.categories ?? []).join(','), flags: flags.join(' '), links: { @@ -1191,6 +1193,10 @@ export function validateManifest(manifest: Manifest): Manifest { throw new Error('Manifest missing field: version'); } + if (manifest.pricing && !['Free', 'Trial'].includes(manifest.pricing)) { + throw new Error('Pricing should be Free or Trial'); + } + validateVersion(manifest.version); if (!manifest.engines) { @@ -1404,6 +1410,8 @@ export async function toVsixManifest(vsix: VSIX): Promise { : '' } + + ${ vsix.enableMarketplaceQnA !== undefined ? `