Skip to content

Commit

Permalink
refactor: Remove bookkeeping abstraction from turbo config (#6809)
Browse files Browse the repository at this point in the history
### Description

I removed the bookkeeping abstraction that we ported from Go. It wasn't
necessary since we can use `Option` to detect if a field is explicitly
set versus not. Also renamed `RawTurboJSON` to be `RawTurboJson` to fit
with the other names.

### Testing Instructions

The existing tests should suffice.


Closes TURBO-1945
  • Loading branch information
NicholasLYang authored Dec 15, 2023
1 parent 8aa1e22 commit 6bc7001
Show file tree
Hide file tree
Showing 8 changed files with 173 additions and 332 deletions.
4 changes: 2 additions & 2 deletions crates/turborepo-lib/src/commands/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ mod test {
use crate::{
cli::LinkTarget,
commands::{link, CommandBase},
config::{RawTurboJSON, TurborepoConfigBuilder},
config::{RawTurboJson, TurborepoConfigBuilder},
Args,
};

Expand Down Expand Up @@ -728,7 +728,7 @@ mod test {

// verify space id is added to turbo.json
let turbo_json_contents = fs::read_to_string(&turbo_json_file).unwrap();
let turbo_json: RawTurboJSON = serde_json::from_str(&turbo_json_contents).unwrap();
let turbo_json: RawTurboJson = serde_json::from_str(&turbo_json_contents).unwrap();
assert_eq!(
turbo_json.experimental_spaces.unwrap().id.unwrap(),
turborepo_vercel_api_mock::EXPECTED_SPACE_ID
Expand Down
4 changes: 2 additions & 2 deletions crates/turborepo-lib/src/commands/prune.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use turborepo_repository::{
use turborepo_ui::BOLD;

use super::CommandBase;
use crate::config::RawTurboJSON;
use crate::config::RawTurboJson;

#[derive(Debug, thiserror::Error)]
pub enum Error {
Expand Down Expand Up @@ -426,7 +426,7 @@ impl<'a> Prune<'a> {
}
Err(e) => return Err(e.into()),
};
let turbo_json: RawTurboJSON = serde_json::from_reader(json_comments::StripComments::new(
let turbo_json: RawTurboJson = serde_json::from_reader(json_comments::StripComments::new(
turbo_json_contents.as_slice(),
))?;

Expand Down
4 changes: 3 additions & 1 deletion crates/turborepo-lib/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ mod turbo_config;
use std::io;

use thiserror::Error;
pub use turbo::{validate_extends, validate_no_package_task_syntax, RawTurboJSON, TurboJson};
pub use turbo::{
validate_extends, validate_no_package_task_syntax, RawTaskDefinition, RawTurboJson, TurboJson,
};
pub use turbo_config::{ConfigurationOptions, TurborepoConfigBuilder};
use turbopath::AbsoluteSystemPathBuf;

Expand Down
Loading

0 comments on commit 6bc7001

Please sign in to comment.