Skip to content

Commit 45f95d6

Browse files
feat: adding dart version flag to build command (#671)
* feat: adding dart version flag to build command * Update packages/dart_frog_cli/lib/src/commands/build/build.dart Co-authored-by: Renan <[email protected]> --------- Co-authored-by: Renan <[email protected]>
1 parent 02437ce commit 45f95d6

File tree

3 files changed

+36
-14
lines changed

3 files changed

+36
-14
lines changed

packages/dart_frog_cli/lib/src/commands/build/build.dart

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,14 @@ class BuildCommand extends DartFrogCommand {
1818
GeneratorBuilder? generator,
1919
}) : _ensureRuntimeCompatibility = ensureRuntimeCompatibility ??
2020
runtime_compatibility.ensureRuntimeCompatibility,
21-
_generator = generator ?? MasonGenerator.fromBundle;
21+
_generator = generator ?? MasonGenerator.fromBundle {
22+
argParser.addOption(
23+
'dart-version',
24+
defaultsTo: 'stable',
25+
help: 'The Dart SDK version used to build the Dockerfile, defaults to'
26+
' stable.',
27+
);
28+
}
2229

2330
final void Function(Directory) _ensureRuntimeCompatibility;
2431
final GeneratorBuilder _generator;
@@ -34,7 +41,9 @@ class BuildCommand extends DartFrogCommand {
3441
_ensureRuntimeCompatibility(cwd);
3542

3643
final generator = await _generator(dartFrogProdServerBundle);
37-
var vars = <String, dynamic>{};
44+
var vars = <String, dynamic>{
45+
'dartVersion': results['dart-version'],
46+
};
3847

3948
logger.detail('[codegen] running pre-gen...');
4049
await generator.hooks.preGen(

0 commit comments

Comments
 (0)