Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then((files: pxt.Map) => {
let info = JSON.parse(files["pxt.json"])
info["slug"] = id
info["id"] = "gh/" + id
if (repo.status == pxt.github.GitRepoStatus.Approved)
info["official"] = "yes"
else
info["official"] = ""
const html = pxt.docs.renderMarkdown({
template: expandDocFileTemplate("package.html"),
markdown: files["README.md"] || "No `README.md`",
theme: pxt.appTarget.appTheme,
pubinfo: info,
filepath: "/pkg/" + id,
repo: { name: repo.name, fullName: repo.fullName, tag: "v" + info.version }
})
return html
})
createProjectAsync(options: ProjectCreationOptions): Promise {
this.setSideDoc(undefined);
if (!options.prj) options.prj = pxt.appTarget.blocksprj;
let cfg = pxt.U.clone(options.prj.config);
cfg.name = options.name || lf("Untitled");
cfg.documentation = options.documentation;
let files: pxt.workspace.ScriptText = Util.clone(options.prj.files)
if (options.filesOverride)
Util.jsonCopyFrom(files, options.filesOverride)
if (options.dependencies)
Util.jsonMergeFrom(cfg.dependencies, options.dependencies)
if (options.tsOnly) {
cfg.files = cfg.files.filter(f => f != "main.blocks")
delete files["main.blocks"]
}
files["pxt.json"] = JSON.stringify(cfg, null, 4) + "\n";
return workspace.installAsync({
name: cfg.name,
meta: {},
editor: options.prj.id,
pubId: "",
pubCurrent: false,
target: pxt.appTarget.id,
targetVersion: pxt.appTarget.versions.target,
temporary: options.temporary
}, files)
.then(hd => this.loadHeaderAsync(hd, { filters: options.filters }, options.inTutorial));
}
.map(k => JSON.parse(bundled[k]["pxt.json"]) as pxt.PackageConfig)
.filter(pk => !pk.hidden)