Description
Problem
syncpack currently only picks up files named package.json, even when source contains explicit patterns for other filenames.
Minimal Reproduction
Repo structure
.
├─ package.json
└─ packages/
└─ lib-a/
├─ package.json
└─ package.public.json
syncpack config
{
"source": [
"package.json",
"packages/*/package.json",
"packages/*/package.public.json"
],
"semverGroups": [
{
"dependencies": ["**"],
"range": ""
}
]
}
packages/lib-a/package.public.json
{
"name": "lib-a-public",
"version": "1.0.0",
"dependencies": {
"react": "^18.2.0"
}
}
Run
Actual result
packages/lib-a/package.public.json is ignored (dependencies inside it are not checked).
Expected result
packages/lib-a/package.public.json is treated as a source file because it is explicitly listed in source.
Why this matters
In my monorepos setup, a package need:
package.json for internal workspace/tooling behavior
package.public.json for the published manifest (or prepublish transform source)
Workaround
It's possible to create a separate folder containing package.jcon (e.g. public/package.json), but this creates extra issues:
- Must be excluded from workspace discovery (
pnpm, nx, etc.)
- Tooling may accidentally treat it as another workspace package
Allowing custom manifest filenames directly in source would avoid those conflicts and better support real-world publish workflows.
Suggested Solution
Allow custom package.json names when path contains file name e.g.
{
"source": [
"package.json",
"packages/*", // << directory, no change
"packages/*/package.public.json" // <<< exact file name
],
Optional comments
I'm happy to help to resolve this issue by contributing to project. The source code to change, from what I can tell is here
|
pub fn normalise_pattern(mut pattern: String) -> String { |
|
let negated = pattern.starts_with('!'); |
|
if negated { |
|
pattern.remove(0); |
|
} |
|
let normalized = pattern.replace('\\', "/"); |
|
if negated { |
|
if normalized.contains("package.json") { |
|
format!("!{normalized}") |
|
} else { |
|
format!("!{normalized}/package.json") |
|
} |
|
} else if normalized.contains("package.json") { |
|
normalized |
|
} else { |
|
format!("{normalized}/package.json") |
|
} |
Code of Conduct
Description
Problem
syncpackcurrently only picks up files namedpackage.json, even whensourcecontains explicit patterns for other filenames.Minimal Reproduction
Repo structure
. ├─ package.json └─ packages/ └─ lib-a/ ├─ package.json └─ package.public.jsonsyncpackconfig{ "source": [ "package.json", "packages/*/package.json", "packages/*/package.public.json" ], "semverGroups": [ { "dependencies": ["**"], "range": "" } ] }packages/lib-a/package.public.json{ "name": "lib-a-public", "version": "1.0.0", "dependencies": { "react": "^18.2.0" } }Run
Actual result
packages/lib-a/package.public.jsonis ignored (dependencies inside it are not checked).Expected result
packages/lib-a/package.public.jsonis treated as a source file because it is explicitly listed insource.Why this matters
In my monorepos setup, a package need:
package.jsonfor internal workspace/tooling behaviorpackage.public.jsonfor the published manifest (or prepublish transform source)Workaround
It's possible to create a separate folder containing
package.jcon(e.g.public/package.json), but this creates extra issues:pnpm,nx, etc.)Allowing custom manifest filenames directly in
sourcewould avoid those conflicts and better support real-world publish workflows.Suggested Solution
Allow custom package.json names when path contains file name e.g.
{ "source": [ "package.json", "packages/*", // << directory, no change "packages/*/package.public.json" // <<< exact file name ],Optional comments
I'm happy to help to resolve this issue by contributing to project. The source code to change, from what I can tell is here
syncpack/src/source_patterns.rs
Lines 112 to 128 in 3ffa0e5
Code of Conduct