Skip to content

Commit

Permalink
Merge #1688
Browse files Browse the repository at this point in the history
1688: Remove cross-fetch dependency r=brunoocasali a=flevi29

# Pull Request

## Related issue
Fixes #1658 

## What does this PR do?
- removes `cross-fetch` dependency
- if anyone might need the polyfill they should run it themselves
- there's an interesting discussion [here](w3ctag/polyfills#6 (comment)) about polyfills in libraries; I think, as a lot of people do, that the sane and clean path ahead is to make it the responsibility of the library user to polyfill, even if it's somewhat of a burden

## PR checklist
Please check if your PR fulfills the following requirements:
- [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
- [x] Have you read the contributing guidelines?
- [x] Have you made sure that the title is accurate and descriptive of the changes?

Thank you so much for contributing to Meilisearch!


Co-authored-by: F. Levi <55688616+flevi29@users.noreply.github.com>
  • Loading branch information
meili-bors[bot] and flevi29 authored Sep 16, 2024
2 parents aafa15c + ee63ac8 commit 9c8e0fc
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 15 deletions.
2 changes: 0 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ updates:

- package-ecosystem: npm
directory: '/'
allow:
- dependency-name: cross-fetch

schedule:
interval: 'monthly'
Expand Down
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@
"git add"
]
},
"dependencies": {
"cross-fetch": "^3.1.6"
},
"devDependencies": {
"@babel/core": "^7.23.6",
"@babel/preset-env": "^7.22.5",
Expand Down
3 changes: 0 additions & 3 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ module.exports = [
// browser-friendly UMD build
{
input: 'src/browser.ts', // directory to transpilation of typescript
external: ['cross-fetch', 'cross-fetch/polyfill'],
output: {
name: 'window',
extend: true,
Expand Down Expand Up @@ -75,7 +74,6 @@ module.exports = [
// ES module (for bundlers) build.
{
input: 'src/index.ts',
external: ['cross-fetch', 'cross-fetch/polyfill'],
output: [
{
file: getOutputFileName(
Expand All @@ -96,7 +94,6 @@ module.exports = [
// Compatible only in a nodeJS environment.
{
input: 'src/index.ts',
external: ['cross-fetch', 'cross-fetch/polyfill'],
output: {
file: getOutputFileName(
// will add .min. in filename if in production env
Expand Down
4 changes: 0 additions & 4 deletions src/http-requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ class HttpRequests {
body?: any;
config?: Record<string, any>;
}) {
if (typeof fetch === 'undefined') {
require('cross-fetch/polyfill');
}

const constructURL = new URL(url, this.url);
if (params) {
const queryParams = new URLSearchParams();
Expand Down
4 changes: 3 additions & 1 deletion tests/settings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ describe.each([{ permission: 'Master' }, { permission: 'Admin' }])(
},
};
const task = await client.index(index.uid).updateSettings(newSettings);
await client.index(index.uid).waitForTask(task.taskUid);
await client
.index(index.uid)
.waitForTask(task.taskUid, { timeOutMs: 60_000 });
const response = await client.index(index.uid).getSettings();

expect(response).toMatchSnapshot();
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/meilisearch-test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const clearAllIndexes = async (config: Config): Promise<void> => {
const { taskUid } = await client.index(indexUid).delete();
taskIds.push(taskUid);
}
await client.waitForTasks(taskIds);
await client.waitForTasks(taskIds, { timeOutMs: 60_000 });
};

function decode64(buff: string) {
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2776,7 +2776,7 @@ create-jest@^29.7.0:
jest-util "^29.7.0"
prompts "^2.0.1"

cross-fetch@^3.0.4, cross-fetch@^3.1.6:
cross-fetch@^3.0.4:
version "3.1.6"
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.6.tgz#bae05aa31a4da760969756318feeee6e70f15d6c"
integrity sha512-riRvo06crlE8HiqOwIpQhxwdOk4fOeR7FVM/wXoxchFEqMNUjvbs3bfo4OTgMEMHzppd4DxFBDbyySj8Cv781g==
Expand Down

0 comments on commit 9c8e0fc

Please sign in to comment.