Commit Graph

47 Commits

Author SHA1 Message Date
Aron Strandberg 6f0b6a56d3 fix(manager/npm): pass --no-frozen-lockfile to pnpm lock file updates (#44676)
* fix(manager/npm): pass --no-frozen-lockfile to pnpm lock file updates

pnpm applies an explicitly-set frozenLockfile: true from
pnpm-workspace.yaml even to 'pnpm install --lockfile-only', so lock file
regeneration always fails with ERR_PNPM_OUTDATED_LOCKFILE in repos that
set it: pnpm's CI frozen default has a --lockfile-only carve-out, but
explicitly-set values skip that carve-out, and only CLI flags take
precedence over pnpm-workspace.yaml settings. 'pnpm update' is not
affected by frozen mode (and rejects the flag), so only the install
command gets it.

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

* fix: less verbose comment

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-09-07 18:03:12 +00:00
Sebastian Poxhofer f4fa861457 test(npm): replace file snapshots with explicit assertions (#45658)
* test(npm): replace file snapshots with explicit assertions

* test(npm): replace inline snapshots with explicit assertions
2026-09-04 06:36:41 +00:00
Jamie Tanna 5b1749983c feat: always set CI=true for subprocesses
As noted in #43761, we had recently set `CI=true` for the Renovate and
Containerbase orgs on Mend-hosted apps due to a pnpm v11 requirement:

    ERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTY  Aborted removal of
      modules directory due to no TTY

    If you are running pnpm in CI, set the CI environment variable to
      "true", or set "confirmModulesPurge" to "false".

Similarly in #43606, it was noted that we should do this for `mise lock`
to mark the workspace as "trusted".

Although we went with a different situation, there will be cases where
this is useful for tools being executed, for instance when we invoke `yarn`.

We also make sure to keep our documentation up-to-date as we add to the
specific overrides.

With help from Claude Sonnet and Opus to:

- perform some of the mechanical updates as part of this change
- ensure that the Docker sidecar always has `hardcodedProcessEnv` passed
  into it
- catch a needed change to `exposeAllEnv` handling

Co-authored-by: Claude Opus 5 <jamie.tanna+claude-code@mend.io>
Co-authored-by: Claude Sonnet 5 <jamie.tanna+claude-code@mend.io>
2026-08-24 17:21:24 +01:00
Michael Kriese b2da209f26 fix(manager/npm): do not pass --recursive to pnpm dedupe (#45244)
`pnpm dedupe` does not support the `--recursive` flag, so strip it from
the shared args when building the dedupe command.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-12 12:58:51 +00:00
Marcelo Estriga 3646307241 fix(manager/npm): pass correct arguments to pnpm dedupe (#42024)
* fix(manager/npm): pass correct arguments to pnpm dedupe

Run pnpm dedupe with the same options that pnpm install, to:
- suppress unecessary dependency download;
- respect Renovate allowScripts and ignoreScripts options.

* fix documentation table alignment

* Fix typo
2026-08-11 22:02:16 +00:00
Jamie Tanna b017c7548a fix(exec/docker): single-quote the sidecar bash command
When executing commands for `binarySource=docker`, we have two areas
that a command could have shell expansion/injection:

- on the host (when constructing the `bash -l -c`)
- in the container (when running a manager-specific command)

When constructing the host's command, we previously would escape the
`"`, which allows Bash syntax for `${VAR}` and `$(...)` syntax inside
it.

While managers use `quote()` to make the inputs safer, the use of `"`
around that would not provide any protection, and lead to cases where
the `quote()` could be expanded on the host, before `docker run`
executes.

After recent changes to each manager - and removal of `shell: true` -
this doesn't seem to be exploitable, but this hardens it further.

Additionally, we never escaped `\`, so a value containing `\"` produces
a command that `shlex.split` rejects, and the update fails rather than
running.

Instead, we can quote the whole `-c` argument with `quote()`, which
round-trips through both `shlex.split` - the default, no-shell path - and
a real shell.

This removes the `lgtm [js/incomplete-sanitization]` suppression as
we're now correctly sanitising this.

Note this doesn't remove the need for the managers to quote their own
values, as the second area above is still a real shell.

Co-authored-by: Claude Opus 5 <jamie.tanna+claude-code@mend.io>
2026-08-07 14:25:42 +01:00
Jamie Tanna 68cb7c71d5 test: ensure we set binarySource=global (#43382)
* test: ensure we set `binarySource=global`

As part of future changes, we'll correctly return the default value from
`GlobalConfig.get`, instead of `undefined` if no default is provided in
the `get` call.

As `binarySource=install` is the default, this then leads to these tests
failing, as they're intended to run with `binarySource=global`.

Co-authored-by: Claude Sonnet 4.6 <jamie.tanna+claude-code@mend.io>

* fixup! test: ensure we set `binarySource=global`

* fixup! fixup! test: ensure we set `binarySource=global`

---------

Co-authored-by: Claude Sonnet 4.6 <jamie.tanna+claude-code@mend.io>
2026-05-15 15:40:22 +00:00
Jamie Tanna bc82cff059 feat(managers/npm): allow specifying toolSettings.nodeMaxMemory (#40957)
* feat(managers/npm): allow specifying `toolSettings.nodeMaxMemory`

As noted in #40942, we're seeing an increase in memory usage across
`pnpm` and `yarn` users in Mend-hosted apps.

To allow limiting the maximum memory that any `node` child processes
will use, we can add a new `toolSettings.nodeMaxMemory` to (hopefully)
mitigate this.

Similar to the `toolSettings.jvmMaxMemory`, the self-hosted
administrator can set a maximum, which cannot be exceeded by repo-level
configuration.

* fixup! feat(managers/npm): allow specifying `toolSettings.nodeMaxMemory`
2026-03-05 12:56:02 +00:00
Sergei Zharinov 9d857c1f68 refactor(lint): Organize imports with biome (#40966) 2026-02-06 13:40:01 +00:00
Michael Kriese cd0426babd feat(sidecar): use renovatebot/base-image instead of containerbase/sidecar (#40772)
* feat(sidecar): use `renovatebot/base-image` instead of `containerbase/sidecar`

* refactor: simplify sidecar handling

* test: fixup

* docs: fixup
2026-01-29 10:05:24 +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 e773b32431 fix(util/exec): migrate to execa for command execution (#40212)
* fix(util/exec): migrate to `execa` for command execution

As part of a future change, we need to make sure that we have
cross-platform support for specific command executions.

By using `execa`'s functionality on top of `node:child_process`, we can
provide this functionality, as well as retain a consistent API with
internal users.

We need to make a couple of small tweaks to setting the `RawExecOptions`
as we're now bound by `readonly` properties.

As the `stdio` property's type is not exported, we can replace this with
an explicit setting of `stdin`, `stdout` and `stderr`.

This requires a number of test changes to make sure that the `stdin`,
`stdout` and `stderr` are set.

This doesn't migrate any calls under `tools`, as they can remain using
`node:child_process`.

* chore(util/exec): ignore floating promises `.on` calls

Since moving to use `execa`, we now have "floating promises" for the
`.on` method calls.

As we aren't handling them here, we can now mark them as `void` (as an
alternative to ignoring the ESLint rule).
2025-12-30 14:28:18 +00:00
Jamie Tanna 39bfc0975e refactor(util/exec): remove deprecated encoding property (#40199)
This has been deprecated since 2022-07, and is unused as we only ever
use UTF-8.

In `tools/utils/exec.ts` we make sure to specify it explicitly, so we
don't get a Buffer returned.
2025-12-30 09:55:31 +00:00
Rhys Arkins aaa360fae9 fix(pnpm): allow pnpmfile if scripts are allowed (#37750) 2025-08-29 08:34:49 +00:00
Henry Cai f297adadea fix(npm): update pnpm dedupe ignore-scripts flag (#36732) 2025-06-29 06:46:43 +00:00
Eric Boureau 1bef8cc8ef fix: pnpm recursive update for workspace project (#36586) 2025-06-26 07:44:52 +00:00
RahulGautamSingh e12252315b feat(manager/npm): use volta pins as constraints (#35869)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2025-05-24 09:06:31 +00:00
Trim21 8ce2d49c51 fix: pnpm install flags on non-workspace project (#34720) 2025-03-31 12:10:50 +00:00
Michael Kriese 19c115c813 test: cleanup (#34785) 2025-03-13 17:52:09 +00:00
Michael Kriese 997c23502e test: migrate to vitest (#34475)
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
2025-02-26 09:35:54 +00:00
Rhys Arkins 0c2eaaf8bb feat: sharedVariableName (#33111)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2025-01-16 15:05:07 +00:00
Michael Kriese b652e853f2 feat(npm): support pnpm v9 (#28470)
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
2024-04-17 10:46:53 +00:00
guillaumeduboc 11658dfa0d feat(manager/npm): handle pnpm lockfile updates (#26770)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2024-02-22 08:26:36 +00:00
Sergei Zharinov b69416ce17 refactor(prettier): Force trailing commas (#25631) 2023-11-07 15:50:29 +00:00
Bryan Lee 526ebe697e fix(manager/npm): use --config.ignore-scripts=true for pnpm dedupe (#25210) 2023-10-15 05:47:46 +00:00
Rhys Arkins 3609cddbbe fix(pnpm): Revert "feat(manager/npm): ignore scripts for pnpmDedupe" (#25208) 2023-10-14 10:56:57 +00:00
Bryan Lee 0d758a3d0e feat(manager/npm): ignore scripts for pnpmDedupe (#24505)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2023-10-09 09:49:05 +00:00
Michael Kriese 84a97a62fa test(perf): improve test speed (#24323) 2023-09-08 11:40:04 +00:00
Rhys Arkins c7832e55f8 feat!: remove BUILDPACK env support 2023-07-04 19:21:52 +02:00
RahulGautamSingh aa14b777c0 feat!: replace dockerImagePrefix with dockerSidecarImage (#22708)
Closes #21217

BREAKING CHANGE: dockerImagePrefix is now replaced by dockerSidecarImage
2023-07-04 19:21:52 +02:00
Rhys Arkins d4d742c464 fix(pnpm): defer lock file constraint parsing (#22311)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2023-05-26 05:08:24 +00:00
Rhys Arkins 8d372fc594 fix(pnpm): use latest pnpm when upgrading pnpm (#22309) 2023-05-19 08:02:13 +00:00
Michael Kriese ec4b17b8b6 feat(config)!: default dockerImagePrefix to containerbase (#20150)
Sidecar containers will now use `containerbase/` prefix instead of `renovate/` prefix.

BREAKING CHANGE: containerbase/ account used for sidecar containers instead of renovate/
2023-03-10 09:34:40 +01:00
RahulGautamSingh 352c9db904 test: add new wrapper for partial (#20618) 2023-02-25 06:46:32 +00:00
ocavue 2235659b18 feat(manager/npm): support pnpmDedupe (#20392)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2023-02-14 09:10:50 +00:00
renovate[bot] 7935a7b8ed chore(deps): lock file maintenance (#18082)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2022-10-10 21:47:23 -07:00
Rhys Arkins 95339bde33 refactor: use containerbase terminology (#18023) 2022-09-28 17:09:28 +02:00
Michael Kriese 41894744ff feat(manager/npm): full pnpm buildpack support (#16989) 2022-08-05 14:29:33 +00:00
Michael Kriese 3b699e9f7e feat(manager/npm): prepare for buildpack support (#16979)
* feat(manager/npm): prepare for buildpack support

* chore: fixes
2022-08-04 21:18:43 +02:00
Michael Kriese 6c78237993 test: simplify exec mock (#16698) 2022-07-22 07:42:30 +00:00
Gabriel-Ladzaretti 6202b1c264 refactor(util/exec): change mocked modules in existing tests (#16519) 2022-07-11 11:41:24 +02:00
Rhys Arkins 456b2c0d86 feat(pnpm): detect v7 support when updating lock file (#15470)
* feat(pnpm): detect v7 support when updating lock file

* fix type check

* refactor: test
2022-05-05 16:13:50 +02:00
Michael Kriese 9f53724d90 feat(manager:npm): use local fs api (#15294) 2022-04-25 15:41:10 +02:00
Michael Kriese 868ebbef63 refactor(manager): final strict null checks (#15185)
* refactor(manager): final strict null checks

* refactor: fix type issues

* test: fix mocking
2022-04-20 08:40:20 +02:00
Michael Kriese 64f5bd5f03 test: enforce lint style rules (#15085) 2022-04-12 14:49:49 +00:00
StinkyLord b79c82e206 fix(manager/npm): use root pnpm constraints for workspaces (#14660)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2022-04-08 07:14:25 +00:00
Rhys Arkins dca3418bbd refactor: lib/modules (#14488)
Moves datasource, manager, platform and versioning code from lib/ into new lib/modules/

BREAKING CHANGE: External tools must update paths to datasource, manager, platform and versioning
2022-03-04 09:04:02 +01:00