Commit Graph
18 Commits
Author SHA1 Message Date
David Lechner bf4670b25d update to react 18
We were stuck on react 16.x for a long time but dependencies seem to
have caught up enough that migration is trivial now.
2023-05-17 16:33:47 -05:00
David Lechner 3114ac4e2b mpy/sagas: fix tests attempting to load .wasm via http
Since we are using jsdom, the emscripten generated code doesn't use
the node filesystem lookup for .wasm files. But then it falls back to
node for file:// urls, but this doesn't work because node treats file:
as a drive letter.

We can work around this by modifying the node path.normalize() function
to return the correct path.

Fixes: https://github.com/pybricks/pybricks-code/issues/1584
2023-03-10 18:16:27 -06:00
David Lechner d88ce8998f test: wrap all user calls in act()
Some user events trigger react dom changes. These need to be wrapped in
act() to avoid a warning printed to the console. To be save, we wrap
all instances.
2023-03-10 18:16:27 -06:00
David Lechner af160c99a8 more code coverage 2023-03-08 15:07:16 -06:00
Laurens Valk 231fbbadeb mpy/alerts: Copy edit. 2022-12-15 14:59:36 -06:00
David Lechner 9fe62467d5 alerts: use shorthand return 2022-11-22 15:56:56 -06:00
David Lechner 3e50e58206 mpy/sagas: use "new" webpack asset URL
Jest added support for wasm imports which broke our tests. In the mean
time, Webpack 5 added a new asset inclusion mechanism that can work
around this and removes the need for our existing webpack workaround.
2022-11-10 13:47:16 -06:00
David Lechner c49f37f5e4 editor: lazy load
This makes the required changes needed to make the editor components
and sagas lazy-load to improve the time before the first render of the
app.

This is done by making sure we only import types from the monaco editor
module anywhere other than the saga and the component modules and using
React.lazy to lazy-load the component and start the sagas.

This cuts the main bundle time to less than 1/2 so load time should be
over twice as fast now.
2022-10-27 13:17:51 -05:00
David Lechner 7e726fffaf mpy/alerts: implement compiler error
This shows the output from mpy-cross and has a button to go to the
error.
2022-10-19 18:26:37 -05:00
David Lechner be9272ca9c pybricksMicropython: implement appending imports
This implements appending compiled imported modules for the multi-mpy6
file format.
2022-10-19 18:26:37 -05:00
David Lechner 960a3163ed add support for Pybricks Profile v1.2.0
This adds support to the BLE Pybricks Profile v1.2.0. This includes a
new method to download and run programs and a new file format for the
user program.

Code for the old download and run is kept for backwards compatibility.
However, the PnP ID characteristic is no longer optional, so the
minimum Pybricks Profile is now v1.1.0.
2022-10-14 16:21:18 -05:00
9994e8f4b4 build(deps): bump jest and @types/jest (#1131)
* build(deps): bump jest and @types/jest

Bumps [jest](https://github.com/facebook/jest/tree/HEAD/packages/jest) and [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest). These dependencies needed to be updated together.

Updates `jest` from 28.1.3 to 29.0.3
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/commits/v29.0.3/packages/jest)

Updates `@types/jest` from 28.1.8 to 29.0.1
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

---
updated-dependencies:
- dependency-name: jest
  dependency-type: direct:production
  update-type: version-update:semver-major
- dependency-name: "@types/jest"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* [dependabot skip] Fix yarn.lock

* update test snapshots for jest 29

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-fix <dependabot-fix@example.com>
Co-authored-by: David Lechner <david@pybricks.com>
2022-09-13 17:06:24 +00:00
David Lechner ed0e6789b7 update to @pybricks/mpy-cross-v6@2.0.0
This fixes `mpy-cross.wasm` from the v6 package overwriting the same
file from the v5 package.
2022-07-06 14:34:48 -05:00
David Lechner 90cd4865e8 Add support for MPY ABI v6.
Pybricks firmware v3.2.0b2 has updated to MicroPython 1.19 which
includes breaking changes to the MPY binary file format.
2022-07-06 12:51:01 -05:00
David Lechner a9f4eaa32d actions: simplify usage of Matchable
This removes use of the pseudo-internal toString() function and also
removes extraneous uses of ReturnType<>. Also, a new when() method
is added to simplify additional uses.
2022-02-26 12:43:10 -06:00
David Lechner 9641898a75 actions: refactor actions
The pattern we were using for actions required actions to be defined in
three places, an enum member containing the type string, an type
definition and a function. This combines all three of these into one by
using a helper function based on the ideas from [1].

[1]: https://phryneas.de/redux-typescript-no-discriminating-union
2022-02-25 17:58:30 -06:00
David Lechner 0c20e52a45 don't allow optional args in actions
This can lead to subtle bugs.

Fixes firmware flash button not working.
2021-02-01 10:26:05 -06:00
David Lechner 6f204a65f6 reorganize src/ directory
Makes for much less scrolling/jumping around.

https://redux.js.org/style-guide/style-guide#structure-files-as-feature-folders-or-ducks
2021-02-01 10:26:05 -06:00