ds300 / ds300/patch-package

Expecting non-zero exit code after "**ERROR** Failed to apply patch ..."

Open
#241 1 comment 8 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.2k
Forks
325
PR merge metrics
No merged PRs in 30d

Description

We inadvertently upgraded a package, causing it's patch file to no longer apply. While `patch-package` printed an error message, it still returned an exit code of zero. This caused us to not catch the issue in CI. It should return a non-zero exit code, right?

```
$ ./node_modules/.bin/patch-package --patch-dir node_module_patches_dev
patch-package 6.2.1
Applying patches...

**ERROR** Failed to apply patch for package nyc at path

node_modules/nyc

This error was caused because nyc has changed since you
made the patch file for it. This introduced conflicts with your patch,
just like a merge conflict in Git when separate incompatible changes are
made to the same piece of code.

Maybe this means your patch file is no longer necessary, in which case
hooray! Just delete it!

Otherwise, you need to generate a new patch file.

To generate a new one, just repeat the steps you made to generate the first
one.

i.e. manually make the appropriate file changes, then run

patch-package nyc

Info:
Patch file: patches/nyc+15.0.1.patch
Patch was made for version: 15.0.1
Installed version: 15.1.0

✨ Done in 0.69s.
$ echo $?
0
```

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.