Skip to content

Commit a07750f

Browse files
alunyovfacebook-github-bot
authored andcommitted
Add default values for some of the config options + TODOs
Reviewed By: captbaritone Differential Revision: D32013297 fbshipit-source-id: 8fe327384afa91e423e0ea891a3e47d068affaaa
1 parent 63d906e commit a07750f

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

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

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ struct MultiProjectConfigFile {
625625
is_dev_variable_name: Option<String>,
626626
}
627627

628-
#[derive(Debug, Serialize, Deserialize, Default)]
628+
#[derive(Debug, Serialize, Deserialize)]
629629
#[serde(deny_unknown_fields, rename_all = "camelCase", default)]
630630
pub struct SingleProjectConfigFile {
631631
/// Path to schema.graphql
@@ -640,22 +640,22 @@ pub struct SingleProjectConfigFile {
640640

641641
/// Directories to include under src
642642
/// default: ['**'],
643-
pub include: Vec<String>,
643+
/// TODO(T104508864):: Currently not supported in Rust OSS compiler
644+
pub includes: Vec<String>,
644645

645646
/// Directories to ignore under src
646647
/// default: ['**/node_modules/**', '**/__mocks__/**', '**/__generated__/**'],
647648
pub excludes: Vec<String>,
648649

649650
/// Schema extensions
651+
/// TODO(T104508864): Currently not supported in Rust OSS compiler
650652
pub extensions: Vec<String>,
651653

652-
/// Use watchman when not in watch mode
653-
pub watchman: bool,
654-
655654
/// This option controls whether or not a catch-all entry is added to enum type definitions
656655
/// for values that may be added in the future. Enabling this means you will have to update
657656
/// your application whenever the GraphQL server schema adds new enum values to prevent it
658657
/// from breaking.
658+
/// TODO(T104508864): Currently not supported in Rust OSS compiler
659659
pub no_future_proof_enums: bool,
660660

661661
/// The name of the language plugin (?) used for input files and artifacts
@@ -666,9 +666,31 @@ pub struct SingleProjectConfigFile {
666666
pub custom_scalars: FnvIndexMap<StringKey, StringKey>,
667667

668668
/// This option enables emitting es modules artifacts.
669+
/// TODO(T104508864): Currently not supported in Rust OSS compiler
669670
pub eager_es_modules: bool,
670671
}
671672

673+
impl Default for SingleProjectConfigFile {
674+
fn default() -> Self {
675+
Self {
676+
schema: Default::default(),
677+
src: Default::default(),
678+
artifact_directory: Default::default(),
679+
includes: vec!["**".to_string()],
680+
excludes: vec![
681+
"**/node_modules/**".to_string(),
682+
"**/__mocks__/**".to_string(),
683+
"**/__generated__/**".to_string(),
684+
],
685+
extensions: vec![],
686+
no_future_proof_enums: false,
687+
language: Some(TypegenLanguage::TypeScript),
688+
custom_scalars: Default::default(),
689+
eager_es_modules: false,
690+
}
691+
}
692+
}
693+
672694
impl From<SingleProjectConfigFile> for MultiProjectConfigFile {
673695
fn from(oss_config: SingleProjectConfigFile) -> MultiProjectConfigFile {
674696
let root_dir = std::env::current_dir().unwrap();
@@ -683,6 +705,7 @@ impl From<SingleProjectConfigFile> for MultiProjectConfigFile {
683705
)),
684706
typegen_config: TypegenConfig {
685707
language: oss_config.language.unwrap_or(TypegenLanguage::TypeScript),
708+
custom_scalar_types: oss_config.custom_scalars,
686709
..Default::default()
687710
},
688711
..Default::default()

0 commit comments

Comments
 (0)