pxt-microbit can now be required and exports useful information about its bundled pxt-core (#305)

This commit is contained in:
Guillaume Jenkins 2016-11-10 12:12:57 -08:00 committed by GitHub
parent c9ba7af3f3
commit 08575d352b
2 changed files with 6 additions and 0 deletions

4
cmds/pxtrequire.ts Normal file
View File

@ -0,0 +1,4 @@
import * as path from "path";
export let pxtCore = require("pxt-core");
// require.resolve() gives path to [pxt dir]/built/pxt.js, so move up twice to get pxt root dir
export let pxtCoreDir = path.resolve(require.resolve("pxt-core"), "..", "..");

View File

@ -26,6 +26,8 @@
"docs/*/*.md",
"docs/*/*/*.md"
],
"main": "built/pxtrequire.js",
"typings": "built/pxtrequire.d.ts",
"devDependencies": {
"typescript": "^1.8.7"
},