Comparing version 0.30.2 to 0.31.0
@@ -15,3 +15,2 @@ "use strict"; | ||
const util = require("util"); | ||
const http_1 = require("http"); | ||
const mkc = require("./mkc"); | ||
@@ -203,10 +202,2 @@ const files = require("./files"); | ||
} | ||
if (opts.serve && !opts.watch) { | ||
error("--serve must be used with --watch"); | ||
process.exit(1); | ||
} | ||
if (opts.serve && opts.monoRepo) { | ||
error("--serve and --mono-repo cannot be used together"); | ||
process.exit(1); | ||
} | ||
if (opts.watch) { | ||
@@ -224,57 +215,2 @@ startWatch(opts); | ||
const binaries = {}; | ||
if (opts.serve) { | ||
const port = opts.servePort || 7001; | ||
(0, http_1.createServer)((req, res) => __awaiter(this, void 0, void 0, function* () { | ||
// find file | ||
const k = req.url | ||
.toLowerCase() | ||
.replace(/^\//, "") | ||
.replace(/\/$/i, ""); | ||
const data = binaries[k]; | ||
if (data) { | ||
info(`found firmware file ${k}`); | ||
res.writeHead(200, { | ||
"Cache-Control": "no-cache", | ||
"Content-Type": typeof data === "string" | ||
? "text/plain" | ||
: "application/octet-stream", | ||
}); | ||
res.end(data); | ||
} | ||
else if (k === "favicon.ico") { | ||
res.writeHead(404); | ||
res.end(); | ||
} | ||
else { | ||
// display default path | ||
res.writeHead(200, { | ||
"Cache-Control": "no-cache", | ||
"Content-Type": "text/html", | ||
}); | ||
const entries = Object.entries(binaries); | ||
res.end(` | ||
<html> | ||
<head> | ||
${entries.length === 0 ? `<meta http-equiv="refresh" content="1">` : ""} | ||
<style> | ||
* { font-family: monospace; font-size: 16pt; } | ||
@media (prefers-color-scheme: dark) { | ||
* { background: #2d2d2d; color: #fff; } | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<h1>MakeCode firmware files</h1> | ||
${entries.length === 0 ? `<p>Waiting for first build...</p>` : ""} | ||
<table> | ||
${entries | ||
.map(([key, value]) => `<tr><td><a download="${key}" href="/${key}">${key}</a></td><td>${Math.ceil(value.length / 1e3)}Kb</td></tr>`) | ||
.join("\n")} | ||
</table> | ||
</body> | ||
</html>`); | ||
} | ||
})).listen(port, "127.0.0.1"); | ||
msg(`firmware file server at http://127.0.0.1:${port}/`); | ||
} | ||
const watcher = (0, node_watch_1.default)("./", { | ||
@@ -809,3 +745,2 @@ recursive: true, | ||
.option("-d, --deploy", "copy resulting binary to UF2 or HEX drive") | ||
.option("-s, --serve", "start firmware files web server") | ||
.option("-p", "--serve-port", "specify the port for firmware file web server") | ||
@@ -812,0 +747,0 @@ .option("-h, --hw <id,...>", "set hardware(s) for which to compile (implies -n)") |
{ | ||
"name": "makecode", | ||
"version": "0.30.2", | ||
"version": "0.31.0", | ||
"description": "MakeCode (PXT) - web-cached build tool", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -94,15 +94,10 @@ # MKC - command line tool for MakeCode editors | ||
### mkc build --watch --serve | ||
#### Built files in containers, GitHub Codespace, ... | ||
When building within a virtual machine without USB access, like in GitHub Codespaces or Windows Subsytem for Linux, the `--serve`, or `-s` option starts a local web server | ||
that serves the compiled binaries by the build process. | ||
To access the build files from a remote machine, | ||
``` | ||
mkc -w -s | ||
``` | ||
- open Visual Studio Code | ||
- browse to the `built` folder | ||
- right click `Download` on the desired file. | ||
### Built files in codespace | ||
From Visual Studio Code, browse to the built folder and right click `Download` on the desired file. | ||
### mkc serve | ||
@@ -158,3 +153,3 @@ | ||
Use ``--major``, ``--minor``, ``--patch`` to automatically increment the version number. | ||
Use `--major`, `--minor`, `--patch` to automatically increment the version number. | ||
@@ -191,11 +186,11 @@ ``` | ||
{ | ||
"targetWebsite": "https://arcade.makecode.com/beta", | ||
"hwVariant": "samd51", | ||
"links": { | ||
"jacdac": "../../pxt-jacdac" | ||
}, | ||
"overrides": { | ||
"testDependencies": {} | ||
}, | ||
"include": ["../../common-mkc.json"] | ||
"targetWebsite": "https://arcade.makecode.com/beta", | ||
"hwVariant": "samd51", | ||
"links": { | ||
"jacdac": "../../pxt-jacdac" | ||
}, | ||
"overrides": { | ||
"testDependencies": {} | ||
}, | ||
"include": ["../../common-mkc.json"] | ||
} | ||
@@ -206,10 +201,10 @@ ``` | ||
- **targetWebsite** says where to take the compiler from; if you omit it, it will be guessed based on packages used by `pxt.json`; | ||
you can point this to a live or beta version of the editor, as well as to a specific version (including SHA-indexed uploads | ||
generated during PXT target builds) | ||
- **hwVariant** specifies default hardware variant (currently only used in Arcade); try `--hw help` command line option to list variants | ||
- **links** overrides specific packages; these can be github packages or built-in packages | ||
- **overrides** is used to override specific keys in `pxt.json` | ||
- files listed in **include** are merged with the keys from the later ones overriding the keys from the earlier ones; | ||
the keys from the current file override all included keys | ||
- **targetWebsite** says where to take the compiler from; if you omit it, it will be guessed based on packages used by `pxt.json`; | ||
you can point this to a live or beta version of the editor, as well as to a specific version (including SHA-indexed uploads | ||
generated during PXT target builds) | ||
- **hwVariant** specifies default hardware variant (currently only used in Arcade); try `--hw help` command line option to list variants | ||
- **links** overrides specific packages; these can be github packages or built-in packages | ||
- **overrides** is used to override specific keys in `pxt.json` | ||
- files listed in **include** are merged with the keys from the later ones overriding the keys from the earlier ones; | ||
the keys from the current file override all included keys | ||
@@ -226,6 +221,6 @@ You can use `--config-path` or `-c` to build for a different configuration. | ||
- install node.js | ||
- run `yarn install` | ||
- start the build: `yarn watch` | ||
- run `node path/to/pxt-mkc/makecode` in your project folder | ||
- install node.js | ||
- run `yarn install` | ||
- start the build: `yarn watch` | ||
- run `node path/to/pxt-mkc/makecode` in your project folder | ||
@@ -242,10 +237,10 @@ If you want to test out changes in pxt, first run the build as usual, and then replace | ||
- **feat:** A new feature | ||
- **fix:** A bug fix | ||
- **docs:** Documentation only changes | ||
style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) | ||
- **refactor:** A code change that neither fixes a bug nor adds a feature | ||
- **perf:** A code change that improves performance | ||
- **test:** Adding missing or correcting existing tests | ||
- **chore:** Changes to the build process or auxiliary tools and libraries such as documentation generation | ||
- **feat:** A new feature | ||
- **fix:** A bug fix | ||
- **docs:** Documentation only changes | ||
style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) | ||
- **refactor:** A code change that neither fixes a bug nor adds a feature | ||
- **perf:** A code change that improves performance | ||
- **test:** Adding missing or correcting existing tests | ||
- **chore:** Changes to the build process or auxiliary tools and libraries such as documentation generation | ||
@@ -252,0 +247,0 @@ ### Contributing |
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
8
210095
3192
254