Skip to content

Commit

Permalink
chore: Update to Dart >3.0.0 (#85)
Browse files Browse the repository at this point in the history
Also updates to common dependency versions through Melos.
  • Loading branch information
spydon authored Oct 30, 2023
1 parent ee5d4bf commit fd9f8c8
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 19 deletions.
28 changes: 28 additions & 0 deletions melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@ command:
linkToCommits: true
# Only allow versioning to happen on main branch.
branch: main
environment:
sdk: ">=3.0.0 <4.0.0"
bootstrap:
environment:
sdk: ">=3.0.0 <4.0.0"
dependencies:
meta: ^1.11.0
vector_math: ^2.1.4
dev_dependencies:
dartdoc: ^7.0.2
flame_lint: ^1.1.1
mocktail: ^1.0.1
test: ^1.24.9

scripts:
lint:all:
Expand Down Expand Up @@ -54,3 +67,18 @@ scripts:
packageFilters:
dirExists: test
description: Generate coverage for the selected package.

benchmark:
run: melos exec -- dart web/bench2d.dart
packageFilters:
scope: forge2d_benchmark

benchmark_serve:
run: melos exec -- dart pub global run webdev serve --release
packageFilters:
scope: forge2d_benchmark

example:
run: melos exec -- dart pub global run webdev serve --release
packageFilters:
scope: forge2d_examples
9 changes: 8 additions & 1 deletion packages/benchmark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@

## In a browser
```sh
pub global run webdev serve --release
dart pub global run webdev serve --release
```
And then go to http://127.0.0.1:8080

Note: remember that you need the `webdev` package to do this, install it like
this:

```sh
dart pub global activate webdev
```

## In the terminal
```sh
dart web/bench2d.dart
Expand Down
4 changes: 2 additions & 2 deletions packages/benchmark/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ version: 1.0.0+1
publish_to: 'none'

environment:
sdk: ">=2.17.0 <3.0.0"
sdk: ">=3.0.0 <4.0.0"

dependencies:
build_runner: ^2.4.5
build_web_compilers: ^4.0.3
forge2d: ^0.11.0

dev_dependencies:
flame_lint: ^1.0.0
flame_lint: ^1.1.1
8 changes: 4 additions & 4 deletions packages/forge2d/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ version: 1.0.0+1
publish_to: 'none'

environment:
sdk: ">=2.17.0 <3.0.0"
sdk: ">=3.0.0 <4.0.0"

dependencies:
build_runner: ^2.4.5
build_web_compilers: ^4.0.3
forge2d: ^0.11.0

dev_dependencies:
flame_lint: ^1.0.0
build_runner: ^2.4.5
build_web_compilers: ^4.0.4
flame_lint: ^1.1.1
3 changes: 1 addition & 2 deletions packages/forge2d/example/web/demo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ abstract class Demo {
late final DebugDraw debugDraw;

/// Frame count for fps
late final int frameCount;
int frameCount = 0;

/// HTML element used to display the FPS counter
late final Element fpsCounter;
Expand Down Expand Up @@ -96,7 +96,6 @@ abstract class Demo {
// Have the world draw itself for debugging purposes.
world.debugDraw = debugDraw;

frameCount = 0;
fpsCounter = querySelector('#fps-counter')!;
worldStepTime = querySelector('#world-step-time')!;
Timer.periodic(const Duration(seconds: 1), (Timer t) {
Expand Down
4 changes: 2 additions & 2 deletions packages/forge2d/example/web/domino_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class DominoTest extends Demo {
{
// Floor
final shape = PolygonShape()..setAsBoxXY(50.0, 10.0);
final fixtureDef = FixtureDef(shape);
final fixtureDef = FixtureDef(shape)..friction = 0.1;

final bd = BodyDef();
bd.position = Vector2(0.0, -10.0);
Expand All @@ -24,7 +24,7 @@ class DominoTest extends Demo {
// Platforms
for (var i = 0; i < 4; i++) {
final shape = PolygonShape()..setAsBoxXY(15.0, 0.125);
final fixtureDef = FixtureDef(shape);
final fixtureDef = FixtureDef(shape)..friction = 0.1;

final bodyDef = BodyDef()..position = Vector2(0.0, 5.0 + 5 * i);
final body = world.createBody(bodyDef);
Expand Down
12 changes: 6 additions & 6 deletions packages/forge2d/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ description: A 2D physics engine for Dart (based on Box2D), also works with the
homepage: https://github.com/flame-engine/forge2d

environment:
sdk: ">=2.17.0 <3.0.0"
sdk: ">=3.0.0 <4.0.0"

dependencies:
meta: ^1.9.1
meta: ^1.11.0
vector_math: ^2.1.4

dev_dependencies:
dartdoc: ^6.3.0
flame_lint: ^1.0.0
mocktail: ^0.3.0
test: ^1.24.3
dartdoc: ^7.0.2
flame_lint: ^1.1.1
mocktail: ^1.0.1
test: ^1.24.9
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: forge2d_workspace

environment:
sdk: ">=2.17.0 <3.0.0"
sdk: ">=3.0.0 <4.0.0"

dev_dependencies:
melos: ^3.0.0
melos: ^3.2.0

0 comments on commit fd9f8c8

Please sign in to comment.