Comparing version 0.17.0 to 0.18.0
@@ -349,3 +349,3 @@ "use strict"; | ||
} | ||
function initCommand(template, opts) { | ||
function initCommand(template, deps, opts) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -403,2 +403,5 @@ applyGlobalOptions(opts); | ||
} | ||
for (const dep of deps) | ||
yield addDependency(prj, dep, undefined); | ||
prj.mainPkg = null; | ||
yield prj.maybeWritePxtModulesAsync(); | ||
@@ -472,3 +475,3 @@ msg(`project ready, run "mkc -d" to build and deploy`); | ||
} | ||
function addCommand(repo, opts) { | ||
function addCommand(repo, name, opts) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -479,4 +482,13 @@ applyGlobalOptions(opts); | ||
const prj = yield resolveProject(opts); | ||
repo = repo.toLowerCase(); | ||
if (/^jacdac-/.test(repo)) { | ||
yield addDependency(prj, repo, name); | ||
prj.mainPkg = null; | ||
yield prj.maybeWritePxtModulesAsync(); | ||
}); | ||
} | ||
function addDependency(prj, repo, name) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
repo = repo.toLowerCase().trim(); | ||
if (repo === "jacdac") | ||
repo = "https://github.com/microsoft/pxt-jacdac"; | ||
else if (/^jacdac-/.test(repo)) { | ||
const exts = yield makeCodeExtensions(); | ||
@@ -496,10 +508,6 @@ const ext = exts.find(ext => ext.client.name === repo); | ||
const pxtJson = yield prj.readPxtConfig(); | ||
const name = join(rid.project, rid.fileName).replace(/^pxt-/, '').replace("/", "-"); | ||
pxtJson.dependencies[name] = `github:${rid.fullName}#${d.version ? `v${d.version}` : d.defaultBranch}`; | ||
const dname = name || join(rid.project, rid.fileName).replace(/^pxt-/, '').replace("/", "-"); | ||
pxtJson.dependencies[dname] = `github:${rid.fullName}#${d.version ? `v${d.version}` : d.defaultBranch}`; | ||
info(`adding dependency ${dname}=${pxtJson.dependencies[dname]}`); | ||
fs.writeFileSync("pxt.json", JSON.stringify(pxtJson, null, 4), { encoding: "utf-8" }); | ||
// reload | ||
{ | ||
const prj = yield resolveProject(opts); | ||
yield prj.maybeWritePxtModulesAsync(); | ||
} | ||
}); | ||
@@ -583,10 +591,12 @@ } | ||
.action(buildCommand); | ||
createCommand("download <URL>") | ||
createCommand("download") | ||
.argument("<url>", "url to the shared project from your makecode editor") | ||
.description("download project from share URL") | ||
.action(downloadCommand); | ||
createCommand("bump") | ||
.description("bump version in pxt.json and git") | ||
.description("interactive version incrementer for a project or mono-repo") | ||
.action(bumpCommand); | ||
createCommand("init") | ||
.addArgument(new commander_1.Argument("[template]", "project template name").choices(loader_1.descriptors.map(d => d.id))) | ||
.argument('<repo...>', "dependencies to be added to the project") | ||
.description("initializes the project, optionally for a particular editor") | ||
@@ -599,3 +609,5 @@ .option("--symlink-pxt-modules", "symlink files in pxt_modules/* for auto-completion") | ||
.action(cleanCommand); | ||
createCommand("add [repo]") | ||
createCommand("add") | ||
.argument("<repo>", "url to the github repository") | ||
.argument("[name]", "name of the dependency") | ||
.description("add new dependencies") | ||
@@ -602,0 +614,0 @@ .option("-c, --config-path <file>", "set configuration file path (default: \"mkc.json\")") |
{ | ||
"name": "makecode", | ||
"version": "0.17.0", | ||
"version": "0.18.0", | ||
"description": "MakeCode (PXT) - web-cached build tool", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -27,3 +27,3 @@ # MKC - command line tool for MakeCode editors | ||
The command line tool can be invoked as ``makecode`` or ``mkc`` for short. | ||
The command line tool can be invoked as `makecode` or `mkc` for short. | ||
@@ -40,2 +40,8 @@ ### mkc init | ||
It is possible to specify a list of dependencies to be added to the template. | ||
``` | ||
mkc init microbit jacdac jacdac-button jacdac-led | ||
``` | ||
Your project is ready to be edited. If you are a Visual Studio Code user, type `code .` and you're ready to go! | ||
@@ -66,3 +72,3 @@ | ||
The tool checks once a day if the MakeCode editor has been updated. However, you can force an update by using ``--update`` | ||
The tool checks once a day if the MakeCode editor has been updated. However, you can force an update by using `--update` | ||
during a build. | ||
@@ -76,3 +82,3 @@ | ||
Use ``--watch``, or ``-w``, with ``mkc build`` to automatically watch changes in source files and rebuild automatically. | ||
Use `--watch`, or `-w`, with `mkc build` to automatically watch changes in source files and rebuild automatically. | ||
@@ -93,3 +99,3 @@ ``` | ||
Adds a new dependency to the project. Pass a GitHub repository URL to the ``add`` command. | ||
Adds a new dependency to the project. Pass a GitHub repository URL to the `add` command. | ||
@@ -100,3 +106,3 @@ ``` | ||
For Jacdac extensions, simply write ``jacdac-servicename`` | ||
For Jacdac extensions, simply write `jacdac-servicename` | ||
@@ -109,3 +115,3 @@ ``` | ||
Interactive update of the version number of the current project | ||
Interactive update of the version number of the current project | ||
and nested projects in a mono-repo. | ||
@@ -154,3 +160,3 @@ | ||
You can use `--config-path` to build for a different configuration | ||
You can use `--config-path` to build for a different configuration | ||
@@ -157,0 +163,0 @@ ``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
175675
2538
200