Skip to content

Commit 8918ec1

Browse files
chore: migrate to pnpm (#105)
1 parent d218336 commit 8918ec1

File tree

20 files changed

+19980
-25857
lines changed

20 files changed

+19980
-25857
lines changed

.github/actions/setup-env/action.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Setup env
2+
description: Setup Node.js and install deps
3+
4+
inputs:
5+
working-directory:
6+
description: 'Working directory'
7+
required: true
8+
default: '.'
9+
10+
runs:
11+
using: composite
12+
steps:
13+
- name: Setup Node.js
14+
uses: actions/setup-node@v4
15+
with:
16+
node-version-file: .nvmrc
17+
18+
- name: Setup pnpm
19+
uses: pnpm/action-setup@v4
20+
with:
21+
version: 10.2.1+sha512.398035c7bd696d0ba0b10a688ed558285329d27ea994804a52bad9167d8e3a72bcb993f9699585d3ca25779ac64949ef422757a6c31102c12ab932e5cbe5cc92
22+
23+
- name: Install deps
24+
shell: bash
25+
working-directory: ${{ inputs.working-directory }}
26+
run: pnpm install

.github/actions/setup-website/action.yml

-24
This file was deleted.

.github/actions/setup/action.yml

-27
This file was deleted.

.github/workflows/ci.yml

+13-10
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ jobs:
1919
uses: actions/checkout@v4
2020

2121
- name: Setup
22-
uses: ./.github/actions/setup
22+
uses: ./.github/actions/setup-env
2323

2424
- name: Lint files
25-
run: yarn lint
25+
run: pnpm lint
2626

2727
- name: Typecheck files
28-
run: yarn typecheck
28+
run: pnpm typecheck
2929

3030
test:
3131
runs-on: ubuntu-latest
@@ -35,10 +35,10 @@ jobs:
3535
uses: actions/checkout@v4
3636

3737
- name: Setup
38-
uses: ./.github/actions/setup
38+
uses: ./.github/actions/setup-env
3939

4040
- name: Run unit tests
41-
run: yarn test --maxWorkers=2 --coverage
41+
run: pnpm test --coverage
4242

4343
- name: Upload coverage reports to Codecov
4444
uses: codecov/codecov-action@v3
@@ -53,10 +53,10 @@ jobs:
5353
uses: actions/checkout@v4
5454

5555
- name: Setup
56-
uses: ./.github/actions/setup
56+
uses: ./.github/actions/setup-env
5757

5858
- name: Build package
59-
run: yarn build
59+
run: pnpm build
6060

6161
- name: Calculate Size
6262
if: github.ref != 'refs/heads/main'
@@ -71,8 +71,11 @@ jobs:
7171
- name: Checkout
7272
uses: actions/checkout@v4
7373

74-
- name: Setup Node.js and website deps
75-
uses: ./.github/actions/setup-website
74+
- name: Setup
75+
uses: ./.github/actions/setup-env
76+
with:
77+
working-directory: ./website
7678

7779
- name: Build website
78-
run: cd ./website && yarn build
80+
working-directory: ./website
81+
run: pnpm build

.github/workflows/docs-deploy.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
branches:
66
- main
7+
paths:
8+
- 'website/**'
79

810
permissions:
911
contents: write
@@ -21,7 +23,8 @@ jobs:
2123
uses: ./.github/actions/setup-website
2224

2325
- name: Build website
24-
run: cd ./website && yarn build
26+
working-directory: ./website
27+
run: pnpm build
2528

2629
- name: Deploy to GitHub Pages
2730
uses: peaceiris/actions-gh-pages@v3

.yarn/releases/yarn-4.2.1.cjs

-894
This file was deleted.

.yarnrc.yml

-3
This file was deleted.

CONTRIBUTING.md

+12-13
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,36 @@ We want this community to be friendly and respectful to each other. Please follo
66

77
## Development workflow
88

9-
This project is a monorepo managed using [Yarn workspaces](https://yarnpkg.com/features/workspaces). It contains the following packages:
9+
This project is a monorepo managed using [pnpm workspaces](https://pnpm.io/workspaces). It contains the following packages:
1010

1111
- The library package in the root directory.
1212
- An example app in the `example/` directory.
1313

14-
To get started with the project, run `yarn` in the root directory to install the required dependencies for each package:
14+
To get started with the project, run `pnpm install` in the root directory to install the required dependencies for each package:
1515

1616
```sh
17-
yarn
17+
pnpm install
1818
```
1919

20-
> Since the project relies on Yarn workspaces, you cannot use [`npm`](https://github.com/npm/cli) for development.
20+
> Since the project relies on pnpm workspaces, you cannot use [`npm`](https://github.com/npm/cli) for development.
2121
2222
Make sure your code passes TypeScript and ESLint. Run the following to verify:
2323

2424
```sh
25-
yarn typecheck
26-
yarn lint
25+
pnpm typecheck
26+
pnpm lint
2727
```
2828

2929
To fix formatting errors, run the following:
3030

3131
```sh
32-
yarn lint --fix
32+
pnpm lint --fix
3333
```
3434

3535
Remember to add tests for your change if possible. Run the unit tests by:
3636

3737
```sh
38-
yarn test
38+
pnpm test
3939
```
4040

4141
### Commit message convention
@@ -66,17 +66,16 @@ We use [release-it](https://github.com/release-it/release-it) to make it easier
6666
To publish new versions, run the following:
6767

6868
```sh
69-
yarn release
69+
pnpm release
7070
```
7171

7272
### Scripts
7373

7474
The `package.json` file contains various scripts for common tasks:
7575

76-
- `yarn`: setup project by installing dependencies and pods - run with `POD_INSTALL=0` to skip installing pods.
77-
- `yarn typecheck`: type-check files with TypeScript.
78-
- `yarn lint`: lint files with ESLint.
79-
- `yarn test`: run unit tests with Jest.
76+
- `pnpm typecheck`: type-check files with TypeScript.
77+
- `pnpm lint`: lint files with ESLint.
78+
- `pnpm test`: run unit tests with Jest.
8079

8180
### Sending a pull request
8281

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ or
4848
yarn add ts-regex-builder
4949
```
5050

51+
or
52+
53+
```sh
54+
pnpm add ts-regex-builder
55+
```
56+
5157
## Basic usage
5258

5359
```js

package.json

+13-11
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,28 @@
1616
],
1717
"exports": {
1818
".": {
19+
"types": "./dist/types/index.d.ts",
1920
"require": "./dist/commonjs/index.js",
20-
"import": "./dist/esm/index.mjs",
21-
"types": "./dist/types/index.d.ts"
21+
"import": "./dist/esm/index.mjs"
2222
},
2323
"./patterns": {
24+
"types": "./dist/types/patterns/index.d.ts",
2425
"require": "./dist/commonjs/patterns/index.js",
25-
"import": "./dist/esm/patterns/index.mjs",
26-
"types": "./dist/types/patterns/index.d.ts"
26+
"import": "./dist/esm/patterns/index.mjs"
2727
}
2828
},
2929
"scripts": {
3030
"test": "jest",
3131
"typecheck": "tsc --noEmit",
3232
"lint": "eslint \"**/*.{js,ts,tsx}\"",
3333
"clean": "del-cli dist",
34-
"release": "yarn build && release-it",
35-
"release:beta": "yarn build && release-it --preRelease=beta",
36-
"build": "yarn clean && yarn build:commonjs && yarn build:esm && yarn build:typescript",
34+
"release": "pnpm build && release-it",
35+
"release:beta": "pnpm build && release-it --preRelease=beta",
36+
"build": "pnpm clean && pnpm build:commonjs && pnpm build:esm && pnpm build:typescript",
3737
"build:commonjs": "BABEL_ENV=cjs babel src --out-dir \"dist/commonjs\" --extensions .js,.ts --out-file-extension .js --source-maps --no-comments",
3838
"build:esm": "BABEL_ENV=esm babel src --out-dir \"dist/esm\" --extensions .js,.ts --out-file-extension .mjs --source-maps --no-comments",
39-
"build:typescript": "tsc --project tsconfig.release.json --outDir \"dist/types\""
39+
"build:typescript": "tsc --project tsconfig.release.json --outDir \"dist/types\"",
40+
"validate": "pnpm typecheck && pnpm test && pnpm lint"
4041
},
4142
"keywords": [
4243
"regex",
@@ -61,7 +62,7 @@
6162
"@babel/preset-typescript": "^7.24.1",
6263
"@callstack/eslint-config": "^14.1.1",
6364
"@release-it/conventional-changelog": "^5.1.1",
64-
"@size-limit/preset-small-lib": "^11.1.2",
65+
"@size-limit/preset-small-lib": "^11.1.6",
6566
"@types/jest": "^29.5.12",
6667
"babel-plugin-add-import-extension": "^1.6.0",
6768
"del-cli": "^5.1.0",
@@ -73,9 +74,9 @@
7374
"jest": "^29.7.0",
7475
"prettier": "^2.8.8",
7576
"release-it": "^15.11.0",
77+
"size-limit": "^11.1.6",
7678
"typescript": "^5.4.5"
7779
},
78-
"packageManager": "[email protected]",
7980
"engines": {
8081
"node": ">= 18.0.0"
8182
},
@@ -149,5 +150,6 @@
149150
"tabWidth": 2,
150151
"trailingComma": "all",
151152
"useTabs": false
152-
}
153+
},
154+
"packageManager": "[email protected]+sha512.398035c7bd696d0ba0b10a688ed558285329d27ea994804a52bad9167d8e3a72bcb993f9699585d3ca25779ac64949ef422757a6c31102c12ab932e5cbe5cc92"
153155
}

0 commit comments

Comments
 (0)