Skip to content

cleaning manifest builder #471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions app/exec/extension/_lib/vsix-manifest-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,25 @@ import {
Vsix,
VsixLanguagePack,
} from "./interfaces";
import { cleanAssetPath, jsonToXml, maxKey, toZipItemName } from "./utils";
import { jsonToXml, maxKey, toZipItemName } from "./utils";
import _ = require("lodash");
import childProcess = require("child_process");
import onecolor = require("onecolor");
import os = require("os");
import path = require("path");
import stream = require("stream");
import trace = require("../../../lib/trace");
import winreg = require("winreg");
import xml = require("xml2js");

interface DetailsType {
path: string;
contentType: string;
}

interface RepositoryType {
type: string;
url: string;
uri: string;
}

export class VsixManifestBuilder extends ManifestBuilder {
constructor(extRoot: string) {
Expand Down Expand Up @@ -258,13 +267,15 @@ export class VsixManifestBuilder extends ManifestBuilder {
});
break;
case "details":
if (_.isObject(value) && value.path) {
const pathField: keyof DetailsType = "path"
if (_.isObject(value) && pathField in value) {
const file = value as DetailsType;
let fileDecl: FileDeclaration = {
path: value.path,
path: file.path,
addressable: true,
auto: true,
assetType: "Microsoft.VisualStudio.Services.Content.Details",
contentType: value.contentType,
contentType: file.contentType,
};
this.addFile(fileDecl, true);
}
Expand Down Expand Up @@ -304,7 +315,7 @@ export class VsixManifestBuilder extends ManifestBuilder {
break;
case "repository":
if (_.isObject(value)) {
const { type, url, uri } = value;
const { type, url, uri } = value as RepositoryType;
if (!type) {
throw new Error("Repository must have a 'type' property.");
}
Expand Down Expand Up @@ -808,7 +819,7 @@ export class VsixManifestBuilder extends ManifestBuilder {
seenPartNames.add(partName);
}
if ((this.files[filePath] as any)._additionalPackagePaths) {
for (const additionalPath of (this.files[filePath] as any)._additionalPackagePaths) {
for (const additionalPath of (this.files[filePath] as any)._additionalPackagePaths) {
let additionalPartName = "/" + toZipItemName(additionalPath);
if (!seenPartNames.has(additionalPartName)) {
contentTypes.Types.Override.push({
Expand Down