Comparing version 0.24.0 to 0.25.0
@@ -186,2 +186,6 @@ "use strict"; | ||
} | ||
if (opts.serveBinaries) { | ||
const port = parseInt(opts.binariesPort) || 7001; | ||
startBuiltServer(port); | ||
} | ||
if (opts.watch) { | ||
@@ -197,2 +201,24 @@ startWatch(opts); | ||
} | ||
function startBuiltServer(port) { | ||
const handler = require('serve-handler'); | ||
const http = require('http'); | ||
const server = http.createServer((request, response) => { | ||
return handler(request, response, { | ||
public: "./built/", | ||
cleanUrls: true, | ||
headers: [ | ||
{ | ||
"source": "**/*.@(hex|uf2)", | ||
"headers": [{ | ||
"key": "Content-Disposition", | ||
"value": "attachment" | ||
}] | ||
} | ||
] | ||
}); | ||
}); | ||
server.listen(port, () => { | ||
info(`start serving binaries at http://localhost:${port}`); | ||
}); | ||
} | ||
function startWatch(opts) { | ||
@@ -435,2 +461,11 @@ const watcher = (0, node_watch_1.default)('./', { | ||
} | ||
const prettierrc = ".prettierrc"; | ||
if (!fs.existsSync(prettierrc)) { | ||
msg(`saving ${prettierrc}`); | ||
fs.writeFileSync(prettierrc, JSON.stringify({ | ||
"arrowParens": "avoid", | ||
"semi": false, | ||
"tabWidth": 4 | ||
})); | ||
} | ||
opts.pxtModules = true; | ||
@@ -652,2 +687,4 @@ const prj = yield resolveProject(opts); | ||
.option("-r, --mono-repo", "also build all subfolders with 'pxt.json' in them") | ||
.option("-sb, --serve-binaries", "serve built binary folder to allow easy download in codespaces") | ||
.option("-bp, --binaries-port <number>", "port to listen at, default to 7001") | ||
.option("--always-built", "always generate files in built/ folder (and not built/hw-variant/)") | ||
@@ -658,3 +695,3 @@ .action(buildCommand); | ||
.option("--no-watch", "do not watch source files") | ||
.option("-p, --port <number>", "port to listen at") | ||
.option("-p, --port <number>", "port to listen at, default to 7000") | ||
.option("-u, --update", "check for web-app updates") | ||
@@ -661,0 +698,0 @@ .option("-c, --config-path <file>", "set configuration file path (default: \"mkc.json\")") |
{ | ||
"name": "makecode", | ||
"version": "0.24.0", | ||
"version": "0.25.0", | ||
"description": "MakeCode (PXT) - web-cached build tool", | ||
@@ -45,4 +45,4 @@ "keywords": [ | ||
"@semantic-release/release-notes-generator": "^10.0.2", | ||
"@types/glob": "^7.1.4", | ||
"@types/node": "^16.10.3", | ||
"@types/glob": "^7.1.4", | ||
"semantic-release": "^18.0.0", | ||
@@ -56,3 +56,4 @@ "typescript": "^4.4.3" | ||
"node-fetch": "^2.0.0", | ||
"node-watch": "^0.7.2" | ||
"node-watch": "^0.7.2", | ||
"serve-handler": "^6.1.3" | ||
}, | ||
@@ -59,0 +60,0 @@ "release": { |
@@ -85,2 +85,11 @@ # MKC - command line tool for MakeCode editors | ||
### Serve built files in Codespaces | ||
In codespaces, you can launch a local web server for the built folder so that you can retreive the built files using port forwarding. | ||
Use `--serve-binaries`, or `-s` with `mkc build`. Defaults to http://localhost:7001 | ||
``` | ||
mkc -w -sb | ||
``` | ||
### mkc serve | ||
@@ -87,0 +96,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
Network access
Supply chain riskThis module accesses the network.
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
202518
106
3051
240
6
9
+ Addedserve-handler@^6.1.3
+ Addedbytes@3.0.0(transitive)
+ Addedcontent-disposition@0.5.2(transitive)
+ Addedmime-db@1.33.0(transitive)
+ Addedmime-types@2.1.18(transitive)
+ Addedpath-is-inside@1.0.2(transitive)
+ Addedpath-to-regexp@3.3.0(transitive)
+ Addedrange-parser@1.2.0(transitive)
+ Addedserve-handler@6.1.6(transitive)