buildWeb method
Build web app.
Delegates to BuildOrchestrator so the same code path runs whether
the build is kicked off by oracular build, by oracular deploy hosting, or by the wizard. Keeping a single source of truth here
is what guarantees parity between "manual build" and "deploy that
implicitly builds first".
Implementation
Future<bool> buildWeb() async {
if (!supportsWebHosting()) {
error(
'Web hosting is not available because this project was created without web support.',
);
return false;
}
final BuildOrchestrator orchestrator = BuildOrchestrator(
config,
runner: _runner,
);
// Jaspr templates: defer to the render-mode-aware buildJaspr().
if (config.template.isJasprApp) {
// Self-heal builder shims for projects scaffolded before
// Oracular started vendoring artifact_gen / fire_crud_gen. The web
// app cannot resolve when both jaspr_builder (analyzer ^10.0.0) and
// the published artifact_gen / fire_crud_gen (analyzer ^8.0.0) are
// pulled in — even just to satisfy `auto_apply: dependents` in the
// upstream artifact / fire_crud build.yaml. See
// [_ensureJasprBuilderShims] for the full rationale.
final String projectPath = p.join(
config.outputDir,
config.webPackageName,
);
await _ensureJasprBuilderShims(projectPath);
final BuildStepResult result = await orchestrator.buildJaspr();
return result.status == BuildStepStatus.success;
}
// Flutter templates: defer to BuildOrchestrator.buildFlutter('web').
final Directory webDir = Directory(
p.join(config.outputDir, config.appName, 'web'),
);
if (!webDir.existsSync()) {
error('Web platform files were not found in: ${webDir.path}');
info('Enable web support in the app directory with:');
info(' flutter create --platforms=web .');
return false;
}
final BuildStepResult result = await orchestrator.buildFlutter(
platform: 'web',
);
return result.status == BuildStepStatus.success;
}