Commit Graph

19 Commits

Author SHA1 Message Date
Pham Manh Luc ef60dfcdee refactor(manager/npm): rename internal managerData.pnpmShrinkwrap to pnpmLockFile (#45390)
refactor(pnpm): rename managerData.pnpmShrinkwrap to pnpmLockFile

The field holds the path to pnpm-lock.yaml, and pnpm has not called that file
a shrinkwrap since v5, so the old name reads as a different artifact than the
one it points at.

Co-authored-by: Jamie Tanna <jamie.tanna@mend.io>
2026-09-01 13:09:21 +00:00
Sebastian Poxhofer c32e2391a0 refactor(linters): add prefer-coerce-object rule (#45493)
Refs #45216

The object counterpart to `prefer-coerce-array`: `x ?? {}` becomes
`coerceObject(x)`. The rule flags a `??` whose default is a bare `{}`
literal, so a populated default or an asserted `({} as Foo)` still
passes; a `x ?? y ?? {}` chain maps onto `coerceObject(x, y)`.

Every hit across `lib/` converted cleanly, so no disable comments were
needed.
2026-08-28 09:27:59 +00:00
Jamie Tanna 6d2fa815b7 fix(manager/npm): quote package spec in corepack command
To prevent the possibility of a npm package name including shell
metacharacters (which is unlikely, but potentially possible through a
well-crafted payload), which could lead to command execution, we can
make sure they are quoted appropriately.

Co-authored-by: Claude Opus 5 <jamie.tanna+claude-code@mend.io>
2026-08-07 14:25:41 +01:00
renovate[bot] 196101a6bb chore(deps): update dependency oxlint-tsgolint to v0.25.0 (main) (#44424)
* chore(deps): update dependency oxlint-tsgolint to v0.25.0

| datasource | package         | from   | to     |
| ---------- | --------------- | ------ | ------ |
| npm        | oxlint-tsgolint | 0.23.0 | 0.25.0 |

* chore: fix new no-unnecessary-type-assertion findings

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Sebastian Poxhofer <sebastian.poxhofer@stedi.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-28 07:04:21 +00:00
Martijn van der Meij 5e1f88afc6 fix(npm): use packageName for pnpm overrides with range selectors in minimumReleaseAgeExclude (#43477)
* fix(npm): use packageName for pnpm overrides with range selectors in minimumReleaseAgeExclude

For pnpm.overrides entries with version range selectors (e.g. "pkg@<=1.0.0"),
depName contains the full override key including the selector, which is needed
to correctly update package.json. However this caused invalid entries in
minimumReleaseAgeExclude like "fast-xml-parser@<=5.3.5@5.5.7" instead of
"fast-xml-parser@5.5.7", breaking pnpm install with ERR_PNPM_INVALID_MINIMUM_RELEASE_AGE_EXCLUDE.

Fix by using packageName (bare npm package name parsed by @pnpm/parse-overrides)
instead of depName when constructing minimumReleaseAgeExclude entries. Falls back
to depName for dependency types where packageName is not set.

Made-with: Cursor

* test(npm): format pnpm override minimumReleaseAgeExclude test

Use codeBlock helper for expected pnpm-workspace.yaml contents per review.

* test(npm): avoid string concat in shrinkwrap exclude test

Use template literal instead of + to satisfy restrict-plus-operands.

* fix(npm): replace malformed minimumReleaseAgeExclude entries

Skip invalid package@version lines (extra @ after package prefix) when
matching excludes, and replace them instead of appending versions.

* test(npm): cover valid vs malformed exclude matching

* Update lib/modules/manager/npm/artifacts.spec.ts

Co-authored-by: Michael Kriese <michael.kriese@gmx.de>

* Update lib/modules/manager/npm/artifacts.spec.ts

Co-authored-by: Michael Kriese <michael.kriese@gmx.de>

* test(npm): use codeBlock for expected workspace contents

* fix(npm): remove stale malformed minimumReleaseAgeExclude entries

When a valid exclude entry exists for the same package, drop leftover
malformed lines from the prior double-@ bug instead of leaving them.

* test(npm): avoid string concat in codeBlock expectations

Use template literal instead of + '\n' for prefer-template.

---------

Co-authored-by: Tapio Oikarinen <tapio.oikarinen@hoxhunt.com>
Co-authored-by: Martijn van der Meij <Squixx@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@gmx.de>
2026-06-08 13:27:08 +00:00
Sebastian Poxhofer 73b90e958b refactor: remove string concetation for production code (#43442)
refactor: prefer templates rather than `+`
2026-05-19 13:31:27 +00:00
Michael Kriese 6804768a1a feat(npm): support pnpm workspace file overrides (#42247)
* feat(npm): support pnpm workspace file overrides

* chore: fix comment

* refactor: use types

* feat(npm/pnpm): update overrides in workspace file

* test: fix test

* chore: fix coverage
2026-04-08 12:01:31 +00:00
Alex 0175429341 fix(manager/npm): apply minimumReleaseAgeExclude to pnpm catalog updates (#42050)
* Fix updating minimumReleaseAgeExclude with pnpm catalogs

* Try fixing coverage
2026-04-07 12:39:15 +00:00
Jamie Tanna 0c4912456e fix(pnpm): don't update workspace when no pnpm-lock.yaml found (#40780)
As noted in #40774, if a `pnpm-lock.yaml` isn't found, the
`pnpmShrinkwrap` is undefined, which then results in `upath.dirname`
throwing an error.

We can make sure that we have a value, and exit out early if not.

This is a short-term fix, and we should follow-up to make it so we can
find the `pnpm-workspace.yaml` if there's not a lockfile.
2026-01-29 11:21:08 +00:00
Sergei Zharinov 930cf6633c refactor: Rewrite imports with .ts extensions (#40700)
fix: Additional vi.mock path corrections and prettier formatting
2026-01-26 22:48:17 +00:00
Jamie Tanna 30eece1f61 fix(pnpm): de-duplicate version numbers in minimumReleaseAgeExclude (#40613)
As noted in #40611, we shouldn't reference the same version multiple
times in the same exclude directive.

This also handles the case where we could end up with multiple comments
for a given package.

This is slightly more complex logic, and slightly simplifes by
extracting out to a new helper method.

We also need to make sure that we use `getIn` so we get the raw node, so
we can look at the comment inside the `minimumReleaseAgeExclude`'s list,
but before the first element.
2026-01-23 08:54:20 +00:00
Jamie Tanna 8752c280fc fix(pnpm): use exact versions in minimumReleaseAgeExclude (#40612)
As noted in #40610, when `newVersion` contains a caret (or other
npm-specific versioning constraints) a generated
`minimumReleaseAgeExclude` directive will result in

    ERR_PNPM_INVALID_MINIMUM_RELEASE_AGE_EXCLUDE  Invalid value in
    minimumReleaseAgeExclude: Invalid versions union. Found: "...". Use
    exact versions only.

To handle this better, we can make sure we use `newVersion` over
`newValue`, as it'll provide the raw version number.

We also need to update an unrelated to test to make sure it's using
`newVersion`.
2026-01-22 17:17:41 +00:00
RahulGautamSingh 5922ab6ae4 feat(pnpm): update minimumReleaseAgeExclude for security updates (#40020)
* pnpm mra exclude

* move logic to npm:updateArtifacts

* only update pnpm workspace if security upgrade

* handle no matching setting found case

* refactor: minor

* fix tests

* variable name change

* in-between

* add tests

* refacto

* add test

* update helper function

* fix coverage

* fix coverage

* use AST based approach

makes the code more maintainable & readable

* add tests

* remove lockFileName

---------

Co-authored-by: Jamie Tanna <jamie.tanna@mend.io>
2026-01-22 09:36:43 +00:00
Henry Cai fbdf8dfecc feat(npm): support pnpm v11 environment variables (#36762) 2025-07-04 08:46:11 +00:00
Henry Cai ad8d9188ed fix(npm): set pnpm store location for corepack command (#36336) (#36727)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2025-07-03 06:43:01 +00:00
RahulGautamSingh 80b7cdf1e0 refactor(util): move user env to util folder (#35103) 2025-04-02 10:27:27 +00:00
RahulGautamSingh 56f79b9725 fix(npm): update npmrc before executing corepack cmd (#32733) 2024-11-27 08:55:51 +00:00
RahulGautamSingh 88b03480fa fix(manager/npm): improve handling of grouped updates (#31326) 2024-09-13 14:11:19 +00:00
RahulGautamSingh c2821134f1 feat(npm): append corepack hashes when updating package managers (#30552) 2024-08-19 13:37:25 +00:00