Skip to content

chore(UI): Move to pnpm - #18797

Merged
roidelapluie merged 1 commit into
prometheus:mainfrom
roidelapluie:roidelapluie/pnpm
Jun 16, 2026
Merged

roidelapluie merged 1 commit into
prometheus:mainfrom
roidelapluie:roidelapluie/pnpm

Conversation

@roidelapluie

@roidelapluie roidelapluie commented May 26, 2026 •

Copy link
Copy Markdown
Member

Moving UI to PNPM.

  • Modern tooling: pnpm is actively developed and has become the standard choice for large JavaScript/TypeScript projects.
  • Safer script execution: pnpm does not run lifecycle scripts from dependencies by default, reducing supply-chain attack surface.
  • Strict dependency isolation: packages can only access their declared dependencies, preventing accidental reliance on hoisted transitive packages ( a couple of issues were found ).
  • Efficient storage: pnpm uses a content-addressable store and hard links, so disk usage is lower when multiple projects share packages.
  • Faster installs: the store-based model avoids redundant downloads and speeds up both local and CI installs - useful when working with worktrees.
NONE

@roidelapluie
roidelapluie marked this pull request as draft May 26, 2026 15:20
@roidelapluie roidelapluie reopened this Jun 1, 2026
@roidelapluie
roidelapluie force-pushed the roidelapluie/pnpm branch 5 times, most recently from 87b859b to 13dfb93 Compare June 4, 2026 15:22
@roidelapluie
roidelapluie force-pushed the roidelapluie/pnpm branch 3 times, most recently from 314751e to f5b42a1 Compare June 11, 2026 12:06
Switch the UI workspace from npm to pnpm. Declare jest as a direct
devDependency in lezer-promql (pnpm's strict isolation requires every
binary to be an explicit dependency), fix the moduleNameMapper path in
codemirror-promql's jest config to reflect pnpm's per-package
node_modules layout, and add a localStorage mock to mantine-ui's test
setup so module-level Redux slice initializers work under Node.js v22+,
which pre-defines localStorage as undefined on globalThis.

Signed-off-by: Julien Pivotto <[email protected]>
@roidelapluie
roidelapluie marked this pull request as ready for review June 11, 2026 12:16

@juliusv juliusv left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok to me I think, but I know very little about npm / pnpm. @Nexucis is the expert on the packaging stuff, does this look good to you too? :)

@Nexucis Nexucis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have the same question as Julius ;). But otherwise yeah it looks good to me.

The only thing that is a little bit annoying is that now to build Prometheus we need another tool. So anyone currently contributing to Prometheus will see their build failed because they don't have pnpm

@roidelapluie
roidelapluie merged commit f8b921c into prometheus:main Jun 16, 2026
35 checks passed
krajorama added a commit that referenced this pull request Jun 22, 2026
checkPackage read each workspace package's version via `pnpm run env | grep
npm_package_version`, an npm-ism. pnpm has no built-in `env` script, so it
fails with ERR_PNPM_NO_SCRIPT and returns an empty string, making
`ui_release.sh --check-package` report a false version mismatch for every
package.

Read the version with `pnpm pkg get version` instead. Leftover from the
npm-to-pnpm migration (#18797).

Signed-off-by: György Krajcsovits <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
krajorama added a commit that referenced this pull request Jun 22, 2026
…18993)

Since the npm-to-pnpm migration (#18797), react-app is a separate pnpm project
with its own web/ui/react-app/node_modules, while `npm_licenses` only scanned the
workspace's web/ui/node_modules. The old react-app UI is still embedded in the
binary (served via --enable-feature=old-ui), so its dependencies (bootstrap,
jquery, reactstrap, moment, etc.) are distributed but their licenses were dropped
from npm_licenses.tar.bz2.

Scan react-app's node_modules too. ui-install already installs it, so the path
exists at build time. The tarball grows from ~626 to ~1992 license files.

Signed-off-by: György Krajcsovits <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
machine424 added a commit to machine424/prometheus that referenced this pull request Jul 27, 2026
ALSO

ui: add pnpm dedupe to npm-deps update script

The move to pnpm (prometheus#18797) introduced strict dependency isolation.
When npm-check-updates bumps deps independently per workspace, pnpm
can resolve duplicate versions of the same package. This happened
with @codemirror/state (6.7.0 and 6.7.1) after running
`make update-npm-deps`, causing TypeScript build failures:

  src/lint/hybrid.ts(23,33): error TS2345:
    'import(".../@codemirror[email protected]/...").EditorState'
    is not assignable to
    'import(".../@codemirror[email protected]/...").EditorState'.
    Types have separate declarations of a private property 'flags'.

npm avoided this by hoisting into a flat node_modules. Add
`pnpm dedupe` after `pnpm install` to collapse compatible duplicates.

Signed-off-by: Ayoub Mrini <[email protected]>
machine424 added a commit to machine424/prometheus that referenced this pull request Jul 27, 2026
ALSO

ui: add pnpm dedupe to npm-deps update script

The move to pnpm (prometheus#18797) introduced strict dependency isolation.
When npm-check-updates bumps deps independently per workspace, pnpm
can resolve duplicate versions of the same package. This happened
with @codemirror/state (6.7.0 and 6.7.1) after running
`make update-npm-deps`, causing TypeScript build failures:

  src/lint/hybrid.ts(23,33): error TS2345:
    'import(".../@codemirror[email protected]/...").EditorState'
    is not assignable to
    'import(".../@codemirror[email protected]/...").EditorState'.
    Types have separate declarations of a private property 'flags'.

npm avoided this by hoisting into a flat node_modules. Add
`pnpm dedupe` after `pnpm install` to collapse compatible duplicates.

Signed-off-by: Ayoub Mrini <[email protected]>
machine424 added a commit to machine424/prometheus that referenced this pull request Jul 27, 2026
ALSO

ui: add pnpm dedupe to npm-deps update script

The move to pnpm (prometheus#18797) introduced strict dependency isolation.
When npm-check-updates bumps deps independently per workspace, pnpm
can resolve duplicate versions of the same package. This happened
with @codemirror/state (6.7.0 and 6.7.1) after running
`make update-npm-deps`, causing TypeScript build failures:

  src/lint/hybrid.ts(23,33): error TS2345:
    'import(".../@codemirror[email protected]/...").EditorState'
    is not assignable to
    'import(".../@codemirror[email protected]/...").EditorState'.
    Types have separate declarations of a private property 'flags'.

npm avoided this by hoisting into a flat node_modules. Add
`pnpm dedupe` after `pnpm install` to collapse compatible duplicates.

Signed-off-by: Ayoub Mrini <[email protected]>
machine424 added a commit to machine424/prometheus that referenced this pull request Jul 27, 2026
ALSO

ui: add pnpm dedupe to npm-deps update script

The move to pnpm (prometheus#18797) introduced strict dependency isolation.
When npm-check-updates bumps deps independently per workspace, pnpm
can resolve duplicate versions of the same package. This happened
with @codemirror/state (6.7.0 and 6.7.1) after running
`make update-npm-deps`, causing TypeScript build failures:

  src/lint/hybrid.ts(23,33): error TS2345:
    'import(".../@codemirror[email protected]/...").EditorState'
    is not assignable to
    'import(".../@codemirror[email protected]/...").EditorState'.
    Types have separate declarations of a private property 'flags'.

npm avoided this by hoisting into a flat node_modules. Add
`pnpm dedupe` after `pnpm install` to collapse compatible duplicates.

Signed-off-by: Ayoub Mrini <[email protected]>
machine424 added a commit to machine424/prometheus that referenced this pull request Jul 28, 2026
ALSO

ui: add pnpm dedupe to npm-deps update script

The move to pnpm (prometheus#18797) introduced strict dependency isolation.
When npm-check-updates bumps deps independently per workspace, pnpm
can resolve duplicate versions of the same package. This happened
with @codemirror/state (6.7.0 and 6.7.1) after running
`make update-npm-deps`, causing TypeScript build failures:

  src/lint/hybrid.ts(23,33): error TS2345:
    'import(".../@codemirror[email protected]/...").EditorState'
    is not assignable to
    'import(".../@codemirror[email protected]/...").EditorState'.
    Types have separate declarations of a private property 'flags'.

npm avoided this by hoisting into a flat node_modules. Add
`pnpm dedupe` after `pnpm install` to collapse compatible duplicates.

Signed-off-by: Ayoub Mrini <[email protected]>
machine424 added a commit that referenced this pull request Jul 28, 2026
ALSO

ui: add pnpm dedupe to npm-deps update script

The move to pnpm (#18797) introduced strict dependency isolation.
When npm-check-updates bumps deps independently per workspace, pnpm
can resolve duplicate versions of the same package. This happened
with @codemirror/state (6.7.0 and 6.7.1) after running
`make update-npm-deps`, causing TypeScript build failures:

  src/lint/hybrid.ts(23,33): error TS2345:
    'import(".../@codemirror[email protected]/...").EditorState'
    is not assignable to
    'import(".../@codemirror[email protected]/...").EditorState'.
    Types have separate declarations of a private property 'flags'.

npm avoided this by hoisting into a flat node_modules. Add
`pnpm dedupe` after `pnpm install` to collapse compatible duplicates.

Signed-off-by: Ayoub Mrini <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants