Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch package manager from yarn to pnpm #1662

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .code-samples.meilisearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,11 @@ getting_started_add_documents_md: |-
yarn add meilisearch
```

Or, if you are using `pnpm`
```bash
pnpm add meilisearch
```

**Import**

`require` syntax:
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/meilisearch-prototype-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,23 @@ jobs:
name: integration-tests (Node.js ${{ matrix.node }})
steps:
- uses: actions/checkout@v4
# @TODO: This action probably installs yarn, research more
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: yarn
- name: Install dependencies
run: yarn --dev
run: pnpm i
- name: Run tests
run: yarn test
run: pnpm test
- name: Build project
run: yarn build
run: pnpm build
- name: Run ESM env
run: yarn test:env:esm
run: pnpm test:env:esm
- name: Run Node.js env
run: yarn test:env:nodejs
run: pnpm test:env:nodejs
- name: Run node typescript env
run: yarn test:env:node-ts
run: pnpm test:env:node-ts
- name: Run Browser env
run: yarn test:env:browser
run: pnpm test:env:browser
15 changes: 8 additions & 7 deletions .github/workflows/pre-release-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,23 @@ jobs:
name: integration-tests (Node.js ${{ matrix.node }})
steps:
- uses: actions/checkout@v4
# @TODO: research
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: yarn
- name: Install dependencies
run: yarn --dev
run: pnpm i
- name: Run tests
run: yarn test
run: pnpm test
- name: Build project
run: yarn build
run: pnpm build
- name: Run ESM env
run: yarn test:env:esm
run: pnpm test:env:esm
- name: Run Node.js env
run: yarn test:env:nodejs
run: pnpm test:env:nodejs
- name: Run node typescript env
run: yarn test:env:node-ts
run: pnpm test:env:node-ts
- name: Run Browser env
run: yarn test:env:browser
run: pnpm test:env:browser
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
- name: Check tag format
run: sh .github/scripts/check-tag-format.sh "${{ github.event.release.prerelease }}"
- name: Install dependencies
run: yarn install
run: pnpm i
- name: Build meilisearch-js
run: yarn build
run: pnpm build
- name: Publish with latest tag
if: '!github.event.release.prerelease'
run: npm publish .
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ jobs:
node-version: ${{ matrix.node }}
cache: 'yarn'
- name: Install dependencies
run: yarn --dev
run: pnpm i
- name: Run tests
run: yarn test
run: pnpm test
- name: Build project
run: yarn build
run: pnpm build
- name: Run ESM env
run: yarn test:env:esm
run: pnpm test:env:esm
- name: Run Node.js env
run: yarn test:env:nodejs
run: pnpm test:env:nodejs
- name: Run node typescript env
run: yarn test:env:node-ts
run: pnpm test:env:node-ts
- name: Run Browser env
run: yarn test:env:browser
run: pnpm test:env:browser
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
env:
Expand All @@ -72,9 +72,9 @@ jobs:
node-version: 20
cache: 'yarn'
- name: Install dependencies
run: yarn --dev
run: pnpm i
- name: Run code style check
run: yarn style
run: pnpm style
- name: Run yaml style check
uses: ibiqlik/action-yamllint@v3
with:
Expand All @@ -90,8 +90,8 @@ jobs:
node-version: 20
cache: 'yarn'
- name: Install dependencies
run: yarn --dev
run: pnpm i
- name: Build project
run: yarn build
run: pnpm build
- name: Run types check
run: yarn types
run: pnpm types
24 changes: 13 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,25 @@ First of all, thank you for contributing to Meilisearch! The goal of this docume

To run this project, you will need:

- Node.js >= v14 and node <= 18
- Yarn

- Node.js v18 (Maintenance) or later

### Setup

You can set up your local environment natively or using `docker`, check out the [`docker-compose.yml`](/docker-compose.yml).

Example of running all the checks with docker:
```bash
docker-compose run --rm package bash -c "yarn install && yarn test && yarn lint"
docker-compose run --rm package bash -c "pnpm install && pnpm test && pnpm lint"
```

To install dependencies:

```bash
yarn --dev
# NOTE: if you haven't already done so, first run
corepack enable
# end of note

pnpm i
```

### Tests and Linter
Expand All @@ -61,13 +63,13 @@ Each PR should pass the tests and the linter to be accepted.
# Tests
curl -L https://install.meilisearch.com | sh # download Meilisearch
./meilisearch --master-key=masterKey --no-analytics # run Meilisearch
yarn test
# Linter
yarn style
# Linter with fixing
yarn style:fix
pnpm test
# Linter and formatter
pnpm style
# Linter and formatter with fixing
pnpm style:fix
# Build the project
yarn build
pnpm build
```

## Git Guidelines
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ We recommend installing `meilisearch-js` in your project with your package manag
npm install meilisearch
```

`meilisearch-js` officially supports `node` versions >= 14 and <= 18.
`meilisearch-js` officially supports `node` versions 18 (Maintenance) and 20 (LTS).

Instead of using a package manager, you may also import the library directly into your [HTML via a CDN](#include-script-tag).

Expand Down
2 changes: 1 addition & 1 deletion nodemon.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"extension": "ts",
"verbose": true,
"ignore": ["tests/*", "*.tests.js", "dist/"],
"exec": "yarn tsc"
"exec": "pnpm tsc"
}
40 changes: 21 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,27 @@
"url": "https://github.com/meilisearch/meilisearch-js"
},
"scripts": {
"playground:javascript": "yarn --cwd ./playgrounds/javascript && yarn --cwd ./playgrounds/javascript start",
"playground:javascript": "pnpm -C ./playgrounds/javascript i && pnpm -C ./playgrounds/javascript start",
"clear_jest": "jest --clearCache",
"cleanup": "shx rm -rf dist/",
"build": "yarn cleanup && rollup -c && rollup -c --environment NODE_ENV:production",
"watch": "yarn cleanup && rollup -c --watch",
"postbuild": "yarn size && yarn typingsheader",
"test": "yarn clear_jest && jest --runInBand --verbose",
"build": "pnpm cleanup && rollup -c && rollup -c --environment NODE_ENV:production",
"watch": "pnpm cleanup && rollup -c --watch",
"postbuild": "pnpm size && pnpm typingsheader",
"test": "pnpm clear_jest && jest --runInBand --verbose",
"types:watch": "nodemon --config nodemon.json",
"types": "yarn tsc",
"test:env:browser": "yarn build && yarn --cwd tests/env/express && yarn --cwd tests/env/express test",
"test:watch": "yarn clear_jest && yarn test --watch",
"test:coverage": "yarn test --coverage",
"test:ci": "yarn test --ci",
"test:env": "yarn build && yarn test:env:nodejs && yarn test:env:esm && yarn test:env:node-ts",
"test:env:node-ts": "yarn --cwd tests/env/typescript-node start",
"test:env:nodejs": "yarn build && node tests/env/node/index.js && node tests/env/node/getting_started.js",
"test:env:esm": "yarn --cwd tests/env/esm && yarn --cwd tests/env/esm start",
"test:env:nitro-app": "yarn build && yarn --cwd tests/env/nitro-app test",
"types": "tsc",
"test:env:browser": "pnpm build && pnpm -C tests/env/express i && pnpm -C tests/env/express test",
"test:watch": "pnpm clear_jest && pnpm test --watch",
"test:coverage": "pnpm test --coverage",
"test:ci": "pnpm test --ci",
"test:env": "pnpm build && pnpm test:env:nodejs && pnpm test:env:esm && pnpm test:env:node-ts",
"test:env:node-ts": "pnpm -C tests/env/typescript-node start",
"test:env:nodejs": "pnpm build && node tests/env/node/index.js && node tests/env/node/getting_started.js",
"test:env:esm": "pnpm -C tests/env/esm i && pnpm -C tests/env/esm start",
"test:env:nitro-app": "pnpm build && pnpm -C tests/env/nitro-app test",
"size": "node scripts/file-size ./dist/bundles/meilisearch.esm.min.js ./dist/bundles/meilisearch.umd.min.js",
"style": "yarn fmt && yarn lint",
"style:fix": "yarn fmt:fix && yarn lint:fix",
"style": "pnpm fmt && pnpm lint",
"style:fix": "pnpm fmt:fix && pnpm lint:fix",
"fmt": "prettier -c ./**/*.{js,ts}",
"fmt:fix": "prettier -w ./**/*.{js,ts}",
"lint": "eslint --ext .js,.ts,.tsx .",
Expand All @@ -67,7 +67,7 @@
"git add"
],
"src/**/*.{ts,tsx}": [
"yarn lint:fix",
"pnpm lint:fix",
"git add"
]
},
Expand All @@ -82,6 +82,7 @@
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "15.1.0",
"@types/jest": "^29.5.11",
"@types/node": "^20.12.12",
"@typescript-eslint/eslint-plugin": "^6.19.0",
"@typescript-eslint/parser": "^6.19.0",
"abort-controller": "^3.0.0",
Expand All @@ -107,5 +108,6 @@
"shx": "^0.3.2",
"ts-jest": "^29.1.1",
"typescript": "^5.3.3"
}
},
"packageManager": "[email protected]"
}
15 changes: 9 additions & 6 deletions playgrounds/javascript/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# Javascript Playground

## Project setup
```
yarn install

```bash
pnpm i
```

### Compiles and hot-reloads for development
```
yarn start

```bash
pnpm start
```

### Compiles and minifies for production
```
yarn build

```bash
pnpm build
```
Loading
Loading