ds300 / ds300/patch-package

Yarn vendored packages impossible to patch

Open
#458 2 comments 4 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.2k
Forks
325
PR merge metrics
No merged PRs in 30d

Description

Hello,
we have packages provided to us through private repository, the package itself is not owned by us.
We add this with "file:" protocol of yarn:
```
{
"dependencies": {
"shim": "file:./vendor/shim-0.1.23.tgz"
}
}
```

When we try to patch this package with `yarn patch-package shim` it returns the following error:
error
`Package "" refers to a non-existing file '"/private/var/folders/kh/kgqx507n5b31w3676tsvkw3r0000gn/T/tmp-2705AUL26tJlAvfk/vendor/shim-0.1.23.tgz#73c29517ef20deb521e83f38b931a7d09fabdfbc"'`.

I've managed to overcome this issue manually, with:
1. put a breakpoint to line which corresponds to https://github.com/ds300/patch-package/blob/fbbeccd3025451d862b2b8786215e8fd111bec5a/src/makePatch.ts#L109
2. Run vscode in debug mode, so breakpoint would trigger
3. copy "vendor" folder to the `tmpRepoNpmRoot`
4. edit package.json file in `tmpRepoNpmRoot` to remove this fancy ending `#73c29517ef20deb521e83f38b931a7d09fabdfbc`
5. continue execution

So, for yarn managed projects we need to copy files itself along with package.json creation. Could this be implemented in patch-package itself?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.