@@ -3,20 +3,31 @@ import { readFile } from "fs/promises";
3
3
4
4
import {
5
5
AbstractGeneratorContext ,
6
+ AbstractGeneratorNotificationService ,
6
7
FernGeneratorExec ,
7
8
GeneratorExecParsing ,
8
- GeneratorNotificationService
9
+ GeneratorNotificationService ,
10
+ NopGeneratorNotificationService
9
11
} from "@fern-api/browser-compatible-base-generator" ;
10
12
import { assertNever } from "@fern-api/core-utils" ;
11
13
14
+ export declare namespace AbstractGeneratorCli {
15
+ interface Options {
16
+ /* Whether to disable notifications */
17
+ disableNotifications ?: boolean ;
18
+ }
19
+ }
20
+
12
21
export abstract class AbstractGeneratorCli <
13
22
CustomConfig ,
14
23
IntermediateRepresentation ,
15
24
GeneratorContext extends AbstractGeneratorContext
16
25
> {
17
- public async run ( ) : Promise < void > {
26
+ public async run ( options : AbstractGeneratorCli . Options = { } ) : Promise < void > {
18
27
const config = await getGeneratorConfig ( ) ;
19
- const generatorNotificationService = new GeneratorNotificationService ( config . environment ) ;
28
+ const generatorNotificationService = options . disableNotifications
29
+ ? new NopGeneratorNotificationService ( )
30
+ : new GeneratorNotificationService ( config . environment ) ;
20
31
try {
21
32
await generatorNotificationService . sendUpdate (
22
33
FernGeneratorExec . GeneratorUpdate . initV2 ( {
@@ -85,7 +96,7 @@ export abstract class AbstractGeneratorCli<
85
96
ir : IntermediateRepresentation ;
86
97
customConfig : CustomConfig ;
87
98
generatorConfig : FernGeneratorExec . GeneratorConfig ;
88
- generatorNotificationService : GeneratorNotificationService ;
99
+ generatorNotificationService : AbstractGeneratorNotificationService ;
89
100
} ) : GeneratorContext ;
90
101
91
102
/**
0 commit comments