Skip to content

Commit b7c5f78

Browse files
Merge #971
971: Add the autocomplete.js plugin r=bidoubiwa a=bidoubiwa Partially fix of #1093 ## Addition of the autocomplete Meilisearch client! This PR adds a new package to the family ``@meilisearch/autocomplete-client`.` Using this client, you are now able to use the [`autocomplete`](https://github.com/algolia/autocomplete) library with Meilisearch. See readme in the file changes to understand how it works. These points are covered in this PR: - [x] new ``@meilisearch/autocomplete-client`` package with its config (eslint, etc...) #971 - [x] compatible search client #971 - [x] `getMeilisearchResults` method #971 - [x] Add autocomplete in the user agent sent to Meilisearch #971 - [x] Tests #971 - [x] Readme of autocomplete package - [x] Change documentation links - [ ] remove `e2e tests` in the mandatory tests in the repo's settings Co-authored-by: Charlotte Vermandel <[email protected]>
2 parents ea26730 + c66e325 commit b7c5f78

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+2210
-17
lines changed

.changeset/beige-snails-tan.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@meilisearch/instant-meilisearch": patch
3+
---
4+
5+
Export a new type `AlgoliaSearchForFacetValuesResponse`

.changeset/curly-seas-bow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@meilisearch/autocomplete-client": minor
3+
---
4+
5+
Creation of search client compatible with autocomplete.

.github/dependabot.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,5 @@ updates:
3535
- dependency-name: "shx*"
3636
- dependency-name: "@vue/*"
3737
- dependency-name: "concurrently"
38+
- dependency-name: "@types/jest*"
39+
- dependency-name: "@testing-library/*"

.github/workflows/meilisearch-prototype-tests.yml

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
echo $MEILISEARCH_VERSION
3030
fi
3131
echo "meilisearch_version=$MEILISEARCH_VERSION" >> $GITHUB_OUTPUT
32-
cypress-run:
32+
cypress-autocomplete-client-run:
3333
runs-on: ubuntu-latest
3434
needs: ['meilisearch-version']
3535
services:
@@ -40,7 +40,47 @@ jobs:
4040
MEILI_NO_ANALYTICS: 'true'
4141
ports:
4242
- '7700:7700'
43-
name: end-to-end-tests
43+
name: autocomplete-client end-to-end-tests
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@v3
47+
- name: Setup node
48+
uses: actions/setup-node@v3
49+
with:
50+
node-version: 18
51+
cache: yarn
52+
- name: Install dependencies
53+
run: yarn
54+
- name: Run local browser tests
55+
uses: cypress-io/github-action@v5
56+
with:
57+
project: ./playgrounds/autocomplete
58+
wait-on: 'http://localhost:7700'
59+
# Tests are only done on one playground to avoid long testing time
60+
start: yarn playground:autocomplete
61+
env: playground=local
62+
- uses: actions/upload-artifact@v3
63+
if: failure()
64+
with:
65+
name: cypress-screenshots
66+
path: cypress/screenshots
67+
- uses: actions/upload-artifact@v3
68+
if: failure()
69+
with:
70+
name: cypress-videos
71+
path: cypress/videos
72+
cypress-instant-meilisearch-run:
73+
runs-on: ubuntu-latest
74+
needs: ['meilisearch-version']
75+
services:
76+
meilisearch:
77+
image: getmeili/meilisearch:${{ needs.meilisearch-version.outputs.version }}
78+
env:
79+
MEILI_MASTER_KEY: 'masterKey'
80+
MEILI_NO_ANALYTICS: 'true'
81+
ports:
82+
- '7700:7700'
83+
name: instant-meilisearch end-to-end-tests
4484
steps:
4585
- name: Checkout
4686
uses: actions/checkout@v3
@@ -69,7 +109,6 @@ jobs:
69109
with:
70110
name: cypress-videos
71111
path: cypress/videos
72-
73112
integration_tests:
74113
runs-on: ubuntu-latest
75114
needs: ['meilisearch-version']

.github/workflows/pre-release-tests.yml

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
run: |
2727
MEILISEARCH_VERSION=$(curl https://raw.githubusercontent.com/meilisearch/integration-guides/main/scripts/get-latest-meilisearch-rc.sh | sh)
2828
echo "meilisearch_version=$MEILISEARCH_VERSION" >> $GITHUB_OUTPUT
29-
cypress-run:
29+
cypress-autocomplete-client-run:
3030
runs-on: ubuntu-latest
3131
if: github.event_name != 'pull_request' || startsWith(github.base_ref, 'bump-meilisearch-v') || startsWith(github.base_ref, 'pre-release-beta')
3232
needs: ['meilisearch-version']
@@ -38,7 +38,48 @@ jobs:
3838
MEILI_NO_ANALYTICS: 'true'
3939
ports:
4040
- '7700:7700'
41-
name: end-to-end-tests
41+
name: autocomplete-client end-to-end-tests
42+
steps:
43+
- name: Checkout
44+
uses: actions/checkout@v3
45+
- name: Setup node
46+
uses: actions/setup-node@v3
47+
with:
48+
node-version: 18
49+
cache: yarn
50+
- name: Install dependencies
51+
run: yarn
52+
- name: Run local browser tests
53+
uses: cypress-io/github-action@v5
54+
with:
55+
project: ./playgrounds/autocomplete
56+
wait-on: 'http://localhost:7700'
57+
# Tests are only done on one playground to avoid long testing time
58+
start: yarn playground:autocomplete
59+
env: playground=local
60+
- uses: actions/upload-artifact@v3
61+
if: failure()
62+
with:
63+
name: cypress-screenshots
64+
path: cypress/screenshots
65+
- uses: actions/upload-artifact@v3
66+
if: failure()
67+
with:
68+
name: cypress-videos
69+
path: cypress/videos
70+
cypress-instant-meilisearch-run:
71+
runs-on: ubuntu-latest
72+
if: github.event_name != 'pull_request' || startsWith(github.base_ref, 'bump-meilisearch-v') || startsWith(github.base_ref, 'pre-release-beta')
73+
needs: ['meilisearch-version']
74+
services:
75+
meilisearch:
76+
image: getmeili/meilisearch:${{ needs.meilisearch-version.outputs.version }}
77+
env:
78+
MEILI_MASTER_KEY: 'masterKey'
79+
MEILI_NO_ANALYTICS: 'true'
80+
ports:
81+
- '7700:7700'
82+
name: instant-meilisearch end-to-end-tests
4283
steps:
4384
- name: Checkout
4485
uses: actions/checkout@v3

.github/workflows/tests.yml

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
- main
1111

1212
jobs:
13-
cypress-run:
13+
cypress-autocomplete-client-run:
1414
runs-on: ubuntu-latest
1515
# Will not run if the event is a PR to bump-meilisearch-v* (so a pre-release PR)
1616
# Will not run if the event is a PR to pre-release-beta/*
@@ -31,7 +31,57 @@ jobs:
3131
MEILI_NO_ANALYTICS: 'true'
3232
ports:
3333
- '7700:7700'
34-
name: end-to-end-tests
34+
name: autocomplete-client end-to-end-tests
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v3
38+
- name: Setup node
39+
uses: actions/setup-node@v3
40+
with:
41+
node-version: 18
42+
cache: yarn
43+
- name: Install dependencies
44+
run: yarn
45+
- name: Run local browser tests
46+
uses: cypress-io/github-action@v5
47+
with:
48+
project: ./playgrounds/autocomplete
49+
wait-on: 'http://localhost:7700'
50+
# Tests are only done on one playground to avoid long testing time
51+
start: yarn playground:autocomplete
52+
env: playground=local
53+
- uses: actions/upload-artifact@v3
54+
if: failure()
55+
with:
56+
name: cypress-screenshots
57+
path: cypress/screenshots
58+
- uses: actions/upload-artifact@v3
59+
if: failure()
60+
with:
61+
name: cypress-videos
62+
path: cypress/videos
63+
cypress-instant-meilisearch-run:
64+
runs-on: ubuntu-latest
65+
# Will not run if the event is a PR to bump-meilisearch-v* (so a pre-release PR)
66+
# Will not run if the event is a PR to pre-release-beta/*
67+
# Will not run if the event is a PR to prototype-beta/*
68+
# Will not run if the event is a push on pre-release-beta/*
69+
# Will still run for each push to bump-meilisearch-v* and prototype-beta/*
70+
if: |
71+
github.event_name != 'pull_request' ||
72+
!startsWith(github.base_ref, 'bump-meilisearch-v') &&
73+
!startsWith(github.base_ref, 'pre-release-beta/') &&
74+
!startsWith(github.base_ref, 'prototype-beta/') &&
75+
!startsWith(github.head_ref, 'pre-release-beta/')
76+
services:
77+
meilisearch:
78+
image: getmeili/meilisearch:latest
79+
env:
80+
MEILI_MASTER_KEY: 'masterKey'
81+
MEILI_NO_ANALYTICS: 'true'
82+
ports:
83+
- '7700:7700'
84+
name: instant-meilisearch end-to-end-tests
3585
steps:
3686
- name: Checkout
3787
uses: actions/checkout@v3

CONTRIBUTING.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ turbo run test --filter=@meilisearch/instant-meilisearch
6363

6464
#### @meilisearch/instant-meilisearch playgrounds
6565

66-
To test directly your changes in `instant-meilisearch`, you can run the following playgrounds:
66+
To test directly your changes in `@meilisearch/instant-meilisearch`, you can run the following playgrounds:
6767

6868
`Vue 3`
6969
```bash
@@ -94,6 +94,14 @@ yarn playground:geo-javascript
9494

9595
Note: If the Google Maps stopped working, please create a new [Google Api Key](https://developers.google.com/maps/documentation/javascript/get-api-key) and add it in the `.env` file at the root of the playground: `/playgrounds/geo-javascript`
9696

97+
#### @meilisearch/instant-meilisearch playgrounds
98+
99+
To test directly your changes made in `@meilisearch/autocomplete-client`, you can run the following playground:
100+
101+
```
102+
yarn playground:autocomplete
103+
```
104+
97105
## Git Guidelines
98106

99107
### Git Branches <!-- omit in TOC -->

bors.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ status = [
44
'integration-tests (Node.js 14)',
55
'integration-tests (Node.js 16)',
66
'integration-tests (Node.js 18)',
7-
'end-to-end-tests'
7+
'autocomplete-client end-to-end-tests',
8+
'instant-meilisearch end-to-end-tests',
89
]
910
# 1 hour timeout
1011
timeout-sec = 3600

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"playground:react": "turbo run dev --filter=@meilisearch/react-playground --parallel",
1919
"playground:local-react": "turbo run dev --filter=@meilisearch/local-react-playground --parallel",
2020
"playground:node": "turbo run dev --filter=@meilisearch/node-playground --parallel",
21+
"playground:autocomplete": "turbo run dev --filter=@meilisearch/autocomplete-playground --parallel",
2122
"test:e2e": "turbo run test:e2e",
2223
"test:e2e:watch": "turbo run test:e2e:watch",
2324
"lint": "turbo lint",
@@ -26,11 +27,16 @@
2627
"test": "turbo test",
2728
"test:watch": "turbo run test:watch",
2829
"instant-meilisearch:test:watch": "yarn --cwd ./packages/instant-meilisearch test:watch",
30+
"autocomplete:test:watch": "yarn --cwd ./packages/autocomplete-client test:watch",
2931
"test:types": "turbo run test:types",
3032
"version-packages": "changeset version && turbo version",
3133
"release": "yarn build && changeset publish"
3234
},
3335
"devDependencies": {
36+
"@testing-library/dom": "^9.2.0",
37+
"@testing-library/jest-dom": "^5.16.5",
38+
"@types/jest": "^29.5.1",
39+
"@types/jest-diff": "^24.3.0",
3440
"parcel-bundler": "^1.12.5",
3541
"turbo": "^1.8.5"
3642
},
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"presets": [
3+
[
4+
"@babel/preset-env",
5+
{
6+
"targets": {
7+
"node": "current"
8+
}
9+
}
10+
]
11+
]
12+
}

0 commit comments

Comments
 (0)