Skip to content

Commit 2b3c84a

Browse files
tyao1facebook-github-bot
authored andcommitted
Move codegenCommand configuraiton to each project
Reviewed By: voideanvalue Differential Revision: D51776612 fbshipit-source-id: ad66a300ce7e833a5f5d068873641c395cc95ab8
1 parent a603ee4 commit 2b3c84a

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

compiler/crates/relay-compiler/src/artifact_content/content.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,12 @@ pub fn generate_docblock_section(
863863
}
864864
writeln!(section, "@lightSyntaxTransform")?;
865865
writeln!(section, "@nogrep")?;
866-
if let Some(codegen_command) = &config.codegen_command {
866+
867+
if let Some(codegen_command) = &project_config
868+
.codegen_command
869+
.as_ref()
870+
.or(config.codegen_command.as_ref())
871+
{
867872
writeln!(section, "@codegen-command: {}", codegen_command)?;
868873
}
869874
Ok(section)

compiler/crates/relay-compiler/src/config.rs

+4
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ Example file:
380380
module_import_config: config_file_project.module_import_config,
381381
diagnostic_report_config: config_file_project.diagnostic_report_config,
382382
resolvers_schema_module: config_file_project.resolvers_schema_module,
383+
codegen_command: config_file_project.codegen_command,
383384
};
384385
Ok((project_name, project_config))
385386
})
@@ -1045,6 +1046,9 @@ pub struct ConfigFileProject {
10451046

10461047
#[serde(default)]
10471048
pub resolvers_schema_module: Option<ResolversSchemaModuleConfig>,
1049+
1050+
#[serde(default)]
1051+
pub codegen_command: Option<String>,
10481052
}
10491053

10501054
pub type PersistId = String;

compiler/crates/relay-config/src/project_config.rs

+4
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ pub struct ProjectConfig {
248248
pub module_import_config: ModuleImportConfig,
249249
pub diagnostic_report_config: DiagnosticReportConfig,
250250
pub resolvers_schema_module: Option<ResolversSchemaModuleConfig>,
251+
pub codegen_command: Option<String>,
251252
}
252253

253254
impl Default for ProjectConfig {
@@ -275,6 +276,7 @@ impl Default for ProjectConfig {
275276
module_import_config: Default::default(),
276277
diagnostic_report_config: Default::default(),
277278
resolvers_schema_module: Default::default(),
279+
codegen_command: Default::default(),
278280
}
279281
}
280282
}
@@ -304,6 +306,7 @@ impl Debug for ProjectConfig {
304306
module_import_config,
305307
diagnostic_report_config,
306308
resolvers_schema_module,
309+
codegen_command,
307310
} = self;
308311
f.debug_struct("ProjectConfig")
309312
.field("name", name)
@@ -328,6 +331,7 @@ impl Debug for ProjectConfig {
328331
.field("module_import_config", module_import_config)
329332
.field("diagnostic_report_config", diagnostic_report_config)
330333
.field("resolvers_schema_module", resolvers_schema_module)
334+
.field("codegen_command", codegen_command)
331335
.finish()
332336
}
333337
}

0 commit comments

Comments
 (0)