defineSpryConfig function
void
defineSpryConfig({
- String? host,
- int? port,
- BuildTarget? target,
- String? routesDir,
- String? middlewareDir,
- String? publicDir,
- String? outputDir,
- ReloadStrategy? reload,
- String? wranglerConfig,
Emits Spry build configuration as JSON for spry.config.dart.
Implementation
void defineSpryConfig({
/// Overrides the host used by `spry serve`.
String? host,
/// Overrides the port used by `spry serve`.
int? port,
/// Selects the target runtime.
BuildTarget? target,
/// Overrides the routes directory.
String? routesDir,
/// Overrides the middleware directory.
String? middlewareDir,
/// Overrides the public asset directory.
String? publicDir,
/// Overrides the generated output directory.
String? outputDir,
/// Overrides the reload strategy used by `spry serve`.
ReloadStrategy? reload,
/// Overrides the Wrangler config path for Cloudflare targets.
String? wranglerConfig,
}) {
final config = <String, Object>{};
if (host != null) {
config['host'] = host;
}
if (port != null) {
config['port'] = port;
}
if (target != null) {
config['target'] = target.name;
}
if (routesDir != null) {
config['routesDir'] = routesDir;
}
if (middlewareDir != null) {
config['middlewareDir'] = middlewareDir;
}
if (publicDir != null) {
config['publicDir'] = publicDir;
}
if (outputDir != null) {
config['outputDir'] = outputDir;
}
if (reload != null) {
config['reload'] = reload.name;
}
if (wranglerConfig != null) {
config['wranglerConfig'] = wranglerConfig;
}
stdout.writeln(
json.encode(config),
);
}