Skip to content

Commit 767151e

Browse files
[web_generator] Bug Fixes in Entrypoint gen_interop_bindings.dart (#423)
* [web_generator] removed duplicate help option * Added support for no config passing in entrypoint * fix analyze and format issues
1 parent 1f80532 commit 767151e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

web_generator/bin/gen_interop_bindings.dart

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,11 @@ $_usage''');
6161
final inputFile = argResult.rest.first;
6262
final outputFile = argResult['output'] as String? ??
6363
p.join(p.current, inputFile.replaceAll('.d.ts', '.dart'));
64-
final configFile =
65-
argResult['config'] as String? ?? p.join(p.current, 'webgen.yaml');
64+
final defaultWebGenConfigPath = p.join(p.current, 'webgen.yaml');
65+
final configFile = argResult['config'] as String? ??
66+
(File(defaultWebGenConfigPath).existsSync()
67+
? defaultWebGenConfigPath
68+
: null);
6669
final relativeOutputPath =
6770
p.relative(outputFile, from: bindingsGeneratorPath);
6871
// Run app with `node`.
@@ -73,7 +76,7 @@ $_usage''');
7376
'--declaration',
7477
'--input=${p.relative(inputFile, from: bindingsGeneratorPath)}',
7578
'--output=$relativeOutputPath',
76-
'--config=$configFile'
79+
if (configFile case final config?) '--config=$config'
7780
],
7881
workingDirectory: bindingsGeneratorPath,
7982
);
@@ -100,5 +103,5 @@ final _parser = ArgParser()
100103
..addOption('config',
101104
hide: true,
102105
abbr: 'c',
103-
help: 'The configuration file to use for this tool (NOTE: Unimplemented)')
104-
..addFlag('help', negatable: false);
106+
help:
107+
'The configuration file to use for this tool (NOTE: Unimplemented)');

0 commit comments

Comments
 (0)