diff --git a/app/exec/extension/_lib/interfaces.ts b/app/exec/extension/_lib/interfaces.ts index 8357c450..168b866e 100644 --- a/app/exec/extension/_lib/interfaces.ts +++ b/app/exec/extension/_lib/interfaces.ts @@ -79,22 +79,22 @@ export interface AssetDeclaration { /** * Describes a screenshot in the manifest */ -export interface ScreenshotDeclaration extends AssetDeclaration { - -} +export interface ScreenshotDeclaration extends AssetDeclaration { } /** * Describes a details file in the manifest */ -export interface DetailsDeclaration extends AssetDeclaration { - +export interface DetailsDeclaration extends AssetDeclaration { } +export interface ContentDeclaration extends AssetDeclaration { } +export interface ContentsDeclaration { + [key: string]: ContentDeclaration; } - /** * Describes a link in the manifest */ export interface LinkDeclaration { - url: string; + url?: string; + uri?: string; } /** @@ -112,6 +112,30 @@ export interface TargetDeclaration { version?: string; } +export interface ContributionDeclaration { + id: string; +} + +export interface ContributionTypeDeclaration { + id: string; +} + +export interface BadgeDeclaration { + link?: string; + imgUri?: string; + description?: string; + href?: string; + uri?: string +} + +export interface RepositoryDeclaration { + type: RepositoryType; + url?: string; + uri?: string; +} + +export type RepositoryType = 'git'; + /** * Describes the extension's branding in the manifest. */ @@ -120,6 +144,48 @@ export interface BrandingDeclaration { theme: string; } +export interface VssManifest { + manifestVersion: string | number; + manifestversion: VssManifest['manifestVersion']; + targets: TargetDeclaration[]; + version: string; + files: FileDeclaration[]; + icons: { [key: string]: string }; + eventcallbacks: {}; + scopes: string[]; + baseuri: string; + contributions: ContributionDeclaration[]; + contributionTypes: ContributionTypeDeclaration[]; + contributiontypes: VssManifest['contributionTypes']; + namespace: string; + extensionid: string; + id: string; + name: string; + description: string; + screenshots: ScreenshotDeclaration[]; + details: DetailsDeclaration; + links: Links; + branding: BrandingDeclaration; + public: boolean; + publisher: string; + releasenotes: string; + tags: string|string[]; + flags: {}; + vsoflags: {}; + galleryflags: string|string[]; + categories: string|string[]; + githubflavoredmarkdown: boolean; + showpricingcalculator: boolean; + content: ContentsDeclaration; + repository: RepositoryDeclaration; + badges: BadgeDeclaration[]; +} + + +export interface VssManifestData extends VssManifest { + __origin: string; +} + /** * Settings for doing the merging */ @@ -142,7 +208,7 @@ export interface MergeSettings { /** * Highest priority partial manifest */ - overrides: any; + overrides: VssManifestData; /** * True to bypass validation during packaging. diff --git a/app/exec/extension/_lib/vsix-manifest-builder.ts b/app/exec/extension/_lib/vsix-manifest-builder.ts index 7a1470b1..59db6400 100644 --- a/app/exec/extension/_lib/vsix-manifest-builder.ts +++ b/app/exec/extension/_lib/vsix-manifest-builder.ts @@ -332,6 +332,7 @@ export class VsixManifestBuilder extends ManifestBuilder { throw "Value for gitHubFlavoredMarkdown is invalid. Only boolean values are allowed."; } this.addProperty("Microsoft.VisualStudio.Services.GitHubFlavoredMarkdown", value.toString()); + break; case "public": if (typeof value === "boolean") { let flags = _.get(this.data, "PackageManifest.Metadata[0].GalleryFlags[0]", "").split(" "); diff --git a/manifest.schema.json b/manifest.schema.json new file mode 100644 index 00000000..0ae167ce --- /dev/null +++ b/manifest.schema.json @@ -0,0 +1,369 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "definitions": { + "BadgeDeclaration": { + "properties": { + "description": { + "type": "string" + }, + "href": { + "type": "string" + }, + "imgUri": { + "type": "string" + }, + "link": { + "type": "string" + }, + "uri": { + "type": "string" + } + }, + "type": "object" + }, + "BrandingDeclaration": { + "description": "Describes the extension's branding in the manifest.", + "properties": { + "color": { + "type": "string" + }, + "theme": { + "type": "string" + } + }, + "type": "object" + }, + "ContentDeclaration": { + "properties": { + "contentType": { + "type": "string" + }, + "path": { + "type": "string" + } + }, + "type": "object" + }, + "ContentsDeclaration": { + "additionalProperties": { + "$ref": "#/definitions/ContentDeclaration" + }, + "type": "object" + }, + "ContributionDeclaration": { + "properties": { + "id": { + "type": "string" + } + }, + "type": "object" + }, + "ContributionTypeDeclaration": { + "properties": { + "id": { + "type": "string" + } + }, + "type": "object" + }, + "DetailsDeclaration": { + "description": "Describes a details file in the manifest", + "properties": { + "contentType": { + "type": "string" + }, + "path": { + "type": "string" + } + }, + "type": "object" + }, + "FileDeclaration": { + "description": "Describes a file in a manifest", + "properties": { + "addressable": { + "description": "If true, this asset will be addressable via a public gallery endpoint", + "type": "boolean" + }, + "assetType": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "string" + } + ], + "description": "The type of this asset (Type attribute in the vsixmanifest's entry)\nAlso used as the addressable name of this asset (if addressable = true)\nIf a string[] is provided, multiple entries will be added." + }, + "auto": { + "description": "True means that this file was added indirectly, e.g. from a directory. Files that have\nauto = true will be overridden by files with the same path that do not.", + "type": "boolean" + }, + "content": { + "description": "If content is not empty, this string will be used as the packaged contents\nrather than the contents of on the file system.", + "type": "string" + }, + "contentType": { + "description": "Manually specified content-type/mime-type. Otherwise, try to automatically determine.", + "type": "string" + }, + "lang": { + "description": "Language of this asset, if any", + "type": "string" + }, + "packagePath": { + "description": "Alias to partName", + "type": "string" + }, + "partName": { + "description": "Path/file name to the file in the archive", + "type": "string" + }, + "path": { + "description": "Path to the file on disk", + "type": "string" + } + }, + "type": "object" + }, + "LinkDeclaration": { + "description": "Describes a link in the manifest", + "properties": { + "uri": { + "type": "string" + }, + "url": { + "type": "string" + } + }, + "type": "object" + }, + "Links": { + "additionalProperties": { + "$ref": "#/definitions/LinkDeclaration" + }, + "description": "Describes a set of links keyed off the link type in the manifest.", + "type": "object" + }, + "RepositoryDeclaration": { + "properties": { + "type": { + "enum": [ + "git" + ], + "type": "string" + }, + "uri": { + "type": "string" + }, + "url": { + "type": "string" + } + }, + "type": "object" + }, + "ScreenshotDeclaration": { + "description": "Describes a screenshot in the manifest", + "properties": { + "contentType": { + "type": "string" + }, + "path": { + "type": "string" + } + }, + "type": "object" + }, + "TargetDeclaration": { + "description": "Describes a target in the manifest", + "properties": { + "id": { + "type": "string" + }, + "version": { + "type": "string" + } + }, + "type": "object" + } + }, + "properties": { + "badges": { + "items": { + "$ref": "#/definitions/BadgeDeclaration" + }, + "type": "array" + }, + "baseuri": { + "type": "string" + }, + "branding": { + "$ref": "#/definitions/BrandingDeclaration" + }, + "categories": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "string" + } + ] + }, + "content": { + "$ref": "#/definitions/ContentsDeclaration" + }, + "contributionTypes": { + "items": { + "$ref": "#/definitions/ContributionTypeDeclaration" + }, + "type": "array" + }, + "contributions": { + "items": { + "$ref": "#/definitions/ContributionDeclaration" + }, + "type": "array" + }, + "contributiontypes": { + "items": { + "$ref": "#/definitions/ContributionTypeDeclaration" + }, + "type": "array" + }, + "description": { + "type": "string" + }, + "details": { + "$ref": "#/definitions/DetailsDeclaration" + }, + "eventcallbacks": { + "properties": { + }, + "type": "object" + }, + "extensionid": { + "type": "string" + }, + "files": { + "items": { + "$ref": "#/definitions/FileDeclaration" + }, + "type": "array" + }, + "flags": { + "properties": { + }, + "type": "object" + }, + "galleryflags": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "string" + } + ] + }, + "githubflavoredmarkdown": { + "type": "boolean" + }, + "icons": { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + "id": { + "type": "string" + }, + "links": { + "$ref": "#/definitions/Links" + }, + "manifestVersion": { + "type": [ + "string", + "number" + ] + }, + "manifestversion": { + "type": [ + "string", + "number" + ] + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "public": { + "type": "boolean" + }, + "publisher": { + "type": "string" + }, + "releasenotes": { + "type": "string" + }, + "repository": { + "$ref": "#/definitions/RepositoryDeclaration" + }, + "scopes": { + "items": { + "type": "string" + }, + "type": "array" + }, + "screenshots": { + "items": { + "$ref": "#/definitions/ScreenshotDeclaration" + }, + "type": "array" + }, + "showpricingcalculator": { + "type": "boolean" + }, + "tags": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "string" + } + ] + }, + "targets": { + "items": { + "$ref": "#/definitions/TargetDeclaration" + }, + "type": "array" + }, + "version": { + "type": "string" + }, + "vsoflags": { + "properties": { + }, + "type": "object" + } + }, + "type": "object" +} + diff --git a/package.json b/package.json index 7599b787..7afeb1e7 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,8 @@ "clean": "rimraf _build", "build": "tsc -p .", "postbuild": "ncp app/tfx-cli.js _build/tfx-cli.js && ncp package.json _build/package.json && ncp app/exec/build/tasks/_resources _build/exec/build/tasks/_resources", - "prepublish": "npm run build" + "prepublish": "npm run build", + "buildschema": "typescript-json-schema ./tsconfig.json VssManifest > manifest.schema.json" }, "dependencies": { "@types/colors": "^0.6.31",