diff --git a/docs/pages/docs/CLI.md b/docs/pages/docs/CLI.md index 9a0e96b8..2d571703 100644 --- a/docs/pages/docs/CLI.md +++ b/docs/pages/docs/CLI.md @@ -13,10 +13,8 @@ The drift cli tool is experimental at the moment. Please report all issues you c ## Usage If your app depends on `drift_dev`, you're ready to use the CLI tool. -In this article, we'll use `pub run ...` to start the tool. -If you're using Flutter, you need to run `flutter pub run ...`. -In either case, the tool should be run from the same folder where you keep your -`pubspec.yaml`. +In this article, we'll use `dart run drift_dev` to start the tool. +The tool should be run from the same folder where you keep your `pubspec.yaml`. ## Analyze diff --git a/docs/pages/docs/Getting started/index.md b/docs/pages/docs/Getting started/index.md index 00b3689a..2c6bea96 100644 --- a/docs/pages/docs/Getting started/index.md +++ b/docs/pages/docs/Getting started/index.md @@ -61,9 +61,9 @@ examples. Otherwise, the generator won't be able to know what's going on. ## Generating the code -Drift integrates with Dart's `build` system, so you can generate all the code needed with -`flutter pub run build_runner build`. If you want to continuously rebuild the generated code -where you change your code, run `flutter pub run build_runner watch` instead. +Drift integrates with Dart's `build` system, so you can generate all the code needed with +`dart run build_runner build`. If you want to continuously rebuild the generated code +where you change your code, run `dart run build_runner watch` instead. After running either command once, drift's generator will have created a class for your database and data classes for your entities. To use it, change the `MyDatabase` class defined in the earlier snippet as follows: diff --git a/docs/pages/docs/Getting started/starting_with_sql.md b/docs/pages/docs/Getting started/starting_with_sql.md index 913a942d..70cc3315 100644 --- a/docs/pages/docs/Getting started/starting_with_sql.md +++ b/docs/pages/docs/Getting started/starting_with_sql.md @@ -78,7 +78,7 @@ in the previous step. {% include "blocks/snippet" snippets = dart_snippets name = '(full)' %} To generate the `database.g.dart` file which contains the `_$AppDb` -superclass, run `flutter pub run build_runner build` on the command +superclass, run `dart run build_runner build` on the command line. ## What drift generates diff --git a/docs/pages/docs/Other engines/web.md b/docs/pages/docs/Other engines/web.md index 5ecafec9..f06fd5c5 100644 --- a/docs/pages/docs/Other engines/web.md +++ b/docs/pages/docs/Other engines/web.md @@ -414,13 +414,13 @@ Nowm, run the compiler and copy the compiled worker JS files to `web/`: ```shell #Debug mode -flutter pub run build_runner build --delete-conflicting-outputs -o web:build/web/ +dart run build_runner build --delete-conflicting-outputs -o web:build/web/ cp -f build/web/worker.dart.js web/worker.dart.js ``` ```shell #Release mode -flutter pub run build_runner build --release --delete-conflicting-outputs -o web:build/web/ +dart run build_runner build --release --delete-conflicting-outputs -o web:build/web/ cp -f build/web/worker.dart.js web/worker.dart.min.js ``` diff --git a/docs/pages/docs/Using SQL/drift_files.md b/docs/pages/docs/Using SQL/drift_files.md index e38a3bc2..d9a44b0f 100644 --- a/docs/pages/docs/Using SQL/drift_files.md +++ b/docs/pages/docs/Using SQL/drift_files.md @@ -34,7 +34,7 @@ We can now declare tables and queries in the drift file: {% include "blocks/snippet" snippets = drift_tables %} -After running the build runner with `flutter pub run build_runner build`, +After running the build runner with `dart run build_runner build`, drift will write the `database.g.dart` file which contains the `_$MyDb` superclass. Let's take a look at what we got: diff --git a/docs/pages/docs/upgrading.md b/docs/pages/docs/upgrading.md index 24a944eb..738d681d 100644 --- a/docs/pages/docs/upgrading.md +++ b/docs/pages/docs/upgrading.md @@ -102,15 +102,14 @@ Also, please __create a backup of your project's files__ before running the migr your sources without further confirmation. When using git, it is sufficient to ensure that you have a clean state. To apply the migration, run `dart run moor_generator migrate` in your project's directory. -When using Flutter, run `flutter pub run moor_generator migrate` instead. The migration tool will transform your pubspec, `build.yaml` files and Dart source files. It will also rename `.moor` files to `.drift` and patch imports as needed. After running the migration, please verify the changes to ensure that they match what you expect. Also, you may have to -- Format your sources again: Run `dart format .` or `flutter format .` -- Re-run the build: Run `dart run build_runner build` or `flutter pub run build_runner build --delete-conflicting-outputs`, respectively. +- Format your sources again: Run `dart format .`. +- Re-run the build: Run `dart run build_runner build -d`. - If you have been using generated [migration test files]({{ 'Advanced Features/migrations.md#exporting-the-schema' | pageUrl }}), re-generate them as well with `dart run drift_dev schema generate drift_schemas/ test/generated_migrations/` (you may have to adapt the command to the directories you use for schemas). diff --git a/drift_dev/lib/src/cli/commands/migrate.dart b/drift_dev/lib/src/cli/commands/migrate.dart index 91a7d07c..0a9bc19f 100644 --- a/drift_dev/lib/src/cli/commands/migrate.dart +++ b/drift_dev/lib/src/cli/commands/migrate.dart @@ -44,10 +44,8 @@ class MigrateCommand extends MoorCommand { final isRunningFlutter = Platform.executable == 'flutter'; final formatCommand = isRunningFlutter ? 'flutter format .' : 'dart format .'; - final pubGetCommand = isRunningFlutter ? 'flutter pub get' : 'dart pub get'; - final buildCommand = isRunningFlutter - ? 'flutter pub run build_runner build --delete-conflicting-outputs' - : 'dart run build_runner build'; + final pubGetCommand = 'dart pub get'; + final buildCommand = 'dart run build_runner build -d'; print('${green.wrap('Done!')} Next steps:'); print(' - Please check changed files for correctness'); diff --git a/examples/app/README.md b/examples/app/README.md index e2aa2f9a..f32b0096 100644 --- a/examples/app/README.md +++ b/examples/app/README.md @@ -22,7 +22,7 @@ for more details on this. ## Development As this app uses drift, it depends on code-generation. -Use `flutter pub run build_runner build` to automatically build the generated +Use `dart run build_runner build` to automatically build the generated code. ### Testing @@ -47,14 +47,14 @@ incrementing your schema version. It will export the current schema of the database as a JSON file. You should check those generated files into source control. ``` -flutter pub run drift_dev schema dump lib/database/database.dart drift_schemas/ +dart run drift_dev schema dump lib/database/database.dart drift_schemas/ ``` Then, run the following command to automatically generate test utilities which you can use to write unit tests for schema migrations: ``` -flutter pub run drift_dev schema generate drift_schemas/ test/generated_migrations/ +dart run drift_dev schema generate drift_schemas/ test/generated_migrations/ ``` An example for a schema test is in `test/migration_test.dart`. diff --git a/examples/flutter_web_worker_example/generate_js.sh b/examples/flutter_web_worker_example/generate_js.sh index 68ba7b28..9e2d5e1e 100755 --- a/examples/flutter_web_worker_example/generate_js.sh +++ b/examples/flutter_web_worker_example/generate_js.sh @@ -1,8 +1,8 @@ rm -f web/worker.dart.js rm -f web/worker.dart.min.js -flutter pub run build_runner build --delete-conflicting-outputs -o web:build/web/ +dart run build_runner build --delete-conflicting-outputs -o web:build/web/ cp -f build/web/worker.dart.js web/worker.dart.js rm -rf build/web -flutter pub run build_runner build --release --delete-conflicting-outputs -o web:build/web/ +dart run build_runner build --release --delete-conflicting-outputs -o web:build/web/ cp -f build/web/worker.dart.js web/worker.dart.min.js rm -rf build/web diff --git a/examples/flutter_web_worker_example/pubspec.yaml b/examples/flutter_web_worker_example/pubspec.yaml index 35c64b45..212dc420 100644 --- a/examples/flutter_web_worker_example/pubspec.yaml +++ b/examples/flutter_web_worker_example/pubspec.yaml @@ -13,10 +13,6 @@ dependencies: dev_dependencies: build_runner: ^2.1.4 - build_web_compilers: ^3.2.1 + build_web_compilers: ^4.0.3 flutter_lints: ^1.0.4 drift_dev: - -dependency_overrides: - # Flutter's test packages don't support the latest analyzer yet. - test_api: ^0.4.16 diff --git a/melos.yaml b/melos.yaml index d38d7102..35e65304 100644 --- a/melos.yaml +++ b/melos.yaml @@ -24,7 +24,7 @@ scripts: exec: {concurrency: 1} build: - run: flutter pub run build_runner build --delete-conflicting-outputs + run: dart run build_runner build --delete-conflicting-outputs exec: {concurrency: 1} packageFilters: dependsOn: build_runner