Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 2 additions & 27 deletions docs/testing-locally.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,10 @@

## Getting started

The firmware update service can be tested locally. To get started, install and build everything:
The firmware update service can be tested locally. To get started, install everything:

```bash
yarn
yarn build
```

and create a file `.env` with the following content

```ini
ADMIN_SECRET=your-random-admin-secret
```

To start the service, run
Expand All @@ -21,25 +14,7 @@ To start the service, run
yarn dev
```

This will also rebuild on changes.

## Uploading firmware files

The database behind the local service is initially empty and decoupled from the repository contents. Firmware definition files need to be uploaded manually.

To do so, build the index, which also checks the files for errors:

```bash
yarn build:index
```

Then upload the files to the running service:

```bash
ADMIN_SECRET=your-random-admin-secret BASE_URL=http://localhost:8787 yarn upload
```

These steps need to be repeated whenever the firmware files change.
This compiles the firmware definition files into the data served by the worker (`yarn build:data`) and starts a local server. Unlike production, it does not rebuild automatically when the firmware files change — rerun `yarn dev` (or `yarn build:data`) after editing them.

## Using the local service

Expand Down
58 changes: 0 additions & 58 deletions migrations/0001_create_initial_tables.sql

This file was deleted.

67 changes: 0 additions & 67 deletions migrations/0002_add_normalized_firmware_versions.sql

This file was deleted.

12 changes: 0 additions & 12 deletions migrations/0003_add_upgrade_files_position.sql

This file was deleted.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
"build:data": "yarn tsx src/maintenance/build-data.ts",
"test:ci": "yarn build:data && NODE_OPTIONS='--loader=tsx' ava",
"test": "yarn test:ci",
"dev": "yarn build:data && wrangler dev",
"upload": "yarn tsx src/maintenance/upload.ts"
"dev": "yarn build:data && wrangler dev"
},
"dependencies": {
"itty-router": "^5.0.22",
Expand Down
2 changes: 0 additions & 2 deletions src/app.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { error, Router, withContent } from "itty-router";
import registerAdmin from "./routes/admin.js";
import registerAPI from "./routes/api.js";

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
Expand All @@ -26,7 +25,6 @@ export function build() {
router.post("*", withContent);

registerAPI(router);
registerAdmin(router);

router.all("*", () => error(404));

Expand Down
Loading
Loading