diff --git a/crates/turborepo-lockfiles/fixtures/pnpm-v6.1.yaml b/crates/turborepo-lockfiles/fixtures/pnpm-v6.1.yaml new file mode 100644 index 0000000000000..f175819c7cab0 --- /dev/null +++ b/crates/turborepo-lockfiles/fixtures/pnpm-v6.1.yaml @@ -0,0 +1,22 @@ +lockfileVersion: "6.1" + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + .: {} + + packages/a: + dependencies: + c: + specifier: workspace:* + version: link:../c + + packages/b: + dependencies: + c: + specifier: workspace:* + version: link:../c + + packages/c: {} diff --git a/crates/turborepo-lockfiles/src/pnpm/data.rs b/crates/turborepo-lockfiles/src/pnpm/data.rs index 28fcdb3972aed..94ac7156cd5ac 100644 --- a/crates/turborepo-lockfiles/src/pnpm/data.rs +++ b/crates/turborepo-lockfiles/src/pnpm/data.rs @@ -11,6 +11,8 @@ type Map = std::collections::BTreeMap; pub struct PnpmLockfile { lockfile_version: LockfileVersion, #[serde(skip_serializing_if = "Option::is_none")] + settings: Option, + #[serde(skip_serializing_if = "Option::is_none")] never_built_dependencies: Option>, #[serde(skip_serializing_if = "Option::is_none")] only_built_dependencies: Option>, @@ -125,6 +127,13 @@ pub struct PackageResolution { commit: Option, } +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)] +#[serde(rename_all = "camelCase")] +struct LockfileSettings { + auto_install_peer_deps: Option, + exclude_links_from_lockfile: Option, +} + impl PnpmLockfile { pub fn from_bytes(bytes: &[u8]) -> Result { let this = serde_yaml::from_slice(bytes)?; @@ -293,6 +302,7 @@ impl PnpmLockfile { package_extensions_checksum: self.package_extensions_checksum.clone(), patched_dependencies: patches, time: None, + settings: self.settings.clone(), }) } @@ -430,7 +440,8 @@ pub fn pnpm_global_change( Ok(prev_data.lockfile_version != curr_data.lockfile_version || prev_data.package_extensions_checksum != curr_data.package_extensions_checksum || prev_data.overrides != curr_data.overrides - || prev_data.patched_dependencies != curr_data.patched_dependencies) + || prev_data.patched_dependencies != curr_data.patched_dependencies + || prev_data.settings != curr_data.settings) } #[cfg(test)] @@ -441,6 +452,7 @@ mod tests { const PNPM6: &[u8] = include_bytes!("../../fixtures/pnpm6-workspace.yaml").as_slice(); const PNPM7: &[u8] = include_bytes!("../../fixtures/pnpm7-workspace.yaml").as_slice(); const PNPM8: &[u8] = include_bytes!("../../fixtures/pnpm8.yaml").as_slice(); + const PNPM8_6: &[u8] = include_bytes!("../../fixtures/pnpm-v6.1.yaml").as_slice(); const PNPM_ABSOLUTE: &[u8] = include_bytes!("../../fixtures/pnpm-absolute.yaml").as_slice(); const PNPM_ABSOLUTE_V6: &[u8] = include_bytes!("../../fixtures/pnpm-absolute-v6.yaml").as_slice(); @@ -456,7 +468,7 @@ mod tests { #[test] fn test_roundtrip() { - for fixture in &[PNPM6, PNPM7, PNPM8] { + for fixture in &[PNPM6, PNPM7, PNPM8, PNPM8_6] { let lockfile = PnpmLockfile::from_bytes(fixture).unwrap(); let serialized_lockfile = serde_yaml::to_string(&lockfile).unwrap(); let lockfile_from_serialized =