Currently, when `node-linker=hoisted` is used and `node_modules` is not up-to-date, pnpm relinks all dependencies inside node_modules. This is not efficient, so with this optimisation pnpm will only relink what needs to be relinked.
* fix: improve license file reading logic
If the file index is of the appropriate type so we can leverage the contents of `PackageFileInfo`-type we try
to lookup the file mode to and pass it to the `readLicenseFileFromCafs`-function so it can be correctly
passed to the underlying `getFilePathByModeInCafs`-function responsible for fetching the file from
the PNPM store
* test: add integration test for the problematic `svgicons2svgfont`
Added a test to verify that the LICENSE files of the `svgicons2svgfont@5.0.2`-package
and similar packages can be read without errors
* refactor: license
* docs: add changesets
Co-authored-by: Weyert de Boer <weyert@innerfuse.biz>
Co-authored-by: Zoltan Kochan <z@kochan.io>
This patch is intended to lower the maintenance burden of having to
manually go through each matrix subjob name in the branch protection
repository settings. It allows to only include the check job in the
branch protection and it will robustly determine if the dependencies
have succeeded or not.
It is currently mostly serves the Python ecosystem in projects like
aiohttp, cryptography, open edX, pip etc. But I've also seen other
communities picking it up lately, like the AWS Rust SDK and even the
engine powering https://dev.to, to my surprise. Strictly speaking, it
is agnostic.
Ref: https://github.com/marketplace/actions/alls-green#why
Use npm package `strip-comments-strings` to find all comments in any
manifest file as it is read. Save them as part of the "file formatting"
detected by the manifest reader, noting for each the text of the lines
they are on, before, and after, and the line number as a fallback.
When the manifest is written, attempt to place each comment back in
the resulting JSON5 text, so that the text of the line it is on,
before, or after (in that priority order) matches the text at time of
reading. Otherwise, so that no comments are lost, replace the comment
on the same line number, adding a notation that it may have been
relocated (due to sorting dependencies, for example, it may no longer
be in the same "logical position" in the file, even though it is on
the same physical line number).
When comments are in fairly ordinary positions and the manifest does
not change too drastically (i.e. once the dependencies are sorted as
pnpm prefers, and there are not many parameters added all at once),
this strategy results in exact preservation of the comments, as a new
test shows.
The motivation for this commit is to take advantage of the feature of
JSON5 that it allows human-readable comments. For this feature to be
useful in the case of package.json5 manifests, those comments must be
preserved across manifest changes.
Partially resolves#2008. [That issue requests comment preservation
also for YAML manifests, but I have no experience working with YAML,
and it also requests that key order be preserved, but I did not
address key order because current code in the the pnpm manifest
reader/writer _explicitly_ reorders keys -- clearly deliberately --
so I did not want to simply remove code that appeared to have been
purposefully written and included.]
Co-authored-by: Zoltan Kochan <z@kochan.io>