drift/examples/app/build.yaml

55 lines
2.0 KiB
YAML

# This configures how `build_runner` and associated builders should behave.
# For more information, see https://pub.dev/packages/build_config
targets:
$default:
# Reducing sources makes the build slightly faster (some of these are required
# to exist in the default target).
sources:
- lib/**
- web/**
- "tool/**"
- pubspec.yaml
- lib/$lib$
- $package$
builders:
drift_dev:
# These options change how drift generates code
options:
# Drift analyzes SQL queries at compile-time. For this purpose, it needs to know which sqlite3
# features will be available. We depend on `sqlite3_flutter_libs`, which lets us use the latest
# version with fts5 enabled.
sql:
dialect: sqlite
options:
version: "3.38"
modules: [fts5]
# This allows us to share a drift database across isolates (or different tabs on the web)
generate_connect_constructor: true
# These options are generally recommended: https://drift.simonbinder.eu/docs/advanced-features/builder_options/#recommended-options
apply_converters_on_variables: true
generate_values_in_copy_with: true
scoped_dart_components: true
# Configuring this builder isn't required for most apps. In our case, we
# want to compile the web worker in `web/worker.dart` to JS and we use the
# build system for that.
build_web_compilers:entrypoint:
generate_for:
- web/worker.dart
options:
compiler: dart2js
":copy_compiled_worker_js":
enabled: true
# build_web_compilers writes a hidden asset, but we want an asset in `web/` for
# flutter to see. So, copy that output. Again, this is not needed for most apps.
builders:
copy_compiled_worker_js:
import: 'tool/builder.dart'
builder_factories: ["CopyCompiledJs.new"]
build_to: source
build_extensions: {'web/worker.dart.js': ['web/shared_worker.dart.js']}
required_inputs: [".dart.js"]