forked from vercel/turborepo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: honour handleTransparentWorkspaces setting in Yarn/Berry
- Loading branch information
1 parent
1b1f98e
commit 8b7166d
Showing
4 changed files
with
111 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
use std::io; | ||
|
||
use serde::Deserialize; | ||
use serde_yaml; | ||
|
||
#[derive(Debug, thiserror::Error)] | ||
pub enum Error { | ||
#[error("encountered error parsing yarnrc.yml: {0}")] | ||
SerdeYaml(#[from] serde_yaml::Error), | ||
} | ||
|
||
/// A yarnrc.yaml file representing settings affecting the package graph. | ||
#[serde(default)] | ||
#[derive(Debug, PartialEq, Eq, Clone, Deserialize)] | ||
pub struct YarnRc { | ||
/// TODO description | ||
pub enable_transparent_workspaces: bool, | ||
} | ||
|
||
impl Default for YarnRc { | ||
fn default() -> YarnRc { | ||
YarnRc { | ||
enable_transparent_workspaces: true, | ||
} | ||
} | ||
} | ||
|
||
impl YarnRc { | ||
pub fn from_reader(mut reader: impl io::Read) -> Result<Self, Error> { | ||
let config: YarnRc = serde_yaml::from_reader(&mut reader)?; | ||
Ok(config) | ||
} | ||
} | ||
|
||
#[cfg(test)] | ||
mod test { | ||
use super::*; | ||
|
||
#[test] | ||
fn test_parse_empty_yarnrc() { | ||
let empty = YarnRc::from_reader(b"".as_slice()).unwrap(); | ||
assert_eq!( | ||
empty, | ||
YarnRc { | ||
enable_transparent_workspaces: true | ||
} | ||
); | ||
} | ||
} |