Skip to content

Commit

Permalink
More WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-matt-hillsdon committed Jul 10, 2024
1 parent 3cc433d commit 3ecfaf5
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 5 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: build
on:
release:
types: [created]
push:
branches:
- "**"
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "20.x"
registry-url: "https://npm.pkg.github.com"
cache: npm
- uses: microbit-foundation/npm-package-versioner-action@v1
- run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: npm run ci
- run: npm publish
if: false && github.ref == 'refs/heads/main' || github.event_name == 'release' && github.event.action == 'created'
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 4 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- Figure out the interface for flash
- Remove the sim? It's unrelated really.
- Add a JS partial flashing implementation, perhaps based on the prototype app
- Consider a full flash implementation later... for now we'll need to indicate lack of support somehow with a structured error code?
5 changes: 0 additions & 5 deletions lib/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,6 @@ export interface FlashDataSource {
* @throws HexGenerationError if we cannot generate hex data.
*/
fullFlashData(boardId: BoardId): Promise<Uint8Array>;

/**
* The file system represented by file name keys and data values.
*/
files(): Promise<Record<string, Uint8Array>>;
}

export interface ConnectOptions {
Expand Down
23 changes: 23 additions & 0 deletions lib/hex-flash-data-source.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { BoardId } from "./board-id";
import { FlashDataSource } from "./device";
import {
isUniversalHex,
separateUniversalHex,
} from "@microbit/microbit-universal-hex";

class HexFlashDataSource implements FlashDataSource {
constructor(private hex: string) {
if (isUniversalHex(hex)) {
const parts = separateUniversalHex(hex);
// Ho hum, what do we do with this?
parts[0].hex;
}
}

partialFlashData(boardId: BoardId): Promise<Uint8Array> {
throw new Error("Method not implemented.");
}
fullFlashData(boardId: BoardId): Promise<Uint8Array> {
throw new Error("Method not implemented.");
}
}
22 changes: 22 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"preview": "vite preview"
},
"devDependencies": {
"@microbit/microbit-universal-hex": "^0.2.2",
"@types/node": "^20.14.10",
"jsdom": "^24.1.0",
"prettier": "3.3.2",
Expand Down

0 comments on commit 3ecfaf5

Please sign in to comment.