1
- use crate :: util:: { is_reducer_invokable, iter_reducers, iter_tables, iter_types, iter_unique_cols} ;
1
+ use crate :: util:: {
2
+ is_reducer_invokable, iter_reducers, iter_tables, iter_types, iter_unique_cols,
3
+ print_auto_generated_version_comment,
4
+ } ;
2
5
use crate :: { indent_scope, OutputFile } ;
3
6
4
7
use super :: util:: { collect_case, print_auto_generated_file_comment, type_ref_name} ;
@@ -33,7 +36,7 @@ impl Lang for TypeScript {
33
36
let mut output = CodeIndenter :: new ( String :: new ( ) , INDENT ) ;
34
37
let out = & mut output;
35
38
36
- print_file_header ( out) ;
39
+ print_file_header ( out, false ) ;
37
40
gen_and_print_imports ( module, out, & product. elements , & [ typ. ty ] ) ;
38
41
writeln ! ( out) ;
39
42
define_body_for_product ( module, out, & type_name, & product. elements ) ;
@@ -48,7 +51,7 @@ impl Lang for TypeScript {
48
51
let mut output = CodeIndenter :: new ( String :: new ( ) , INDENT ) ;
49
52
let out = & mut output;
50
53
51
- print_file_header ( out) ;
54
+ print_file_header ( out, false ) ;
52
55
gen_and_print_imports ( module, out, variants, & [ typ. ty ] ) ;
53
56
// Import the current type in case of recursive sum types
54
57
writeln ! ( out, "import {} from './{}'" , type_name, type_module_name( & typ. name) ) ;
@@ -65,7 +68,7 @@ impl Lang for TypeScript {
65
68
let mut output = CodeIndenter :: new ( String :: new ( ) , INDENT ) ;
66
69
let out = & mut output;
67
70
68
- print_file_header ( out) ;
71
+ print_file_header ( out, false ) ;
69
72
gen_and_print_imports ( module, out, variants, & [ typ. ty ] ) ;
70
73
writeln ! (
71
74
out,
@@ -114,7 +117,7 @@ impl Lang for TypeScript {
114
117
let mut output = CodeIndenter :: new ( String :: new ( ) , INDENT ) ;
115
118
let out = & mut output;
116
119
117
- print_file_header ( out) ;
120
+ print_file_header ( out, false ) ;
118
121
119
122
let type_ref = table. product_type_ref ;
120
123
let row_type = type_ref_name ( module, type_ref) ;
@@ -280,7 +283,7 @@ removeOnUpdate = (cb: (ctx: EventContext, onRow: {row_type}, newRow: {row_type})
280
283
let mut output = CodeIndenter :: new ( String :: new ( ) , INDENT ) ;
281
284
let out = & mut output;
282
285
283
- print_file_header ( out) ;
286
+ print_file_header ( out, false ) ;
284
287
285
288
out. newline ( ) ;
286
289
@@ -306,7 +309,7 @@ removeOnUpdate = (cb: (ctx: EventContext, onRow: {row_type}, newRow: {row_type})
306
309
let mut output = CodeIndenter :: new ( String :: new ( ) , INDENT ) ;
307
310
let out = & mut output;
308
311
309
- print_file_header ( out) ;
312
+ print_file_header ( out, true ) ;
310
313
311
314
out. newline ( ) ;
312
315
@@ -696,8 +699,11 @@ fn print_spacetimedb_imports(out: &mut Indenter) {
696
699
writeln ! ( out, "}} from \" @clockworklabs/spacetimedb-sdk\" ;" ) ;
697
700
}
698
701
699
- fn print_file_header ( output : & mut Indenter ) {
702
+ fn print_file_header ( output : & mut Indenter , include_version : bool ) {
700
703
print_auto_generated_file_comment ( output) ;
704
+ if include_version {
705
+ print_auto_generated_version_comment ( output) ;
706
+ }
701
707
print_lint_suppression ( output) ;
702
708
print_spacetimedb_imports ( output) ;
703
709
}
0 commit comments