Workspace mode - yarn.lock conversion fails with invalid package.json in tests
- Dominant language
- JavaScript
- Stars
- 788
- Forks
- 42
- PR merge metrics
- No merged PRs in 30d
Description
#### Issue description:
In workspace mode, it seems like synp tries to read all package.json files in the node_modules, even if they are not the main package.json file for the package. We're trying to convert yarn.lock to package-lock.json and one of our sub-dependencies is [resolve](https://www.npmjs.com/package/resolve) package, which includes a bunch of invalid package.json files in [their test suite](https://github.com/browserify/resolve/blob/main/test/resolver/malformed_package_json/package.json). This causes the conversion to fail with `Unexpected end of JSON input` error.
#### Are you reporting a conversion error? Please include a link to `yarn.lock` / `package-lock.json`:
Cannot link to the whole yarn.lock, but the relevant parts are
```
ts-node-dev@^1.1.8:
version "1.1.8"
resolved "https://registry.yarnpkg.com/ts-node-dev/-/ts-node-dev-1.1.8.tgz#95520d8ab9d45fffa854d6668e2f8f9286241066"
integrity sha512-Q/m3vEwzYwLZKmV6/0VlFxcZzVV/xcgOt+Tx/VjaaRHyiBcFlV0541yrT09QjzzCxlDZ34OzKjrFAynlmtflEg==
dependencies:
chokidar "^3.5.1"
dynamic-dedupe "^0.3.0"
minimist "^1.2.5"
mkdirp "^1.0.4"
resolve "^1.0.0"
rimraf "^2.6.1"
source-map-support "^0.5.12"
tree-kill "^1.2.2"
ts-node "^9.0.0"
tsconfig "^7.0.0"
resolve@^1.0.0, resolve@^1.1.6, resolve@^1.1.7, resolve@^1.10.0, resolve@^1.11.1, resolve@^1.12.0, resolve@^1.14.2, resolve@^1.15.1, resolve@^1.20.0, resolve@^1.22.0, resolve@^1.3.2, resolve@^1.8.1:
version "1.22.1"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177"
integrity sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==
dependencies:
is-core-module "^2.9.0"
path-parse "^1.0.7"
supports-preserve-symlinks-flag "^1.0.0"
```
#### Are you reporting a conversion error? Please also include a link to your `package.json`:
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce workspace-mode conversion using the supplied yarn.lock excerpts and the malformed package.json files from resolve's test suite. Trace how synp reads package.json files under node_modules and identify the relevant tests or entry point; done means valid workspaces still convert to package-lock.json without failing on unrelated malformed test fixtures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100