JamieMason / JamieMason/syncpack

question: Is syncpack support respect mainApp as a main reference?

Open
#309 6 comments 0 reactions 0 assignees View on GitHub
Type: Question
Dominant language
Rust
Stars
2.1k
Forks
72
PR merge metrics
No merged PRs in 30d

Description

### Question

Does syncpack support to treat MainApp as a source of truth dependencies while the other `packages` must respect the MainApp? I don't know what this structure should be called.

---

## Usecase

Let say I have this tree structure:

```
monorepo/
apps/
myApp/package.json
packages/
a/package.json
c/package.json
```

with detail dependencies like this:

apps/myapp/package.json:

```
{
"version": "1.0.0",
"name": "myapp",
"main": "index.js",
"private": true,
"dependencies": {
"lodash": "^4.17.21",
}
}
```

packages/a/package.json:

```
{
"version": "1.0.0",
"name": "@packages/a",
"main": "index.js",
"private": true,
"peerDependencies": {
"zustand": "*"
}
}
```

packages/b/package.json:

```
{
"version": "1.0.0",
"name": "@packages/b",
"main": "index.js",
"private": true,
"peerDependencies": {
"lodash": "*",
"axios": "*"
}
}
```

as you see the `apps/myapp/package.json` only has `lodash`, but `packages/a` has `zustand` as peerDep, and `packages/b` also has `axios` as peerDep.

How do i make apps/myapp/ as the main deps, so other packages that have library but not yet added on `myapp` appear when run `syncpack`?

I want to make the unlisted peerDependencies on `packages/*` to be listed on `apps/myapp` first. so the expected apps/myapp/package.json is:

```
{
"version": "1.0.0",
"name": "myapp",
"main": "index.js",
"private": true,
"dependencies": {
"axios": "latest-version",
"lodash": "^4.17.21",
"zustand": "latest-version",
}
}
```

I've tried to search relevan issue about my case, but i'm not found it yet.

### Code of Conduct

- [x] I agree to follow the [Code of Conduct](https://github.com/JamieMason/syncpack/blob/main/CODE_OF_CONDUCT.md)

Contributor guide

Open the contributing guide

Research direction

Start by reviewing how syncpack discovers and compares package.json files, using apps/myapp/package.json and the packages/* examples as the test structure. Run syncpack against this monorepo layout and determine whether peerDependencies can be promoted into the app's dependencies; done means the requested packages appear in apps/myapp/package.json without unwanted changes elsewhere.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.