Comparing version 0.19.0 to 0.20.0
@@ -24,2 +24,3 @@ "use strict"; | ||
const node_watch_1 = require("node-watch"); | ||
const mkc_1 = require("./mkc"); | ||
const fetch = require('node-fetch'); | ||
@@ -480,2 +481,23 @@ function downloadProjectAsync(id) { | ||
} | ||
function searchCommand(query, opts) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
applyGlobalOptions(opts); | ||
msg(`searching for ${query}`); | ||
const prj = yield resolveProject(opts); | ||
const targetid = prj.editor.targetJson.id; | ||
const res = yield fetch(`${mkc_1.cloudRoot}ghsearch/${targetid}/${targetid}?q=${encodeURIComponent(query)}`); | ||
if (res.status !== 200) { | ||
error(`search request failed`); | ||
process.exit(1); | ||
} | ||
const payload = yield res.json(); | ||
const { items } = payload; | ||
items === null || items === void 0 ? void 0 : items.forEach(({ full_name, description, owner }) => { | ||
msg(` ${full_name}`); | ||
info(` https://github.com/${full_name}`); | ||
if (description) | ||
info(` ${description}`); | ||
}); | ||
}); | ||
} | ||
function addCommand(repo, name, opts) { | ||
@@ -617,2 +639,7 @@ return __awaiter(this, void 0, void 0, function* () { | ||
.action(addCommand); | ||
createCommand("search") | ||
.argument("<query>", "extension to search for") | ||
.description("search for an extension") | ||
.option("-c, --config-path <file>", "set configuration file path (default: \"mkc.json\")") | ||
.action(searchCommand); | ||
yield commander_1.program.parseAsync(process.argv); | ||
@@ -619,0 +646,0 @@ }); |
{ | ||
"name": "makecode", | ||
"version": "0.19.0", | ||
"version": "0.20.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. | ||
@@ -94,2 +94,12 @@ ### mkc init | ||
### mkc search | ||
Search for extensions hosted on GitHub. | ||
``` | ||
mkc search jacdac | ||
``` | ||
You can use the result with the `add` command to add extensions to your project. | ||
### mkc add | ||
@@ -96,0 +106,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
178229
2571
210
8