mpk-installer
v0.2.0
Published
Install MicroPythonOS applications on compatible devices using Web Serial.
Maintainers
Readme
Micropython OS MPK package installer
Browser library for installing MicroPythonOS .mpk applications directly onto a device running MicroPythonOS through Web Serial.
Install
npm install mpk-installerOr you can use load it in via UNPKG directly
<script src="https://unpkg.com/[email protected]"></script>The library is exposed as the global MpkInstaller object.
<button id="install-url" type="button">Install example app</button>
<script>
document
.getElementById('install-url')
.addEventListener('click', async () => {
await MpkInstaller.installMpkWebSerial(
'https://example.com/apps/example.mpk',
);
});
</script>How to use
Browser requirements
- A browser implementing Web Serial, normally desktop Chromium-based browsers.
- HTTPS or
localhost. - A user click/tap when the browser port picker is needed.
- A badge exposing the MicroPython raw REPL over USB serial.
MPK validation
- ZIP-compatible archive with exactly one top-level app folder.
MANIFEST.JSONmust exist inside that folder.MANIFEST.JSON.fullnamemust equal the folder name.- Files are installed under
/apps/<fullname>. - Absolute paths, traversal segments, oversized archives, and excessive file counts are rejected.
Build locally
npm install
npm run typecheck
npm test
npm run buildYou can then run npx serve and view it at http://localhost:3000/demo for testing it out.
The package emits browser-targeted ESM, CommonJS, and TypeScript declarations in dist/.
