Skip to content

Conversation

@flevi29
Copy link
Collaborator

@flevi29 flevi29 commented Dec 13, 2025

Pull Request

What does this PR do?

  • migrated from yarn to pnpm, adapted code and config
  • cleaned up dependencies
    • moved most development dependencies into main package.json, to avoid duplicates with different versions
    • updated Vite, Vitest, Prettier, Changesets, and maybe other development dependencies
  • removed dependabot auto merge, because it's unmaintained, and soon the feature it relies on is getting deprecated
  • removed remaining references to "@meilisearch/geo-playground"

Summary by CodeRabbit

  • Chores

    • Migrated project tooling and docs from Yarn to PNPM (workspaces, scripts, CI, docs).
    • Added a reusable CI action to set up Node and install dependencies.
    • Added PNPM workspace manifest and consolidated workspace dependency resolution.
    • Swapped CI/test commands to PNPM and expanded Node.js test matrix to 20, 22, 24.
    • Updated READMEs and playgrounds to use PNPM commands.
  • Removed

    • Removed Dependabot auto-merge workflow.
    • Replaced several third‑party autocomplete packages with the integrated Meilisearch solution.

✏️ Tip: You can customize this high-level summary in your review settings.

@changeset-bot
Copy link

changeset-bot bot commented Dec 13, 2025

⚠️ No Changeset found

Latest commit: 648f763

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link

coderabbitai bot commented Dec 13, 2025

Walkthrough

Add a pnpm workspace, migrate CI/docs/manifests from Yarn→pnpm, add a reusable composite GitHub Action to set up Node and run pnpm install, convert many package deps to workspace:*, and update meilisearch imports to use @meilisearch/instant-meilisearch with constructor changes.

Changes

Cohort / File(s) Summary
GitHub Action (new composite)
.github/actions/set-up-node/action.yml
New composite action: installs pnpm, runs actions/setup-node (inputs: node-version, registry-url), enables pnpm cache, then pnpm install --frozen-lockfile.
Workflows (CI → pnpm & reuse action)
.github/workflows/tests.yml, .../pre-release-tests.yml, .../meilisearch-prototype-tests.yml, .../publish.yml
Replaced explicit Node/Yarn setup with the local composite action; swapped yarn→pnpm commands; expanded Node matrix to ['20','22','24'] and renamed matrix key to node-version.
Dependabot & auto-merge
.github/dependabot.yml, .github/workflows/dependabot-auto-merge.yml
Normalized dependabot YAML and grouping patterns; removed the Dependabot auto-merge workflow.
PNPM workspace & changesets
pnpm-workspace.yaml, .changeset/config.json
Added pnpm-workspace.yaml (workspace globs, settings); removed @meilisearch/geo-playground from changeset ignore list.
Root package & configs
package.json, vite.config.ts, eslint.config.js
Switched declared package manager and scripts to pnpm, adjusted Vitest discovery (workspaceprojects), and disabled vitest/no-conditional-expect in ESLint.
Docs & contributing
CONTRIBUTING.md, packages/*/README.md, playgrounds/*/README.md
Replaced Yarn examples with pnpm equivalents across docs and contributing guide.
Playgrounds manifests
playgrounds/*/package.json (autocomplete, local-react, react, vue3, javascript, node-env)
Converted many deps to workspace:*, removed several direct framework/Algolia deps, and updated e2e/test scripts to use pnpm (e.g., pnpm dev).
Packages manifests
packages/autocomplete-client/package.json, packages/instant-meilisearch/package.json
Replaced some deps with workspace:* and removed unused devDependencies.
Imports & runtime updates
packages/autocomplete-client/__tests__/test.utils.ts, playgrounds/autocomplete/setup.mjs, playgrounds/local-react/setup.mjs, playgrounds/node-env/index.js
Switched imports from meilisearch@meilisearch/instant-meilisearch; updated constructor usage to new meilisearch.MeiliSearch(...); adjusted index operations to use .delete().waitTask() / .addDocuments(...).waitTask().
Tests & mocks adjustments
packages/instant-meilisearch/__tests__/*
Test updates: module mock refactor to per-instance spy, function expression vs arrow change, and TypeScript expect suppressions in numeric filter tests.
Minor styling/formatting
playgrounds/vue3/src/App.vue
CSS formatting only (font-family line breaks).

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Review composite action inputs and pnpm cache integration in workflows.
  • Confirm all CI/workflow yarn→pnpm substitutions and updated matrix variable names.
  • Verify pnpm-workspace.yaml globs align with workspace:* dependency changes.
  • Validate meilisearch import/constructor changes and the .waitTask() chaining in setup scripts and tests.
  • Inspect test mock refactor (per-instance spy) and TypeScript suppressions for correctness.

Suggested reviewers

  • Strift

Poem

"I’m a rabbit with a tiny pack,
swapping yarn for pnpm on the track,
workspaces nested, actions neat,
CI hops forward on quick feet,
commits like carrots — small and sweet." 🐇

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Switch from yarn to pnpm package manager' directly and accurately describes the main change across the PR: migrating the entire project from yarn to pnpm.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch yarn-to-pnpm

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 8

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (5)
packages/instant-meilisearch/README.md (1)

138-141: Avoid publishing realistic-looking API keys in README examples; use a placeholder + explicit warning. This reduces accidental leakage / copy-paste of privileged credentials.

-  'a63da4928426f12639e19d62886f621130f3fa9ff3c7534c5d179f0f51c4f303' // API key
+  'MEILISEARCH_SEARCH_API_KEY' // API key (use a search-only key; never expose admin/master keys)

Also applies to: 168-171

playgrounds/autocomplete/README.md (1)

1-1: README title likely wrong for this playground (# React Playground). Consider renaming to match “Autocomplete Playground” to avoid confusion.

packages/autocomplete-client/README.md (1)

91-95: Remove/replace the hard-coded API key in docs (treat as leaked secret).
Even if it’s “just an example”, it’s a real-looking key and will get scraped/copy-pasted. Use a placeholder and call out “search-only key”.

-  apiKey: 'a63da4928426f12639e19d62886f621130f3fa9ff3c7534c5d179f0f51c4f303'  // API key
+  apiKey: '<YOUR_SEARCH_API_KEY>' // Search-only key (never use master/admin keys in the browser)
playgrounds/local-react/package.json (1)

6-12: Document dev server dependency for local E2E testing.

The E2E tests reference baseUrl: http://localhost:5174 (from cypress.env.json), which requires the Vite dev server to be running. While CI handles this via cypress-io/github-action's start: pnpm playground:local-react, local developers running pnpm test:e2e will encounter flaky failures if the dev server is not already running. Add a note to CONTRIBUTING.md clarifying that developers must run pnpm dev before executing E2E tests, or update the test scripts to use start-server-and-test to automate this prerequisite.

playgrounds/autocomplete/package.json (1)

6-12: E2E tests require dev server to be running but turbo.json does not establish this dependency.

E2E tests expect the dev server at http://localhost:5173 (per cypress.env.json), yet the test:e2e task in turbo.json only depends on "build" and not on "dev". Running pnpm test:e2e will fail because cypress cannot connect to a non-existent dev server. The GitHub workflows work around this by explicitly starting the playground via the cypress-io/github-action, but local or standard CI execution will not have the dev server running.

Add "dev" as a dependency to both test:e2e and test:e2e:watch tasks in turbo.json to ensure the dev server starts before E2E tests run.

🧹 Nitpick comments (1)
playgrounds/local-react/README.md (1)

1-1: Optional: clarify the title to “Local React Playground” (currently generic).

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d3e9f7d and a3a92f7.

⛔ Files ignored due to path filters (2)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (22)
  • .github/actions/set-up-node/action.yml (1 hunks)
  • .github/dependabot.yml (1 hunks)
  • .github/workflows/dependabot-auto-merge.yml (0 hunks)
  • .github/workflows/meilisearch-prototype-tests.yml (3 hunks)
  • .github/workflows/pre-release-tests.yml (3 hunks)
  • .github/workflows/publish.yml (2 hunks)
  • .github/workflows/tests.yml (4 hunks)
  • CONTRIBUTING.md (7 hunks)
  • package.json (2 hunks)
  • packages/autocomplete-client/README.md (1 hunks)
  • packages/autocomplete-client/package.json (1 hunks)
  • packages/instant-meilisearch/README.md (1 hunks)
  • playgrounds/autocomplete/README.md (1 hunks)
  • playgrounds/autocomplete/package.json (2 hunks)
  • playgrounds/javascript/README.md (1 hunks)
  • playgrounds/local-react/README.md (1 hunks)
  • playgrounds/local-react/package.json (2 hunks)
  • playgrounds/node-env/package.json (1 hunks)
  • playgrounds/react/README.md (1 hunks)
  • playgrounds/react/package.json (1 hunks)
  • playgrounds/vue3/package.json (1 hunks)
  • pnpm-workspace.yaml (1 hunks)
💤 Files with no reviewable changes (1)
  • .github/workflows/dependabot-auto-merge.yml
🧰 Additional context used
🪛 LanguageTool
CONTRIBUTING.md

[grammar] ~164-~164: Use a hyphen to join words.
Context: ... for all affected packages. See more in depth explaination on [versioning](https...

(QB_NEW_EN_HYPHEN)


[grammar] ~164-~164: Ensure spelling is correct
Context: ...l affected packages. See more in depth explaination on [versioning](https://github.com/chan...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🪛 markdownlint-cli2 (0.18.1)
playgrounds/local-react/README.md

9-9: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

CONTRIBUTING.md

99-99: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


104-104: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

playgrounds/autocomplete/README.md

9-9: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

packages/autocomplete-client/README.md

57-57: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

playgrounds/react/README.md

9-9: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

playgrounds/javascript/README.md

9-9: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🔇 Additional comments (22)
playgrounds/vue3/package.json (1)

10-16: LGTM: workspace:* aligns with monorepo dependency resolution. Just ensure the workspace package exists / is included by the workspace globs.

packages/instant-meilisearch/README.md (1)

116-126: Docs update to pnpm add looks good.

playgrounds/react/package.json (1)

19-25: LGTM: workspace:* is the right move for a monorepo playground.

playgrounds/local-react/package.json (1)

22-24: workspace:* in a private playground devDependency looks good.

.github/dependabot.yml (1)

10-41: Dependabot grouping looks good; double-check monthly cadence is intentional.
Switching npm updates to monthly can increase drift/security exposure; if intended, LGTM.

playgrounds/autocomplete/package.json (1)

21-27: workspace:* dependency for the local playground is a good monorepo alignment.

CONTRIBUTING.md (1)

29-53: Docs command updates to pnpm look consistent.

packages/autocomplete-client/package.json (1)

43-45: The workspace protocol handling is already managed by your release tooling. The project uses @changesets/cli, which automatically converts workspace:* to actual semver versions during the changeset publish command (as configured in the root package.json release script). No additional changes are needed; this is the expected and proper configuration for monorepo publishing.

package.json (2)

27-28: Scripts and package manager correctly migrated to pnpm.

All yarn commands have been properly converted to pnpm equivalents. pnpm 10.25.0 is the latest version, and the packageManager field correctly specifies this for Corepack-based enforcement across all environments.

Also applies to: 30-31, 34-34, 36-36, 64-64


38-63: Verify that E2E tests function correctly after removing concurrently dependency.

The removal of the concurrently package aligns with the simplified E2E test execution pattern described in the PR (no concurrent dev server startup). Ensure that the test execution flow in the updated workflows accommodates the sequential or alternative startup approach.

.github/workflows/publish.yml (2)

30-34: Changesets commands properly updated to pnpm.

The publish and version commands are correctly converted from yarn to pnpm, maintaining the same semantics.


19-19: The ./.github/actions/set-up-node composite action is properly implemented and correctly handles all Node.js setup, pnpm caching, and registry configuration. No changes needed.

.github/workflows/pre-release-tests.yml (3)

45-45: Verify that the ./.github/actions/set-up-node composite action correctly accepts and uses the node-version input.

The action is now passed a node-version parameter via the with: block. Ensure the action properly configures the specified Node.js version before running tests.

Also applies to: 80-80, 118-118, 120-120


114-114: Node.js version matrix expanded to 20, 22, 24.

Node 18 has been removed from the test matrix. Confirm this aligns with your project's support policy—if Node 18 compatibility should still be maintained, it must remain in the matrix.

Also applies to: 115-115


52-52: pnpm commands correctly applied across test and playground execution.

All yarn references have been properly substituted with pnpm equivalents for playground startup and test execution.

Also applies to: 87-87, 122-122

.github/workflows/meilisearch-prototype-tests.yml (3)

47-47: Composite action usage and node-version parameter handling are consistent with other workflows.

These changes follow the same pattern as pre-release-tests.yml. Ensure the set-up-node action correctly handles the node-version input parameter.

Also applies to: 81-81, 118-118, 120-120


54-54: pnpm commands properly substituted across all test and playground invocations.

Yarn to pnpm migration is consistent with the broader PR changes.

Also applies to: 88-88, 122-122


114-114: Node.js version matrix aligned with pre-release-tests.yml (versions 20, 22, 24).

Confirm that dropping Node 18 aligns with your project's support policy.

Also applies to: 115-115

.github/workflows/tests.yml (4)

36-36: Composite action consistently used for Node.js and pnpm setup across all jobs.

The set-up-node action is applied uniformly to all test jobs. Verify its implementation handles node-version input and pnpm cache correctly.

Also applies to: 80-80, 127-127, 141-141, 153-153


41-41: Clarify the wait-on configuration for cypress-autocomplete-client-run.

Line 41 specifies wait-on: 'http://localhost:7700,http://localhost:5173', whereas the cypress-instant-meilisearch-run job (line 85) only waits for http://localhost:7700. The inclusion of port 5173 (Vite dev server) appears inconsistent with the PR's goal of simplifying E2E test execution by removing concurrent dev server startup. Verify whether the Vite dev server on port 5173 is required for the autocomplete playground tests or if this can be removed.

Also applies to: 43-43, 87-87


131-131: pnpm commands uniformly applied across all test jobs.

All yarn references have been correctly converted to pnpm for test execution, build steps, and playground startup.

Also applies to: 135-135, 143-143, 155-155


123-123: Node.js version matrix expanded to 20, 22, 24; Node 18 removed.

Confirm this aligns with your project's Node.js support policy. If Node 18 compatibility is still required, it must be added back to the matrix.

Also applies to: 124-124

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
packages/autocomplete-client/__tests__/test.utils.ts (1)

2-2: Verify the meilisearch.MeiliSearch constructor is part of the supported public API (and keep it DRY).
If meilisearch is an implementation detail/re-export, this could break with package updates; also you can reuse HOST/API_KEY to avoid config drift between clients.

-const meilisearchClient = new meilisearch.MeiliSearch({
-  host: 'http://localhost:7700',
-  apiKey: 'masterKey',
-})
+const meilisearchClient = new meilisearch.MeiliSearch({
+  host: HOST,
+  apiKey: API_KEY,
+})

Also applies to: 15-18

playgrounds/autocomplete/package.json (1)

6-12: E2E scripts no longer start the dev server—verify CI/docs cover the new contract.
If the intent is “run Cypress against an already-running Vite server,” this is OK, but it’s a behavioral change that can surprise local users unless workflows/docs clearly start pnpm dev (or similar) beforehand.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a3a92f7 and 272c15e.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (7)
  • packages/autocomplete-client/__tests__/test.utils.ts (2 hunks)
  • playgrounds/autocomplete/package.json (2 hunks)
  • playgrounds/autocomplete/setup.mjs (1 hunks)
  • playgrounds/local-react/setup.mjs (1 hunks)
  • playgrounds/node-env/index.js (1 hunks)
  • playgrounds/vue3/src/App.vue (1 hunks)
  • vite.config.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • playgrounds/vue3/src/App.vue
🧰 Additional context used
🧬 Code graph analysis (4)
playgrounds/autocomplete/setup.mjs (1)
playgrounds/local-react/setup.mjs (1)
  • client (5-8)
packages/autocomplete-client/__tests__/test.utils.ts (1)
packages/instant-meilisearch/__tests__/assets/utils.ts (1)
  • meilisearchClient (330-330)
playgrounds/local-react/setup.mjs (1)
playgrounds/autocomplete/setup.mjs (1)
  • client (4-7)
playgrounds/node-env/index.js (2)
packages/instant-meilisearch/src/client/instant-meilisearch-client.ts (1)
  • instantMeiliSearch (46-212)
playgrounds/react/src/App.jsx (1)
  • instantMeiliSearch (18-24)
🔇 Additional comments (4)
vite.config.ts (1)

4-7: The current test.projects: ['packages/*'] configuration is correct and follows Vitest best practices.

Vitest 3.0.2 (your repo's version) accepts glob patterns like packages/* to discover project directories. This glob is standard and properly matches the two packages in your repository. Both packages have vite.config.ts files, which Vitest auto-discovers without requiring separate vitest.config.ts files. The suggested change to packages/*/vitest.config.{ts,js,mjs,cjs} would not match any files in your setup and is unnecessary. The migration from the deprecated test.workspace to test.projects is also correctly applied.

Likely an incorrect or invalid review comment.

playgrounds/node-env/index.js (1)

1-4: Constructor switch looks consistent; verify Node runs this file as ESM (top-level await).
The meilisearch.MeiliSearch change matches the new import shape; just ensure this playground is executed in an environment where top-level await is valid for index.js (e.g., type: "module" or equivalent).

Also applies to: 11-14

playgrounds/local-react/setup.mjs (1)

1-1: LGTM; please sanity-check the @meilisearch/instant-meilisearch export shape in this repo’s pinned version.
This is a clean mechanical swap, but it depends on meilisearch being a stable named export and meilisearch.MeiliSearch being available.

Also applies to: 5-8

playgrounds/autocomplete/package.json (1)

21-30: workspace:* dependency wiring makes sense for a pnpm monorepo; verify publish boundaries.
Since this package is private it’s likely fine, but ensure nothing intended for publishing relies on workspace:* versions (and confirm @meilisearch/instant-meilisearch is always available in the workspace graph).

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
playgrounds/javascript/package.json (1)

14-16: Consider clarifying workspace dependency context in playground documentation.

The workspace:* protocol correctly resolves within the pnpm workspace (confirmed by config: pnpm-workspace.yaml includes playgrounds/* and packages/*). The dependency will fail clearly outside the workspace with an appropriate error, as designed. However, the CONTRIBUTING.md and playgrounds/javascript/README.md could explicitly mention that pnpm install must be run from the repository root (not the playground directory alone) for @meilisearch/instant-meilisearch to resolve. Adding a note like "Install from the workspace root: pnpm install" would prevent contributor confusion around the workspace:* dependency requirement.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 272c15e and 13e11e0.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (9)
  • .github/actions/set-up-node/action.yml (1 hunks)
  • eslint.config.js (1 hunks)
  • package.json (1 hunks)
  • packages/instant-meilisearch/__tests__/filter.test.ts (1 hunks)
  • playgrounds/autocomplete/package.json (2 hunks)
  • playgrounds/javascript/package.json (1 hunks)
  • playgrounds/local-react/package.json (2 hunks)
  • playgrounds/react/package.json (1 hunks)
  • playgrounds/vue3/package.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/instant-meilisearch/tests/filter.test.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • playgrounds/vue3/package.json
  • playgrounds/autocomplete/package.json
  • playgrounds/react/package.json
  • .github/actions/set-up-node/action.yml
🔇 Additional comments (5)
eslint.config.js (1)

90-100: Address the TODO to remove disabled vitest rules; no violations currently exist in the test suite.

The vitest/no-conditional-expect disable aligns with the existing TODO: Remove rules comment. Since no violations of this rule (or the other two disabled rules) were found across 27 test files, removing all three disables is safe and recommended:

  // Vitest
  {
    files: ['packages/*/{src,__tests__}/**/*.test.ts'],
    extends: [vitest.configs.recommended],
-   // TODO: Remove rules
-   rules: {
-     'vitest/no-identical-title': 'off',
-     'vitest/valid-title': 'off',
-     'vitest/no-conditional-expect': 'off',
-   },
  },

If removing all three causes test failures, enable the failing rule(s) selectively with inline // eslint-disable-next-line and a brief reason.

playgrounds/local-react/package.json (2)

6-12: Cypress scripts now assume workspace/root toolchain—verify turbo/pnpm filtering still works.
If CI/dev runs these via turbo test:e2e from the repo root, this is fine; but running the package in isolation may now fail unless the repo-level install is enforced. Consider documenting “run from repo root” (or adding a guard in scripts).


22-24: Dropping React/Vite deps here is OK only if intentionally centralized—please confirm no standalone install path.
Right now this playground depends on root workspace deps to build/run; if that’s the intent, LGTM—just ensure docs/CI reflect it and no tooling expects per-package installs.

package.json (2)

27-36: Scripts look consistent; verify they run correctly under pnpm in CI (esp. build chaining).
style/style:fix/test/test:watch/test:types/release now assume pnpm is the invoker; please ensure CI uses pnpm -w (or corepack pnpm) and that pnpm build (root script) behaves as expected across platforms.


73-73: CI already honors [email protected] via pnpm/action-setup.

The workflows use pnpm/action-setup@v4, which automatically respects the packageManager field in package.json without requiring explicit corepack or version configuration. The pinned version is enforced in CI.

For local development, consider documenting in CONTRIBUTING.md (or similar) that contributors should either enable corepack or explicitly install [email protected] to match the pinned version, avoiding accidental use of a different major version.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 16a218b and bf07f6c.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • package.json (1 hunks)
  • playgrounds/autocomplete/package.json (2 hunks)
🔇 Additional comments (3)
package.json (2)

26-27: LGTM! Script migrations are consistent.

The yarn-to-pnpm migrations across style, test, and release scripts are correctly implemented and maintain the same logical flow.

Also applies to: 29-30, 33-33, 35-35


73-73: No action needed—[email protected] is a valid and stable version.

The specified version (10.26.0) is the latest stable release, published 2 days ago. It was released on December 15 and is appropriate for use with Corepack.

playgrounds/autocomplete/package.json (1)

10-11: LGTM! Test scripts correctly migrated to pnpm.

The e2e test scripts now properly use pnpm dev instead of yarn dev, consistent with the package manager migration.

@flevi29 flevi29 changed the title Switch from yarn to pnpm pacakge manager Switch from yarn to pnpm package manager Dec 18, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/instant-meilisearch/__tests__/search-resolver.test.ts (1)

22-35: Critical: Tests are failing due to broken mock setup.

The pipeline shows 5 test failures with TypeError: () => value is not a constructor. The issue is that MeiliSearch needs to be mocked as a constructor, but the current setup doesn't achieve this correctly.

The pattern vi.mocked(MeiliSearch, true).mockReturnValue(...) doesn't work because:

  1. vi.mocked() is a type assertion helper, not a mock creator
  2. MeiliSearch is a class constructor that needs to be mocked with proper constructor semantics
🔎 Suggested fix for the mock setup:
 vi.mock('meilisearch')
 
-// Mocking of Meilisearch package
-const mockedMeilisearch = vi.mocked(MeiliSearch, true)
 const mockedMultiSearch = vi.fn(function (request) {
   const response = request.queries.map((req: MeiliSearchMultiSearchParams) => ({
     ...searchResponse,
     indexUid: req.indexUid,
   }))
   return {
     results: response,
   }
 })
 
-// @ts-ignore
-mockedMeilisearch.mockReturnValue({
-  multiSearch: mockedMultiSearch,
-})
+vi.mocked(MeiliSearch).mockImplementation(() => {
+  return {
+    multiSearch: mockedMultiSearch,
+  } as any
+})

Alternative approach using mockReturnValue on the constructor itself:

 vi.mock('meilisearch', () => {
   return {
-    MeiliSearch: vi.fn()
+    MeiliSearch: vi.fn().mockImplementation(() => ({
+      multiSearch: mockedMultiSearch,
+    }))
   }
 })
-
-const mockedMeilisearch = vi.mocked(MeiliSearch, true)
-// ...
-// @ts-ignore
-mockedMeilisearch.mockReturnValue({
-  multiSearch: mockedMultiSearch,
-})
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0104c34 and 8e5854e.

📒 Files selected for processing (3)
  • packages/instant-meilisearch/__tests__/custom-http-client.test.ts (1 hunks)
  • packages/instant-meilisearch/__tests__/filter.test.ts (1 hunks)
  • packages/instant-meilisearch/__tests__/search-resolver.test.ts (2 hunks)
🧰 Additional context used
🪛 GitHub Actions: Tests
packages/instant-meilisearch/__tests__/search-resolver.test.ts

[error] 49-49: Test failed: TypeError: () => value is not a constructor


[error] 75-75: Test failed: TypeError: () => value is not a constructor


[error] 101-101: Test failed: TypeError: () => value is not a constructor


[error] 128-128: Test failed: TypeError: () => value is not a constructor


[error] 164-164: Test failed: TypeError: () => value is not a constructor

🔇 Additional comments (1)
packages/instant-meilisearch/__tests__/custom-http-client.test.ts (1)

13-19: LGTM!

The change from arrow function to function expression for the mock is semantically equivalent in this context. The mock behavior remains unchanged.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/instant-meilisearch/__tests__/search-resolver.test.ts (1)

19-33: Critical: Fix the module mock setup to resolve TDZ error and incorrect mocking strategy.

The pipeline failure confirms this code has multiple critical issues:

  1. Temporal Dead Zone (TDZ) error: vi.mock() is hoisted and executes before line 20, so mockedMultiSearch (line 32) is accessed before initialization.
  2. Incorrect syntax: Line 30 uses vi.mock(import('meilisearch'), ...) but the first argument must be a string: vi.mock('meilisearch', ...).
  3. Wrong mocking strategy: The mock adds multiSearch as a module export, but multiSearch is an instance method of the MeiliSearch class, not a module-level export.
  4. Inconsistent setup: Line 19 uses vi.mocked() on the class, which conflicts with the module-level mock approach.
🔎 Proposed fix for the mock setup
-// Mocking of Meilisearch package
-const mockedMeilisearch = vi.mocked(MeiliSearch, true)
-const mockedMultiSearch = vi.fn(function (request) {
-  const response = request.queries.map((req: MeiliSearchMultiSearchParams) => ({
-    ...searchResponse,
-    indexUid: req.indexUid,
-  }))
-  return {
-    results: response,
-  }
-})
-
-vi.mock(import('meilisearch'), async (originalImport) => ({
-  ...(await originalImport()),
-  multiSearch: mockedMultiSearch,
-}))
+// Mocking of Meilisearch package
+const mockedMultiSearch = vi.fn(function (request) {
+  const response = request.queries.map((req: MeiliSearchMultiSearchParams) => ({
+    ...searchResponse,
+    indexUid: req.indexUid,
+  }))
+  return {
+    results: response,
+  }
+})
+
+vi.mock('meilisearch', () => {
+  return {
+    MeiliSearch: vi.fn().mockImplementation(() => ({
+      multiSearch: mockedMultiSearch,
+    })),
+  }
+})
+
+const mockedMeilisearch = vi.mocked(MeiliSearch)

This fix:

  • Moves the mock definition before variable references (though vi.mock() is still hoisted, the factory function will execute after)
  • Uses correct syntax: vi.mock('meilisearch', ...) with a string
  • Mocks the MeiliSearch class constructor to return an object with the multiSearch method
  • Keeps mockedMeilisearch for the existing assertions
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8e5854e and 0d10f6e.

📒 Files selected for processing (1)
  • packages/instant-meilisearch/__tests__/search-resolver.test.ts (2 hunks)
🧰 Additional context used
🪛 GitHub Actions: Tests
packages/instant-meilisearch/__tests__/search-resolver.test.ts

[error] 32-32: Vitest mocking error: Cannot access 'mockedMultiSearch' before initialization. See test setup in tests/search-resolver.test.ts.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0d10f6e and dc95825.

📒 Files selected for processing (1)
  • packages/instant-meilisearch/__tests__/search-resolver.test.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/instant-meilisearch/__tests__/search-resolver.test.ts (1)
packages/instant-meilisearch/src/cache/__tests__/assets/utils.ts (1)
  • searchResponse (1-9)
🪛 GitHub Actions: Tests
packages/instant-meilisearch/__tests__/search-resolver.test.ts

[error] 1-1: Vitest mocking error: There was an error when mocking a module. If you are using 'vi.mock' factory, make sure there are no top level variables inside, since this call is hoisted to top of the file. Caused by: ReferenceError: Cannot access 'mockedMeilisearch' before initialization

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/instant-meilisearch/__tests__/search-resolver.test.ts (1)

20-35: Consider improving type safety on the mock return value.

The as any type assertion on line 33 bypasses type checking. While this works for testing purposes, consider typing the return value properly or adding a comment explaining why the assertion is necessary.

Possible improvement

If the return type doesn't match exactly, you could:

  1. Add a comment explaining the type mismatch
  2. Type it as Partial<ReturnType<MeiliSearch['multiSearch']>> if only partial properties are needed
  3. Create a test-specific type that matches your mock structure
-      return {
+      return Promise.resolve({
         results: response,
-      } as any
+      })

Note: Verify if multiSearch returns a Promise in the actual implementation.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7bcb31e and 648f763.

📒 Files selected for processing (1)
  • packages/instant-meilisearch/__tests__/search-resolver.test.ts (6 hunks)
🔇 Additional comments (3)
packages/instant-meilisearch/__tests__/search-resolver.test.ts (3)

18-19: Mock setup correctly addresses the previous hoisting issue.

The dynamic import mock with { spy: true } properly resolves the ReferenceError that was flagged in the previous review. This approach allows per-instance spying without hoisting order problems.


49-52: Consistent test setup pattern improves maintainability.

All tests follow the same pattern of obtaining both searchClient and meiliSearchInstance, then creating a fresh spy. This consistency makes the test suite easy to understand and maintain.

Also applies to: 79-82, 109-112, 140-143, 180-183


57-61: Constructor assertions properly verify configuration.

The assertions confirm that the MeiliSearch constructor is called with the correct configuration including host, apiKey, and clientAgents. This ensures proper instantiation across all test scenarios.

Also applies to: 87-91, 118-122, 150-154, 190-194

@flevi29 flevi29 requested a review from Strift December 19, 2025 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants