@@ -33,7 +33,7 @@ class GenerateApiReportCommand extends AmplifyCommand {
33
33
34
34
logger.info ('Generating API JSON files for all packages...' );
35
35
final failedPackages = < String > [];
36
-
36
+
37
37
for (final package in _categoryPackages) {
38
38
logger.info ('Processing $package ...' );
39
39
try {
@@ -48,11 +48,12 @@ class GenerateApiReportCommand extends AmplifyCommand {
48
48
logger.info ('Generating API change report for amplify_core...' );
49
49
await _generateApiChangeReport ();
50
50
51
-
52
51
if (failedPackages.isNotEmpty) {
53
- logger.warn ('Some packages had issues but placeholders were created: ${failedPackages .join (', ' )}' );
52
+ logger.warn (
53
+ 'Some packages had issues but placeholders were created: ${failedPackages .join (', ' )}' ,
54
+ );
54
55
}
55
-
56
+
56
57
logger.info ('Remember to commit these files with your changes.' );
57
58
} catch (e, stackTrace) {
58
59
logger.error ('Failed to generate API reports: $e ' );
@@ -107,7 +108,8 @@ class GenerateApiReportCommand extends AmplifyCommand {
107
108
packagePath,
108
109
'--output' ,
109
110
outputPath,
110
- ], workingDirectory: rootDir.path,);
111
+ '--no-deps' , // Skip dependency resolution
112
+ ], workingDirectory: rootDir.path);
111
113
112
114
if (result.exitCode != 0 ) {
113
115
logger.error (result.stderr.toString ());
@@ -122,13 +124,13 @@ class GenerateApiReportCommand extends AmplifyCommand {
122
124
await _createEmptyApiJson (outputPath);
123
125
return ;
124
126
}
125
-
127
+ // ignore: avoid_catches_without_on_clauses
126
128
} catch (e) {
127
129
logger.warn ('Error generating API JSON for $packagePath : $e ' );
128
130
await _createEmptyApiJson (outputPath);
129
131
}
130
132
}
131
-
133
+
132
134
/// Creates an empty API JSON file as a fallback
133
135
Future <void > _createEmptyApiJson (String outputPath) async {
134
136
logger.info ('Creating an empty API JSON file as a placeholder' );
@@ -159,7 +161,7 @@ class GenerateApiReportCommand extends AmplifyCommand {
159
161
);
160
162
161
163
final outputPath = path.join (corePackagePath, 'api_changes_report.md' );
162
-
164
+
163
165
try {
164
166
final result = await Process .run ('dart-apitool' , [
165
167
'diff' ,
@@ -171,7 +173,7 @@ class GenerateApiReportCommand extends AmplifyCommand {
171
173
'markdown' ,
172
174
'--report-file-path' ,
173
175
outputPath,
174
- ], workingDirectory: rootDir.path, );
176
+ ], workingDirectory: rootDir.path);
175
177
176
178
if (result.exitCode != 0 ) {
177
179
logger
@@ -187,18 +189,19 @@ class GenerateApiReportCommand extends AmplifyCommand {
187
189
await _createEmptyApiChangeReport (outputPath);
188
190
return ;
189
191
}
190
-
191
192
} catch (e) {
192
193
logger.warn ('Error generating API change report: $e ' );
193
194
await _createEmptyApiChangeReport (outputPath);
194
195
}
195
196
}
196
-
197
+
197
198
/// Creates an empty API change report as a fallback
198
199
Future <void > _createEmptyApiChangeReport (String outputPath) async {
199
200
logger.info ('Creating an empty API change report as a placeholder' );
200
201
final outputFile = File (outputPath);
201
- await outputFile.writeAsString ('# API Changes Report\n\n No changes detected or report generation failed.\n ' );
202
+ await outputFile.writeAsString (
203
+ '# API Changes Report\n\n No changes detected or report generation failed.\n ' ,
204
+ );
202
205
logger.info ('Created placeholder report at $outputPath ' );
203
206
}
204
207
}
0 commit comments