Skip to content

Commit 481f6df

Browse files
authored
add section about lockfile conflicts, closes #6
1 parent 83f8cfe commit 481f6df

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,12 @@ For `deno`, we can also set the following in a `deno.json` file:
147147
}
148148
```
149149

150+
> [!TIP]
151+
>
152+
> When dealing with merge conflicts in lockfiles, it is _not_ necessary to delete the lockfile. When dependencies (including transitive) are defined with version range operators (`^`, `~`, etc), re-building the lockfile from scratch can result in unexpected updates.
153+
>
154+
> Modern package managers have built-in conflict resolutions[^18][^19], just [checkout main and re-run `install`](https://github.com/yarnpkg/yarn/issues/1776#issuecomment-269539948). `pnpm` also allows [Git Branch Lockfiles](https://pnpm.io/git_branch_lockfiles) where it creates a new lockfile based on branch name, and automatically merge it back into the main lockfile later.
155+
150156
### 3. Disable Lifecycle Scripts
151157

152158
> Lifecycle scripts are special scripts that happen in addition to the `pre<event>`, `post<event>`, and `<event>` scripts. For instance, `preinstall` is run before `install` is run and `postinstall` is run after `install` is run. See how npm handles the "scripts" field: https://docs.npmjs.com/cli/v11/using-npm/scripts#life-cycle-scripts
@@ -404,6 +410,7 @@ Here are some private registries that you might find useful:
404410

405411
- GitHub Packages https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry
406412
- Verdaccio https://github.com/verdaccio/verdaccio
413+
- See Verdaccio best practices: https://verdaccio.org/docs/best/
407414
- Vlt https://www.vlt.sh/
408415
- JFrog Artifactory https://jfrog.com/integrations/npm-registry
409416
- Sonatype: https://help.sonatype.com/en/npm-registry.html
@@ -488,3 +495,5 @@ In the JavaScript ecosystem, the OpenJS Foundation (https://openjsf.org) was fou
488495
[^15]: https://openssf.org/blog/2024/04/15/open-source-security-openssf-and-openjs-foundations-issue-alert-for-social-engineering-takeovers-of-open-source-projects/
489496
[^16]: https://xkcd.com/2347
490497
[^17]: https://github.blog/security/supply-chain-security/our-plan-for-a-more-secure-npm-supply-chain
498+
[^18]: https://stackoverflow.com/questions/54124033/deleting-package-lock-json-to-resolve-conflicts-quickly
499+
[^19]: https://pnpm.io/git#merge-conflicts

pnpm-workspace.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ savePrefix: ''
1111
# linkWorkspacePackages: true
1212
# packageManagerStrictVersion: true
1313
# preferWorkspacePackages: true
14+
# resolutionMode: time-based # https://stackoverflow.com/a/74935908
1415
# strictDepBuilds: true
1516
# strictPeerDependencies: true

0 commit comments

Comments
 (0)