Migrate package manager from yarn to npm#6216
Open
pawelangelow wants to merge 25 commits into
Open
Conversation
First step of the yarn -> npm migration: translate the `resolutions`
blocks to npm `overrides` in the four core package.json files (root,
redisinsight, redisinsight/api, redisinsight/ui).
Syntax-only translation; no dependency versions change, so npm forces
the same versions yarn did:
- `**/pkg` and bare `pkg` -> top-level override (applies at every depth)
- `parent/pkg` -> nested `{ "parent": { "pkg": ... } }`
- deep paths preserved (react-router-dom > react-router > path-to-regexp)
- `@elastic/eui/**/prismjs` -> `{ "@elastic/eui": { "prismjs": ... } }`
- api: duplicate `**/form-data` + `form-data` merged into one entry
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Continue the yarn -> npm migration: rewrite package.json scripts to run
via npm instead of yarn (root, api, desktop, ui). Behaviour unchanged.
- `yarn --cwd <dir> <script>` -> `npm run <script> --prefix <dir>`
- same-package `yarn <script>` / `yarn run <script>` -> `npm run <script>`
- args after the script name now pass through `--`, e.g.
`yarn --cwd ui build --emptyOutDir`
-> `npm run build --prefix redisinsight/ui -- --emptyOutDir`
`yarn typeorm migration:run` -> `npm run typeorm -- migration:run`
- updated the tscheck hint strings handed to ts-error-check.ts
The root `postinstall` still references yarn-deduplicate; it is cleaned
up in a follow-up commit together with the yarn-only devDependencies.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Remove the yarn-only pieces now that scripts run through npm: - postinstall: drop the `&& skip-postinstall || yarn-deduplicate yarn.lock` tail, leaving `patch-package && vite optimize` - devDependencies: remove `yarn-deduplicate`, `skip-postinstall`, `postinstall-postinstall` (all only existed to support the yarn postinstall/dedupe flow) - engines: drop the `yarn` requirement and raise `npm` to `>=8.3.0` (the minimum that supports the `overrides` field) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Pin the `sass` alias to the exact version yarn.lock resolves (`npm:sass-embedded@1.75.0`). Without a version, npm re-resolves the alias to the latest sass-embedded on install (observed drift to 1.100.0), which is a silent behaviour change and also drops sass's transitive `buffer-builder`. Deliberately does NOT add a separate `sass-embedded` dependency: yarn only had the `sass` alias (node_modules/sass), so Vite resolves it via the legacy Sass API. Adding sass-embedded directly would switch Vite to the modern compile API — a behaviour change we are avoiding to keep the migration faithful. 1.75.0 predates the @import/mixed-decls/legacy-js-api deprecation warnings, so no warnings surface at this version. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add `.npmrc` with `legacy-peer-deps=true` at the root, redisinsight/ and redisinsight/api/ (the core install dirs). This reproduces yarn's lenient peer-dependency resolution; @elastic/eui@34.6.0 declares legacy peers (e.g. @types/react@^16) that otherwise conflict with React 18 under npm. - .gitignore: stop ignoring `.npmrc` so the files are tracked - remove `.yarnrc` (yarn-only config) .npmrc for the ui/src/packages/* plugin dirs is deferred pending the plugin install-scope decision. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Seed the root lockfile from yarn.lock (synp) and reconcile with `npm install --package-lock-only --ignore-scripts --legacy-peer-deps`, so npm reproduces yarn's exact tree instead of resolving fresh. Resolve the override/direct-dependency conflicts npm surfaced (EOVERRIDE), documented in docs/npm-migration-decisions.md: - semver: pin override + direct dep to exact 7.7.2 (yarn collapsed all semver to 7.7.2; dropping the override drifted to 5 versions) - styled-components: drop redundant override (direct ^5.0.0 already caps <6; both resolve 5.3.11) - @types/react, @types/react-dom: pin direct devDeps to exact 18.2.1 to match the 18.2.1 override Verified: zero version drift and zero unexpected removals vs yarn.lock (only the intentionally removed yarn-only devDeps and npm: alias false-positives differ). yarn.lock is kept until the CI cutover. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Seed from api yarn.lock (synp) and reconcile with `npm install --package-lock-only --ignore-scripts --legacy-peer-deps`. No package.json changes were needed: the api overrides had no direct-dependency conflicts, and seeding preserved yarn's versions (e.g. semver stayed at 7.5.4 rather than floating off the ^7.5.2 floor). Verified against yarn.lock: - npm introduced ZERO new versions (every difference is npm collapsing redundant duplicate versions yarn kept; npm's set is a subset of yarn's, all within range) - the cpu-features file: stub is materialised - no unexpected removals (only dedup byproducts and npm: alias false-positives) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add the missing lockfile for the redisinsight/ desktop workspace (the prototype deleted its yarn.lock without generating a package-lock). Method note: synp requires an existing node_modules to seed, and redisinsight/ has none, so the lockfile was produced by `npm install --package-lock-only --ignore-scripts --legacy-peer-deps` and its fidelity verified against yarn.lock by diff instead: - NEW versions introduced by npm: NONE - semver 7.5.4, better-sqlite3 12.10.1, keytar 7.9.0, tunnel-ssh 5.1.2, ssh2 1.16.0 all match yarn exactly - cpu-features file: stub materialised Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
`npm install --package-lock-only` produced lockfiles missing the optional platform-specific native binaries (@esbuild/*, @rollup/*, @swc/*, @sentry/cli-*, @msgpackr-extract/*) for non-host OSes, so `npm ci` rejected them (EUSAGE "Missing ... from lock file"). CI runs npm ci, so this would have failed there too. Finalised by running a real `npm install`, which records every platform variant (with os/cpu) — the same set yarn.lock had: - root: +97 platform binaries - api: +25 platform binaries; npm also deduped 9 more @babel/browserslist duplicates than --package-lock-only did Verified: `npm ci --dry-run` now passes in root, api and redisinsight, and there are no new versions vs yarn (only alias naming artifacts such as sass -> sass-embedded). redisinsight/package-lock.json was unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Convert the yarn `resolutions` blocks to npm `overrides` in the 6
Workbench plugin packages under redisinsight/ui/src/packages/
(clients-list, geodata, redisearch, redisgraph, redistimeseries-app,
ri-explain). Same glob->nested translation as the core packages;
syntax-only, no version changes. The `@elastic/eui/**/prismjs` entries
become nested `@elastic/eui: { prismjs }` overrides (eui is a direct dep,
but the override targets its child, so no EOVERRIDE).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add package-lock.json and .npmrc (legacy-peer-deps=true) for the plugin aggregate and all 6 sub-plugins under redisinsight/ui/src/packages/. These dirs have no node_modules, so synp can't seed them; lockfiles were produced by a real `npm install` (aggregate first, so its node_modules/ vite satisfies the plugins' "vite": "file:../node_modules/vite" link) and verified against each yarn.lock: zero new versions (the only diff is the redisinsight-plugin-sdk file: dep, a naming artifact). `.npmrc` is required because @elastic/eui@34.6.0's legacy peers otherwise ERESOLVE against React 18. `npm run build` builds all plugins cleanly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the yarn plugin install/build calls with npm:
- `yarn --cwd <plugin>` -> `npm install --prefix <plugin>` (aggregate
first, then each sub-plugin, preserving the order the file: vite link
needs)
- `yarn --cwd "${PACKAGES_DIR}" build` -> `npm run build --prefix ...`
Verified end to end: all 6 plugins install and build via npm.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Delete all 10 yarn.lock files now that every dir has a verified package-lock.json (root, redisinsight, api, and the 7 plugin packages). They remain recoverable from git history until the CI/Docker cutover is confirmed green. Fidelity verified before removal: the no-new-versions gate passes in all 10 dirs (npm introduced no version yarn.lock did not already have; differences are npm deduping duplicates plus file:/alias naming artifacts), npm ci --dry-run passes, patch-package applies, and the app + plugins build/run on npm. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- install-deps action: `yarn install --frozen-lockfile` -> `npm ci` (honours the skip-postinstall input via `npm ci --ignore-scripts`) - install-all-build-libs: cache key + hashFiles use package-lock.json; generate:api-client runs via `npm run ... --prefix` - workflows (lint, licenses-check, i18n, type-check, tests-frontend, tests-backend, tests-e2e-playwright-chromium, pipeline-build-*): `yarn <script>` -> `npm run <script>`, `yarn --cwd X Y` -> `npm run Y --prefix X`, args passed via `--` - tests.yml path filter: yarn.lock/.yarnrc -> package-lock.json/.npmrc - type-check.yml: plugin cache key hashes package-lock.json; root .bin is still exposed on PATH (npm --prefix only surfaces the sub-dir bin) Edit-and-review: validate on a test push (CI not runnable locally). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Dockerfile: COPY package-lock.json; root install `npm ci --ignore-scripts && npx patch-package` (skip vite optimize, keep patches); api installs via `npm ci [--omit=dev] --prefix` - build.sh: `yarn` -> `npm ci`, build scripts -> `npm run` - build_modules.sh: prod installs -> `npm ci --omit=dev`; the post-jq-surgery install uses `npm install --omit=dev` (lockfile intentionally out of sync then); restore package-lock.json - build-statics.cmd: plugin installs/build -> npm (Windows twin of .sh) - generate-api-client.js: spawn npm instead of yarn - remove redisinsight/api/.yarnclean.prod Dropped `yarn autoclean` (no npm equivalent) in Docker + build_modules; release artifacts/image are slightly larger. Flagged in-file as a node-prune follow-up. Edit-and-review: validate on a test build. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- api test.Dockerfile: COPY package-lock.json, `RUN npm ci`, CMD `npm run test:api:ci:cov` (postinstall still applies patches; client gen stays skipped via SKIP_API_CLIENT_GEN=1) - tests/e2e static-server.Dockerfile: `yarn add express` -> `npm install express` - postinstall-generate-client.js: retry message + comment reference npm Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- docs/npm-migration-plan.md: the full yarn->npm migration plan, rules, and findings (single self-contained reference) - scripts/lock-diff.js: compares yarn.lock vs package-lock.json to detect removed/added packages; exits non-zero on genuine removals so it can gate a migration Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Convert all yarn command examples to npm (dev/test/lint/type-check/ tscheck), and rewrite the dependency/lockfile-management section: npm install + package-lock.json, CI runs npm ci, npm install/uninstall for dependency changes. Drops the obsolete yarn-deduplicate postinstall note. CLAUDE.md is a symlink to AGENTS.md, so both are covered. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Convert yarn command references to npm across: - CONTRIBUTING.md, .ai/skills/* (type-check-baselines, i18n, code-quality, tsconfigs, redis-insight-plugin + references/templates), .ai/commands - plugin + api/i18n/e2e READMEs - config-comment hints (i18next.config.mjs, .gitignore, .eslintignore, openapi-ts.config.ts) `yarn --cwd X` -> `npm run ... --prefix X`, `yarn <script>` -> `npm run <script>`, `yarn install --frozen-lockfile` -> `npm ci`, `yarn add` -> `npm install`. Workspace-binary note reworded for npm (root .bin still needed on PATH). Intentional ".npmrc mirrors yarn's lenient resolution" rationale comments left as-is. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The re-st, re-clu, re-crdt, and oss-st-6-tls-auth-ssh integration-test compose files ran the API test suite via a wait-for-it command array ending in ['yarn', 'test:api:ci:cov']; switch to ['npm', 'run', 'test:api:ci:cov']. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Leftovers found by a repo-wide audit (no lockfile hand-edits): - install-all-build-libs action: remove the obsolete "verify yarn.lock unchanged after install" step (it guarded yarn-deduplicate's in-place rewrite; npm ci never mutates the lockfile and yarn.lock is gone) - postinstall-generate-client.js: spawn `npm run generate:api-client` instead of `yarn generate:api-client` - .vscode/launch.json: debug API config runs via npm - .gitignore x3: drop yarn-debug/error.log patterns (npm-debug.log kept) - decisions doc: document why lockfile `resolved` URLs keep registry.yarnpkg.com (faithful seed artifact; do not hand-edit) Lockfiles are intentionally left as `npm install` produced them; the registry.yarnpkg.com URLs are functional and must not be hand-swapped. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This reverts commit 4ce478e. The migration execution plan and the one-off lock-diff verification script are process artifacts and don't belong in production code. Also drop the now-dangling npm-migration-plan.md link from the decisions doc. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The Docker builds copied package.json + package-lock.json but not .npmrc, so `npm ci` ran without legacy-peer-deps=true and failed with ERESOLVE on @elastic/eui@34.6.0's legacy react@^16 peer vs React 18 (main Dockerfile), and would hit the same on the api test image (@mochajs/json-file-reporter). Copy .npmrc before the root/api npm ci. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Don't enumerate specific packages/peers in the Dockerfile comment; just note that legacy peer resolution is required. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Code Coverage - Backend unit tests
Test suite run success3686 tests passing in 321 suites. Report generated by 🧪jest coverage report action from 6c033ce |
Contributor
Code Coverage - Integration Tests
|
Contributor
Code Coverage - Frontend unit tests
Test suite run success7829 tests passing in 865 suites. Report generated by 🧪jest coverage report action from 6c033ce |
pawelangelow
marked this pull request as ready for review
July 16, 2026 17:51
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0600efe140
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Migrates the entire repo from Yarn to npm — all package directories plus CI, Docker,
build scripts, docker-compose, and docs. Behaviour-preserving: no dependency versions
change.
Dependencies (all 10 package dirs: root,
redisinsight,redisinsight/api, and the7
ui/src/packages/*plugins):resolutions→ npmoverrides(glob → nested syntax); resolved 4EOVERRIDEdirect-dependency conflicts (
semver,styled-components,@types/react[-dom])package-lock.jsonseeded fromyarn.lock(viasynp) then finalized withnpm install, so npm reproduces yarn's exact tree — verified zero new versionsvs
yarn.lockin every dir, andnpm ci --dry-runpasses.npmrcwithlegacy-peer-deps=trueper dir (mirrors yarn's lenient peer resolution;required by
@elastic/eui@34.6.0vs React 18)sassalias pinned to yarn's version;enginesdrop yarn / requirenpm >=8.3.0;removed
yarn-deduplicate/skip-postinstall/postinstall-postinstall; simplifiedpostinstall; deletedyarn.lockand.yarnrcScripts / CI / Docker:
package.jsonscripts:yarn --cwd X Y→npm run Y --prefix Xyarn install --frozen-lockfile→npm ciDockerfile,build.sh,build_modules.sh,build-statics.{sh,cmd}, testDockerfiles, and integration-test
docker-compose.ymlfiles → npm.ai/skills/*command examples → npmKnown behaviour change:
yarn autocleanhas no npm equivalent, so it was dropped —release artifacts / Docker image are slightly larger. Flagged in-file as a
node-prunefollow-up.
Testing
Local (all pass):
npm ciin root,redisinsight/api,redisinsight→ app installs;postinstall(patch-package + vite optimize) runs clean
npm run type-check,npm run lint,npm test,npm run test:apinpm run build:statics(installs + builds all 7 plugins),npm run dev:desktopCI: verify the workflows on this PR (backend, frontend, e2e, type-check, builds) — the
CI/Docker conversion can only be validated on a real run.
Note
High Risk
This touches every install, CI job, Docker image, and release build path; a missed
yarnreference or lockfile drift will break pipelines, and droppingyarn autocleanchanges artifact size.Overview
This PR replaces Yarn with npm across the repo while aiming to keep the same dependency tree and app behavior.
Tooling and lockfiles: Yarn
resolutionsbecome npmoverrides(with documented pins forsemver,@types/react*, etc. indocs/npm-migration-decisions.md).package-lock.jsonfiles replaceyarn.lock;.yarnrcis removed. Root and per-package.npmrcsetlegacy-peer-deps=trueto mirror Yarn’s peer handling. Scripts move fromyarn/yarn --cwdtonpm run/npm run … --prefix.CI, Docker, and release: Composite actions and workflows use
npm ci(andnpm ci --ignore-scriptswhen postinstall must be skipped). Cache keys hashpackage-lock.jsoninstead ofyarn.lock. The post-installyarn-deduplicatelockfile check is removed.Dockerfile,.github/build/*, and platform package pipelines invoke npm;yarn autocleanis dropped (noted as larger release/Docker artifacts).Docs and developer UX:
AGENTS.md,CONTRIBUTING.md,.ai/skills/*, VS Code launch config, and plugin deploy templates are updated to npm commands..gitignorestops ignoring.npmrcso peer-dep settings are committed. The tests workflow infra path filter watchespackage-lock.jsonand.npmrcinstead of Yarn files.Reviewed by Cursor Bugbot for commit 6c033ce. Bugbot is set up for automated code reviews on this repo. Configure here.