How to use pxt - 3 common examples

To help you get started, we’ve selected a few pxt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / pxt / cli / server.ts View on Github external
.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
                })
github microsoft / pxt / webapp / src / app.tsx View on Github external
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));
    }
github microsoft / pxt / webapp / src / scriptsearch.tsx View on Github external
            .map(k => JSON.parse(bundled[k]["pxt.json"]) as pxt.PackageConfig)
            .filter(pk => !pk.hidden)

pxt

MakeCode (PXT) - command line interface

MIT
Latest version published 6 years ago

Package Health Score

66 / 100
Full package analysis

Popular pxt functions