Skip to content

Commit 19aec4d

Browse files
committed
docs(runtime): update recommended approach with project structure
1 parent 5f50e81 commit 19aec4d

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

packages/globe_runtime/README.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -554,10 +554,10 @@ export default defineSdk({
554554
Run the generator:
555555

556556
```bash
557-
npx @globe/dart_source_generator --files src/sdk.ts --output lib/generated/
557+
npx @globe/dart_source_generator --files src/sdk.ts --output lib/
558558
```
559559

560-
This generates `lib/generated/sdk_source.dart` containing the bundled JavaScript code.
560+
This generates `lib/sdk_source.dart` containing the bundled JavaScript code.
561561

562562
#### Step 4: Use in your Dart project
563563

@@ -570,9 +570,11 @@ dependencies:
570570
571571
Then use in your Dart code:
572572
573+
Create `lib/sdk_access.dart`:
574+
573575
```dart
574576
import 'dart:async';
575-
import 'package:your_package/generated/sdk_source.dart';
577+
import 'package:your_package/sdk_source.dart';
576578
577579
void main() async {
578580
// Create an instance of your SDK with initialization parameters
@@ -600,6 +602,19 @@ void main() async {
600602
}
601603
```
602604

605+
### Project structure
606+
607+
```
608+
my_sdk/
609+
├── src/
610+
│ └── sdk.ts
611+
├── lib/
612+
│ └── sdk_access.dart
613+
│ └── sdk_source.dart
614+
├── pubspec.yaml
615+
├── package.json
616+
```
617+
603618
The `@globe/dart_source_generator` automatically generates the SDK wrapper class with type-safe methods that handle all the Dart FFI interop boilerplate. You simply call methods and get properly typed `Future` or `Stream` objects back.
604619
605620
For more details, see the [@globe/dart_source_generator documentation](https://www.npmjs.com/package/@globe/dart_source_generator) and [@globe/runtime_types documentation](https://www.npmjs.com/package/@globe/runtime_types).

0 commit comments

Comments
 (0)