Skip to content

Commit c4a5054

Browse files
authored
Merge branch 'main' into bump-meilisearch-v1.13
2 parents ee26856 + 1064d09 commit c4a5054

File tree

3 files changed

+210
-217
lines changed

3 files changed

+210
-217
lines changed

README.md

+57-30
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717
<p align="center">
1818
<a href="https://www.npmjs.com/package/meilisearch"><img src="https://img.shields.io/npm/v/meilisearch.svg" alt="npm version"></a>
1919
<a href="https://github.com/meilisearch/meilisearch-js/actions"><img src="https://github.com/meilisearch/meilisearch-js/workflows/Tests/badge.svg" alt="Tests"></a>
20-
<a href="https://codecov.io/gh/meilisearch/meilisearch-js">
21-
<img src="https://codecov.io/github/meilisearch/meilisearch-js/coverage.svg?branch=main" alt="Codecov">
22-
</a>
20+
<a href="https://codecov.io/gh/meilisearch/meilisearch-js"><img src="https://codecov.io/github/meilisearch/meilisearch-js/coverage.svg?branch=main" alt="Codecov"></a>
2321
<a href="https://github.com/prettier/prettier"><img src="https://img.shields.io/badge/styled_with-prettier-ff69b4.svg" alt="Prettier"></a>
2422
<a href="https://github.com/meilisearch/meilisearch-js/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-informational" alt="License"></a>
2523
<a href="https://ms-bors.herokuapp.com/repositories/10"><img src="https://bors.tech/images/badge_small.svg" alt="Bors enabled"></a>
@@ -49,15 +47,22 @@ For general information on how to use Meilisearch—such as our API reference, t
4947

5048
## 🔧 Installation
5149

52-
We recommend installing `meilisearch-js` in your project with your package manager of choice.
50+
This package is published to [npm](https://www.npmjs.com/package/meilisearch).
51+
52+
Installing with `npm`:
5353

5454
```sh
55-
npm install meilisearch
55+
npm i meilisearch
5656
```
5757

58-
`meilisearch-js` officially supports `node` versions 18 Maintenance, 20 Maintenance and 22 LTS.
58+
> [!NOTE]
59+
>
60+
> Node.js
61+
> [LTS and Maintenance versions](https://github.com/nodejs/Release?tab=readme-ov-file#release-schedule)
62+
> are supported and tested. Other versions may or may not work.
5963
60-
Instead of using a package manager, you may also import the library directly into your [HTML via a CDN](#include-script-tag).
64+
Other runtimes, like Deno and Bun, aren't tested, but if they do not work with
65+
this package, please open an issue.
6166

6267
### Run Meilisearch <!-- omit in toc -->
6368

@@ -69,48 +74,70 @@ Instead of using a package manager, you may also import the library directly int
6974

7075
After installing `meilisearch-js`, you must import it into your application. There are many ways of doing that depending on your development environment.
7176

77+
<details>
78+
<summary><h4>⚠️ If any issues arise importing <code>meilisearch/token</code></h4></summary>
79+
80+
- [TypeScript >= 4.7](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-7.html)
81+
is required
82+
- [`tsconfig.json` has to be set up correctly](https://www.typescriptlang.org/docs/handbook/modules/reference.html#packagejson-exports)
83+
- take a look at
84+
[Centralized Recommendations for TSConfig bases](https://github.com/tsconfig/bases?tab=readme-ov-file)
85+
86+
</details>
87+
7288
> [!WARNING]
73-
> - [default export](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export#using_the_default_export) is deprecated and will be removed in a future version https://github.com/meilisearch/meilisearch-js/issues/1789
74-
> - exports will stop being directly available on the global object (usually `window`) https://github.com/meilisearch/meilisearch-js/issues/1806
89+
>
90+
> - [default export](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export#using_the_default_export)
91+
> is deprecated and will be removed in a future version |
92+
> [Issue](https://github.com/meilisearch/meilisearch-js/issues/1789)
93+
> - regarding usage of package's UMD version via `script src`, exports will stop
94+
> being directly available on the
95+
> [global object](https://developer.mozilla.org/en-US/docs/Glossary/Global_object)
96+
> | [Issue](https://github.com/meilisearch/meilisearch-js/issues/1806)
7597
7698
#### `import` syntax <!-- omit in toc -->
7799

78100
Usage in an ES module environment:
79101

80-
```javascript
81-
import { MeiliSearch } from 'meilisearch'
102+
```js
103+
import { MeiliSearch } from "meilisearch";
82104

83105
const client = new MeiliSearch({
84-
host: 'http://127.0.0.1:7700',
85-
apiKey: 'masterKey',
86-
})
106+
host: "http://127.0.0.1:7700",
107+
apiKey: "masterKey",
108+
});
87109
```
88110

89111
#### `<script>` tag <!-- omit in toc -->
90112

91-
Usage in an HTML (or alike) file:
113+
This package also contains a [UMD](https://stackoverflow.com/a/77284527) bundled
114+
version, which in this case is meant to be used in a
115+
[`script src`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#src)
116+
tag:
92117

93118
```html
94-
<script src='https://cdn.jsdelivr.net/npm/meilisearch@latest/dist/bundles/meilisearch.umd.js'></script>
119+
<script src="https://www.unpkg.com/meilisearch/dist/umd/index.min.js"></script>
95120
<script>
96-
const client = new meilisearch.MeiliSearch({
97-
host: 'http://127.0.0.1:7700',
98-
apiKey: 'masterKey',
99-
})
121+
const client = new meilisearch.MeiliSearch(/* ... */);
122+
// ...
100123
</script>
101124
```
102125

126+
But keep in mind that each CDN ([JSDELIVR](https://www.jsdelivr.com),
127+
[ESM.SH](https://esm.sh/), etc.) provide more ways to import packages, make sure
128+
to read their documentation.
129+
103130
#### `require` syntax <!-- omit in toc -->
104131

105132
Usage in a back-end node.js or another environment supporting CommonJS modules:
106133

107-
```javascript
108-
const { MeiliSearch } = require('meilisearch')
134+
```js
135+
const { MeiliSearch } = require("meilisearch");
109136

110137
const client = new MeiliSearch({
111-
host: 'http://127.0.0.1:7700',
112-
apiKey: 'masterKey',
113-
})
138+
host: "http://127.0.0.1:7700",
139+
apiKey: "masterKey",
140+
});
114141
```
115142

116143
#### React Native <!-- omit in toc -->
@@ -122,12 +149,12 @@ To use `meilisearch-js` with React Native, you must also install [react-native-u
122149
Usage in a Deno environment:
123150

124151
```js
125-
import { MeiliSearch } from "https://esm.sh/meilisearch"
152+
import { MeiliSearch } from "npm:meilisearch";
126153

127154
const client = new MeiliSearch({
128-
host: 'http://127.0.0.1:7700',
129-
apiKey: 'masterKey',
130-
})
155+
host: "http://127.0.0.1:7700",
156+
apiKey: "masterKey",
157+
});
131158
```
132159

133160
## 🚀 Getting started
@@ -339,7 +366,6 @@ index
339366
controller.abort()
340367
```
341368

342-
343369
### Using Meilisearch behind a proxy <!-- omit in toc -->
344370

345371
#### Custom request config <!-- omit in toc -->
@@ -1157,6 +1183,7 @@ client.createDump(): Promise<EnqueuedTask>
11571183
```ts
11581184
client.createSnapshot(): Promise<EnqueuedTask>
11591185
```
1186+
11601187
---
11611188

11621189
Meilisearch provides and maintains many SDKs and integration tools like this one. We want to provide everyone with an **amazing search experience for any kind of project**. For a full overview of everything we create and maintain, take a look at the [integration-guides](https://github.com/meilisearch/integration-guides) repository.

package.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -78,23 +78,23 @@
7878
]
7979
},
8080
"devDependencies": {
81-
"@eslint/js": "^9.16.0",
81+
"@eslint/js": "^9.19.0",
8282
"@types/eslint__js": "^8.42.3",
8383
"@vitest/coverage-v8": "2.0.5",
84-
"@types/node": "^22.10.1",
85-
"eslint": "^9.16.0",
84+
"@types/node": "^22.13.0",
85+
"eslint": "^9.19.0",
8686
"eslint-plugin-tsdoc": "^0.4.0",
87-
"@vitest/eslint-plugin": "^1.1.23",
88-
"eslint-config-prettier": "^9.1.0",
89-
"typescript": "^5.7.2",
87+
"@vitest/eslint-plugin": "^1.1.25",
88+
"eslint-config-prettier": "^10.0.1",
89+
"typescript": "^5.7.3",
9090
"vite": "^6.0.9",
91-
"@typescript-eslint/utils": "^8.19.0",
91+
"@typescript-eslint/utils": "^8.22.0",
9292
"globals": "^15.14.0",
93-
"lint-staged": "15.3.0",
93+
"lint-staged": "15.4.3",
9494
"prettier": "^3.4.2",
95-
"prettier-plugin-jsdoc": "^1.3.0",
95+
"prettier-plugin-jsdoc": "^1.3.2",
9696
"typedoc": "^0.27.6",
97-
"typescript-eslint": "^8.19.0",
97+
"typescript-eslint": "^8.22.0",
9898
"vitest": "2.0.5"
9999
},
100100
"packageManager": "[email protected]"

0 commit comments

Comments
 (0)