Skip to content

Commit 7e4a378

Browse files
authored
Switch to pnpm
This pull request transitions the project from using `yarn` to `pnpm` for dependency management and updates related workflows, documentation, and scripts accordingly. Additionally, it introduces new TypeScript type definitions and simplifies the `package.json` configuration. ### Migration from `yarn` to `pnpm`: * [`.github/workflows/build-artifacts.yml`](diffhunk://#diff-fb778ff52f81fc559de90b69279d2bc580d03847f2008ad7c6b6ba3e67265e7dL14-R26): Updated the dependency installation step to use `pnpm` instead of `yarn` and added a `pnpm build` command for artifact building. * [`.github/workflows/js-qa.yml`](diffhunk://#diff-a88b0a4f767bead41b7923be71fc24ca488e65a46d253e0641842df191d36a52L23-R36): Replaced `yarn` commands with equivalent `pnpm` commands for dependency installation, linting, and testing. * [`docs/development.md`](diffhunk://#diff-97db29a7915320e63d41d38a0440360a87055ee8ed03757aa263116dbbb4aabeL15-R27): Updated all references to `yarn` commands with `pnpm` equivalents, including installation, asset building, and environment setup commands. [[1]](diffhunk://#diff-97db29a7915320e63d41d38a0440360a87055ee8ed03757aa263116dbbb4aabeL15-R27) [[2]](diffhunk://#diff-97db29a7915320e63d41d38a0440360a87055ee8ed03757aa263116dbbb4aabeL37-R37) * `scripts/create-posts.sh` and `scripts/create-terms.sh`: Replaced `yarn wp-env` commands with `pnpm run wp-env` commands. [[1]](diffhunk://#diff-f965dea7fbe12b4ea991c303cd3243b662803477a2a53f3a2883724d787b5d75L38-R38) [[2]](diffhunk://#diff-6631933ba30a36de6c8c728b1b9ae42786f8f3cbf4e82f317ee590f4fe3dc89aL30-R30) ### Updates to `package.json`: * Added new TypeScript type definitions for `lodash`, `node`, `react`, and `react-dom` under `devDependencies`. * Removed `yarn` from `devDependencies` and added a `pnpm` configuration block with overrides for `react` and `react-dom`. [[1]](diffhunk://#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519L34-L38) [[2]](diffhunk://#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R50-R55) * Modified scripts to replace `yarn` commands with `pnpm` equivalents and added a new `qa` script for combined type checking, linting, and testing. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Chores** - Switched the project’s package manager from Yarn to pnpm across workflows, scripts, and documentation. - Updated continuous integration workflows to use pnpm for installing dependencies, caching, linting, and testing. - Updated documentation to reflect pnpm usage in all development commands and instructions. - Removed Yarn from dependencies and configuration. - Added TypeScript type definitions for React and React DOM to development dependencies. - Introduced a new script for running quality assurance checks. - Relaxed the minimum required version for webpack. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 76a0c22 commit 7e4a378

File tree

8 files changed

+15637
-12462
lines changed

8 files changed

+15637
-12462
lines changed

.github/workflows/builld-artifacts.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,27 @@ jobs:
1111
if: ${{ !contains(github.event.head_commit.message, '--skip-assets-artifacts') }}
1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@v2
14+
uses: actions/checkout@v4
15+
16+
- name: Pnpm Install
17+
uses: pnpm/action-setup@v4
18+
with:
19+
version: '^9'
20+
run_install: false
1521

1622
- name: Setup Node
17-
uses: actions/setup-node@v2
23+
uses: actions/setup-node@v4
1824
with:
19-
cache: 'yarn'
20-
node-version: '20'
25+
cache: 'pnpm'
26+
node-version: '22'
2127

2228
- name: Install Dependencies
23-
run: yarn install
29+
run: pnpm i --frozen-lockfile
2430

2531
- name: Build Artifacts
2632
uses: widoz/github-artifacts-action@v1
33+
with:
34+
command: 'pnpm build'
2735
env:
2836
GIT_USER: ${{ secrets.GIT_USER }}
2937
GIT_EMAIL: ${{ secrets.GIT_EMAIL }}

.github/workflows/js-qa.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,23 @@ jobs:
2222
- name: Checkout
2323
uses: actions/checkout@v4
2424

25+
- name: Pnpm Install
26+
uses: pnpm/action-setup@v4
27+
with:
28+
version: '^9'
29+
run_install: false
30+
2531
- name: Setup Node
2632
uses: actions/setup-node@v4
2733
with:
28-
cache: 'yarn'
34+
cache: 'pnpm'
2935
node-version: '22'
3036

31-
- name: Install
32-
run: yarn install
37+
- name: Install Dependencies
38+
run: pnpm i --frozen-lockfile
3339

3440
- name: Linting JavaScript
35-
run: yarn lint:js
41+
run: pnpm run lint:js
3642

3743
- name: Unit Tests
38-
run: yarn test
44+
run: pnpm run test

docs/development.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ The first thing to do is to clone the repository and install the dependencies:
1212
$ git clone git@github.com:spaghetti-dojo/kensaku.git
1313
$ cd kensaku
1414
$ composer install
15-
$ yarn install
15+
$ pnpm install
1616
```
1717

1818
After we have installed the dependencies we need to build the assets:
1919

2020
```bash
21-
$ yarn build
21+
$ pnpm run build
2222
```
2323

2424
or alternatively we can run the dev script to compile the assets with source maps:
2525

2626
```bash
27-
$ yarn build:dev
27+
$ pnpm run build:dev
2828
```
2929

3030
## The Environment
@@ -34,7 +34,7 @@ The project is making use of `@wordress/env` as a local environment to develop t
3434
To start the environment we need to run the following command:
3535

3636
```bash
37-
$ yarn wp-env start
37+
$ pnpm run wp-env start
3838
```
3939

4040
This will install WordPress and will set the current project as a plugin. The package contain a E2E module used by the plugin to help with the development. The module register two blocks; one for the Custom Post Type and one for the Custom Taxonomy.

package.json

Lines changed: 65 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,67 @@
11
{
2-
"name": "kensaku",
3-
"description": "A WordPress package to search Entities including Rest API Endpoints and React Components",
4-
"author": "guido scialfa <dev@guidoscialfa.com>",
5-
"main": "./build/index.js",
6-
"license": "GPL-2.0-or-later",
7-
"engines": {
8-
"node": "22"
9-
},
10-
"devDependencies": {
11-
"@faker-js/faker": "^8",
12-
"@jest/globals": "^29.4.3",
13-
"@testing-library/dom": "^10.0.0",
14-
"@testing-library/jest-dom": "^6.2.0",
15-
"@testing-library/react": "^16.0.0",
16-
"@testing-library/user-event": "^14.5.1",
17-
"@total-typescript/shoehorn": "^0.1.0",
18-
"@types/node": "^22.0.0",
19-
"@wordpress/dependency-extraction-webpack-plugin": "^4.8.0",
20-
"@wordpress/env": "^5.9.0",
21-
"@wordpress/eslint-plugin": "^19.0.0",
22-
"@wordpress/scripts": "^26.0.0",
23-
"eslint": "^8.0.0",
24-
"eslint-import-resolver-typescript": "^3.5.5",
25-
"eslint-plugin-import": "^2.0.0",
26-
"jest": "^29.4.3",
27-
"jest-environment-jsdom": "^29.5.0",
28-
"react-dom": "~18.2.0",
29-
"ts-jest": "^29.0.5",
30-
"ts-loader": "^9.4.2",
31-
"ts-node": "^10.9.1",
32-
"typescript": "~5.1.0",
33-
"webpack": "^5.94.0",
34-
"webpack-cli": "^5.1.4",
35-
"yarn": "^1.22.19"
36-
},
37-
"dependencies": {
38-
"@types/lodash": "^4",
39-
"@wordpress/api-fetch": "~6.21.0",
40-
"@wordpress/components": "~23.1.0",
41-
"@wordpress/compose": "^6.23.0",
42-
"@wordpress/core-data": "~6.12.0",
43-
"@wordpress/hooks": "^3.49.0",
44-
"@wordpress/i18n": "~4.24.0",
45-
"classnames": "^2.3.2",
46-
"lodash": "^4.17.21",
47-
"react": "~18.2.0"
48-
},
49-
"scripts": {
50-
"wp-env": "wp-env",
51-
"build": "wp-scripts build --webpack-src-dir=./sources/client/src",
52-
"build:dev": "wp-scripts start --webpack--devtool=inline-source-map --webpack-src-dir=./sources/client/src",
53-
"cs:fix": "wp-scripts format ./sources/client",
54-
"lint:js": "wp-scripts lint-js ./sources/client",
55-
"lint:js:fix": "wp-scripts lint-js --fix ./sources/client",
56-
"test": "jest",
57-
"test:update-snapshots": "yarn test -u"
58-
}
2+
"name": "kensaku",
3+
"description": "A WordPress package to search Entities including Rest API Endpoints and React Components",
4+
"author": "guido scialfa <dev@guidoscialfa.com>",
5+
"main": "./build/index.js",
6+
"license": "GPL-2.0-or-later",
7+
"engines": {
8+
"node": "22"
9+
},
10+
"devDependencies": {
11+
"@types/lodash": "^4",
12+
"@types/node": "^22.0.0",
13+
"@types/react": "~18.2.0",
14+
"@types/react-dom": "~18.2.0",
15+
"@faker-js/faker": "^8",
16+
"@jest/globals": "^29.4.3",
17+
"@testing-library/dom": "^10.0.0",
18+
"@testing-library/jest-dom": "^6.2.0",
19+
"@testing-library/react": "^16.0.0",
20+
"@testing-library/user-event": "^14.5.1",
21+
"@total-typescript/shoehorn": "^0.1.0",
22+
"@wordpress/dependency-extraction-webpack-plugin": "^4.8.0",
23+
"@wordpress/env": "^5.9.0",
24+
"@wordpress/eslint-plugin": "^19.0.0",
25+
"@wordpress/scripts": "^26.0.0",
26+
"eslint": "^8.0.0",
27+
"eslint-import-resolver-typescript": "^3.5.5",
28+
"eslint-plugin-import": "^2.0.0",
29+
"jest": "^29.4.3",
30+
"jest-environment-jsdom": "^29.5.0",
31+
"react-dom": "~18.2.0",
32+
"ts-jest": "^29.0.5",
33+
"ts-loader": "^9.4.2",
34+
"ts-node": "^10.9.1",
35+
"typescript": "~5.1.0",
36+
"webpack": "^5.0.0",
37+
"webpack-cli": "^5.1.4"
38+
},
39+
"dependencies": {
40+
"@wordpress/api-fetch": "~6.21.0",
41+
"@wordpress/components": "~23.1.0",
42+
"@wordpress/compose": "^6.23.0",
43+
"@wordpress/core-data": "~6.12.0",
44+
"@wordpress/hooks": "^3.49.0",
45+
"@wordpress/i18n": "~4.24.0",
46+
"classnames": "^2.3.2",
47+
"lodash": "^4.17.21",
48+
"react": "~18.2.0"
49+
},
50+
"pnpm": {
51+
"overrides": {
52+
"react": "18.2.0",
53+
"react-dom": "18.2.0"
54+
}
55+
},
56+
"scripts": {
57+
"wp-env": "wp-env",
58+
"build": "wp-scripts build --webpack-src-dir=./sources/client/src",
59+
"build:dev": "wp-scripts start --webpack-devtool=inline-source-map --webpack-src-dir=./sources/client/src",
60+
"cs:fix": "wp-scripts format ./sources/client",
61+
"lint:js": "wp-scripts lint-js ./sources/client",
62+
"lint:js:fix": "wp-scripts lint-js --fix ./sources/client",
63+
"test": "jest",
64+
"test:update-snapshots": "pnpm test -u",
65+
"qa": "tsc --noEmit && pnpm lint:js && pnpm test"
66+
}
5967
}

0 commit comments

Comments
 (0)