JamieMason / JamieMason/syncpack

feat(versions): support local filepaths in nested workspaces

Open
#133 2 comments 3 reactions 0 assignees View on GitHub
Priority: Low Type: Feat
Dominant language
Rust
Stars
2.1k
Forks
72
PR merge metrics
No merged PRs in 30d

Description

### Description
When two workspaces are in separate hierarchies and need to reference a common patch as a dependency, I use the relative path to the patch directory. However, in this situation, syncpack does not correctly identify that the different patch paths are actually the same due to their directory locations. As a result, running `yarn run syncpack list-mismatches` will generate an error.

### Steps to reproduce:

- Make sure you have a `patches/` folder a the root of your project.

- Create a `package.json` at the root of your project and add a patch to a dependency (example `root-proj/package.json`), say "react-dom" referencing a patch from the `patches/` folder..

- Create a workspace inside a folder from the root and add a `package.json` (example `root-proj/workspace-1/package.json`). Add "react-dom" as a dependency and map its version to the relative path of the patch with `../patches` so that it references the same patch as above.

- Run `yarn run syncpack list-mismatches`

The output should be similar to:

```
✘ react-dom has mismatched versions which syncpack cannot fix
--
patch:react-dom@16.11.0#patches/react-dom+16.11.0.patch in dependencies of package.json
patch:react-dom@16.11.0#../patches/react-dom+16.11.0.patch in dependencies of workspace-1/package.json
```

**env:**
syncpack: 9.8.6
node: 14.19.0
yarn: 3.2.2
os: Mac Ventura 13.3.1

Thanks for looking into this!

Contributor guide

Open the contributing guide

Research direction

Reproduce the case with a root package.json, workspace-1/package.json, and a shared patches/ directory, then run `yarn run syncpack list-mismatches`. Start by tracing how syncpack reads and compares the two patch dependency paths. Done means the equivalent root and workspace paths are recognized as the same dependency and no mismatch error is reported.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.