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
18 changes: 9 additions & 9 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Before you begin, ensure you have the following installed:
- Verify: `dart --version`

2. **DPK (Dartpack)** - Workspace management tool
- Installation: `dart pub global activate dpk`
- Installation: `dart install dpk`
- Verify: `dpk --version`

3. **Docker & Docker Compose** (for services like Redis)
Expand Down Expand Up @@ -95,7 +95,7 @@ This command will:
- Create a single `pubspec.lock` file at the root (Dart pub workspace)
- Download required packages

### 3. Start Docker Services (Optional, but required for some tests)
### 3. Start Docker Services (Optional but required for some tests)

```bash
# Start Redis and other services
Expand Down Expand Up @@ -141,15 +141,15 @@ This runs `dart format --set-exit-if-changed .` to ensure consistent code style.
dpk run analyze
```

This runs `dart analyze --fatal-infos --fatal-warnings` to catch potential issues. All warnings and infos must be resolved.
This runs `dart analyze --fatal-infos --fatal-warnings` to catch potential issues. All warnings and info must be resolved.

#### Combined FFA (Fix, Format, Analyze)

```bash
dpk run ffa
```

This runs all three checks in sequence - recommended before committing.
This runs all three checks in sequence recommended before committing.

### Building

Expand Down Expand Up @@ -266,7 +266,7 @@ Steps:
2. Setup Dart SDK
3. Install DPK
4. Run `dpk get`
5. Build example app
5. Build the example app
6. Run analysis and format checks

### Test Workflow (`.github/workflows/test.yml`)
Expand Down Expand Up @@ -310,7 +310,7 @@ Each test job:

- Use `///` for public API documentation
- Include examples in doc comments where appropriate
- Keep README.md files up-to-date in each package
- Keep README.md files up to date in each package

## Version Management

Expand Down Expand Up @@ -386,7 +386,7 @@ git push origin feature/my-feature
Ensure DPK is in your PATH:

```bash
dart pub global activate dpk
dart install dpk
export PATH="$PATH":"$HOME/.pub-cache/bin"
```

Expand All @@ -412,7 +412,7 @@ dart run build_runner build --delete-conflicting-outputs
### Test Failures

1. Ensure Docker services are running (if needed)
2. Check that dependencies are up-to-date: `dpk get`
2. Check that dependencies are up to date: `dpk get`
3. Run tests with detailed stack traces: `dart test --chain-stack-traces`
4. Check CI logs for additional context

Expand All @@ -430,7 +430,7 @@ dart run build_runner build --delete-conflicting-outputs
1. Check existing documentation in `/docs`
2. Review package-specific README files in `/packages`
3. Look at example applications in `/samples`
4. Search existing issues on GitHub
4. Search for existing issues on GitHub
5. Ask questions by opening a new issue

## GitHub Copilot Instructions
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
sdk: ['stable', '3.8.3']
sdk: ['stable', '3.10.8']
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup Dart
uses: dart-lang/setup-dart@v1
with:
sdk: ${{ matrix.sdk }}
- name: Install DPK
run: dart pub global activate dpk
run: |
dart install dpk
echo "$HOME/.local/state/Dart/install/bin" >> "$GITHUB_PATH"
- name: Run dpk get
run: dpk get
- name: Run code generation on example app
Expand All @@ -31,15 +33,17 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
sdk: ['stable', '3.8.3']
sdk: ['stable', '3.10.8']
steps:
- uses: actions/checkout@v2
- name: Setup Dart
uses: dart-lang/setup-dart@v1
with:
sdk: ${{ matrix.sdk }}
- name: Install DPK
run: dart pub global activate dpk
run: |
dart install dpk
echo "$HOME/.local/state/Dart/install/bin" >> "$GITHUB_PATH"
- name: Run dpk get
run: dpk get
- name: Format
Expand Down
38 changes: 25 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
sdk: ['stable', '3.8.3']
sdk: ['stable', '3.10.8']
steps:
- uses: actions/checkout@v4

Expand All @@ -22,7 +22,9 @@ jobs:
sdk: ${{ matrix.sdk }}

- name: Install DPK
run: dart pub global activate dpk
run: |
dart install dpk
echo "$HOME/.local/state/Dart/install/bin" >> "$GITHUB_PATH"

- name: Start Redis with Docker Compose
uses: hoverkraft-tech/compose-action@v2.0.1
Expand All @@ -41,7 +43,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
sdk: ['stable', '3.8.3']
sdk: ['stable', '3.10.8']
steps:
- uses: actions/checkout@v4

Expand All @@ -51,7 +53,9 @@ jobs:
sdk: ${{ matrix.sdk }}

- name: Install DPK
run: dart pub global activate dpk
run: |
dart install dpk
echo "$HOME/.local/state/Dart/install/bin" >> "$GITHUB_PATH"

- name: Run dpk get
run: dpk get
Expand All @@ -64,7 +68,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
sdk: ['stable', '3.8.3']
sdk: ['stable', '3.10.8']
steps:
- uses: actions/checkout@v4

Expand All @@ -74,7 +78,9 @@ jobs:
sdk: ${{ matrix.sdk }}

- name: Install DPK
run: dart pub global activate dpk
run: |
dart install dpk
echo "$HOME/.local/state/Dart/install/bin" >> "$GITHUB_PATH"

- name: Start Redis with Docker Compose
uses: hoverkraft-tech/compose-action@v2.0.1
Expand All @@ -93,7 +99,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
sdk: ['stable', '3.8.3']
sdk: ['stable', '3.10.8']
steps:
- uses: actions/checkout@v4

Expand All @@ -103,7 +109,9 @@ jobs:
sdk: ${{ matrix.sdk }}

- name: Install DPK
run: dart pub global activate dpk
run: |
dart install dpk
echo "$HOME/.local/state/Dart/install/bin" >> "$GITHUB_PATH"

- name: Run dpk get
run: dpk get
Expand All @@ -116,7 +124,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
sdk: ['stable', '3.8.3']
sdk: ['stable', '3.10.8']
steps:
- uses: actions/checkout@v4

Expand All @@ -126,7 +134,9 @@ jobs:
sdk: ${{ matrix.sdk }}

- name: Install DPK
run: dart pub global activate dpk
run: |
dart install dpk
echo "$HOME/.local/state/Dart/install/bin" >> "$GITHUB_PATH"

- name: Run dpk get
run: dpk get
Expand All @@ -139,7 +149,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
sdk: ['stable', '3.8.3']
sdk: ['stable', '3.10.8']
steps:
- uses: actions/checkout@v4

Expand All @@ -149,10 +159,12 @@ jobs:
sdk: ${{ matrix.sdk }}

- name: Install DPK
run: dart pub global activate dpk
run: |
dart install dpk
echo "$HOME/.local/state/Dart/install/bin" >> "$GITHUB_PATH"

- name: Run dpk get
run: dpk get

- name: Run tests
run: dpk run test:swagger
run: dpk run test:swagger
3 changes: 2 additions & 1 deletion packages/arcade/lib/src/http/route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ enum HttpMethod {
delete('DELETE'),
patch('PATCH'),
head('HEAD'),
options('OPTIONS');
options('OPTIONS')
;

final String methodString;

Expand Down
11 changes: 8 additions & 3 deletions packages/arcade_views/lib/src/view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ Uri? _resolvePackageUri(Uri packageUri) {
// Walk up from current directory to find .dart_tool/package_config.json
var dir = Directory.current;
while (dir.path != dir.parent.path) {
final configFile = File(join(dir.path, '.dart_tool', 'package_config.json'));
final configFile = File(
join(dir.path, '.dart_tool', 'package_config.json'),
);
if (configFile.existsSync()) {
try {
final config = jsonDecode(configFile.readAsStringSync()) as Map<String, dynamic>;
final config =
jsonDecode(configFile.readAsStringSync()) as Map<String, dynamic>;
final packages = config['packages'] as List<dynamic>?;
if (packages != null) {
final packageName = packageUri.pathSegments.first;
Expand All @@ -40,7 +43,9 @@ Uri? _resolvePackageUri(Uri packageUri) {
resolvedRoot = Uri.parse(rootUri);
} else {
// Relative path - resolve relative to package_config.json location
resolvedRoot = Uri.file(normalize(join(dir.path, '.dart_tool', rootUri)));
resolvedRoot = Uri.file(
normalize(join(dir.path, '.dart_tool', rootUri)),
);
}
// Combine root with packageUri (usually 'lib/')
final libPath = join(resolvedRoot.toFilePath(), packageUriStr);
Expand Down
18 changes: 11 additions & 7 deletions samples/todo_api/lib/common/extensions/luthor_validation.dart
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
import 'package:arcade/arcade.dart';
import 'package:luthor/luthor.dart';

extension LuthorValidation<T> on SchemaValidationResult<T> Function(
Map<String, dynamic> json,
) {
extension LuthorValidation<T>
on
SchemaValidationResult<T> Function(
Map<String, dynamic> json,
) {
Future<T> validate(RequestContext context) async {
final body = switch (await context.jsonMap()) {
BodyParseSuccess(value: final body) => body,
BodyParseFailure(error: final error) =>
throw BadRequestException(message: 'Error parsing JSON: $error'),
BodyParseFailure(error: final error) => throw BadRequestException(
message: 'Error parsing JSON: $error',
),
};

return switch (this.call(body)) {
SchemaValidationSuccess(data: final data) => data,
SchemaValidationError(errors: final errors) =>
throw BadRequestException(errors: errors),
SchemaValidationError(errors: final errors) => throw BadRequestException(
errors: errors,
),
};
}
}
5 changes: 3 additions & 2 deletions samples/todo_api/lib/modules/todos/services/todo_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ class TodoService {
_db.todos.id.equals(UuidValue.fromString(id)) &
_db.todos.user.equals(UuidValue.fromString(userId)),
);
final foundTodoId =
await findQuery.map((row) => row.read(_db.todos.id)).getSingleOrNull();
final foundTodoId = await findQuery
.map((row) => row.read(_db.todos.id))
.getSingleOrNull();
if (foundTodoId == null) {
throw const NotFoundException(message: 'Todo not found');
}
Expand Down
Loading