ds300 / ds300/patch-package

Can't find lockfile entry for non semver compliant packages when using yarn

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

Description

When trying to add patch for package that has non semver compliant version in its package.json patch generation throws error:
```
Can't find lockfile entry for ...
```

For example:
plugin `serverless-plugin-aws-alerts` has version specified as `v1.7.4`, while in `yarn.lock` it's saved as `1.7.4`. Because of this entry from `yarn.lock` is filtered out in following code:

```typescript
const entries = Object.entries(appLockFile.object).filter(
([k, v]) =>
k.startsWith(packageDetails.name + "@") &&
v.version === installedVersion,
)
```

Potential solution that I would like to propose is to coerce versions (`semver.coerce`) while searching for lockfile entry in `yarn.lock`.

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.