Skip to content

Commit 82ce83b

Browse files
committed
feat: functions.yaml has comment
1 parent 20fc235 commit 82ce83b

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

lib/src/builder/manifest.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ import 'package:yaml_edit/yaml_edit.dart';
2424
import '../common/cloud_run_id.dart';
2525
import 'spec.dart';
2626

27+
const _manifestComment =
28+
'# This file is generated by package:firebase_functions. Do not edit.';
29+
2730
/// Generates the YAML manifest string from discovered params and endpoints.
2831
String generateManifestYaml(
2932
Map<String, ParamSpec> params,
@@ -32,7 +35,7 @@ String generateManifestYaml(
3235
final map = _buildManifestMap(params, endpoints);
3336
final editor = YamlEditor('');
3437
editor.update([], map);
35-
return editor.toString();
38+
return '$_manifestComment\n\n${editor.toString()}';
3639
}
3740

3841
/// Builds the full manifest as a structured map.

test/snapshots/manifest_snapshot_test.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@ void main() {
8282
expect(dartManifest['specVersion'], equals('v1alpha1'));
8383
});
8484

85+
test('should have a comment at top', () {
86+
final dartYaml = File(
87+
'test/fixtures/dart_reference/functions.yaml',
88+
).readAsStringSync();
89+
expect(dartYaml, startsWith('#'));
90+
});
91+
8592
// =========================================================================
8693
// Params Tests
8794
// =========================================================================

0 commit comments

Comments
 (0)