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

chore: migrate to pnpm #105

Merged
merged 5 commits into from
Feb 10, 2025
Merged
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
26 changes: 26 additions & 0 deletions .github/actions/setup-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Setup env
description: Setup Node.js and install deps

inputs:
working-directory:
description: 'Working directory'
required: true
default: '.'

runs:
using: composite
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.2.1+sha512.398035c7bd696d0ba0b10a688ed558285329d27ea994804a52bad9167d8e3a72bcb993f9699585d3ca25779ac64949ef422757a6c31102c12ab932e5cbe5cc92

- name: Install deps
shell: bash
working-directory: ${{ inputs.working-directory }}
run: pnpm install
24 changes: 0 additions & 24 deletions .github/actions/setup-website/action.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/actions/setup/action.yml

This file was deleted.

23 changes: 13 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ jobs:
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup
uses: ./.github/actions/setup-env

- name: Lint files
run: yarn lint
run: pnpm lint

- name: Typecheck files
run: yarn typecheck
run: pnpm typecheck

test:
runs-on: ubuntu-latest
Expand All @@ -35,10 +35,10 @@ jobs:
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup
uses: ./.github/actions/setup-env

- name: Run unit tests
run: yarn test --maxWorkers=2 --coverage
run: pnpm test --coverage

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
Expand All @@ -53,10 +53,10 @@ jobs:
uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup
uses: ./.github/actions/setup-env

- name: Build package
run: yarn build
run: pnpm build

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

- name: Setup Node.js and website deps
uses: ./.github/actions/setup-website
- name: Setup
uses: ./.github/actions/setup-env
with:
working-directory: ./website

- name: Build website
run: cd ./website && yarn build
working-directory: ./website
run: pnpm build
5 changes: 4 additions & 1 deletion .github/workflows/docs-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
branches:
- main
paths:
- 'website/**'

permissions:
contents: write
Expand All @@ -21,7 +23,8 @@ jobs:
uses: ./.github/actions/setup-website

- name: Build website
run: cd ./website && yarn build
working-directory: ./website
run: pnpm build

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
Expand Down
894 changes: 0 additions & 894 deletions .yarn/releases/yarn-4.2.1.cjs

This file was deleted.

3 changes: 0 additions & 3 deletions .yarnrc.yml

This file was deleted.

25 changes: 12 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,36 @@ We want this community to be friendly and respectful to each other. Please follo

## Development workflow

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

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

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

```sh
yarn
pnpm install
```

> Since the project relies on Yarn workspaces, you cannot use [`npm`](https://github.com/npm/cli) for development.
> Since the project relies on pnpm workspaces, you cannot use [`npm`](https://github.com/npm/cli) for development.

Make sure your code passes TypeScript and ESLint. Run the following to verify:

```sh
yarn typecheck
yarn lint
pnpm typecheck
pnpm lint
```

To fix formatting errors, run the following:

```sh
yarn lint --fix
pnpm lint --fix
```

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

```sh
yarn test
pnpm test
```

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

```sh
yarn release
pnpm release
```

### Scripts

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

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

### Sending a pull request

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ or
yarn add ts-regex-builder
```

or

```sh
pnpm add ts-regex-builder
```

## Basic usage

```js
Expand Down
24 changes: 13 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,28 @@
],
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"require": "./dist/commonjs/index.js",
"import": "./dist/esm/index.mjs",
"types": "./dist/types/index.d.ts"
"import": "./dist/esm/index.mjs"
},
"./patterns": {
"types": "./dist/types/patterns/index.d.ts",
"require": "./dist/commonjs/patterns/index.js",
"import": "./dist/esm/patterns/index.mjs",
"types": "./dist/types/patterns/index.d.ts"
"import": "./dist/esm/patterns/index.mjs"
}
},
"scripts": {
"test": "jest",
"typecheck": "tsc --noEmit",
"lint": "eslint \"**/*.{js,ts,tsx}\"",
"clean": "del-cli dist",
"release": "yarn build && release-it",
"release:beta": "yarn build && release-it --preRelease=beta",
"build": "yarn clean && yarn build:commonjs && yarn build:esm && yarn build:typescript",
"release": "pnpm build && release-it",
"release:beta": "pnpm build && release-it --preRelease=beta",
"build": "pnpm clean && pnpm build:commonjs && pnpm build:esm && pnpm build:typescript",
"build:commonjs": "BABEL_ENV=cjs babel src --out-dir \"dist/commonjs\" --extensions .js,.ts --out-file-extension .js --source-maps --no-comments",
"build:esm": "BABEL_ENV=esm babel src --out-dir \"dist/esm\" --extensions .js,.ts --out-file-extension .mjs --source-maps --no-comments",
"build:typescript": "tsc --project tsconfig.release.json --outDir \"dist/types\""
"build:typescript": "tsc --project tsconfig.release.json --outDir \"dist/types\"",
"validate": "pnpm typecheck && pnpm test && pnpm lint"
},
"keywords": [
"regex",
Expand All @@ -61,7 +62,7 @@
"@babel/preset-typescript": "^7.24.1",
"@callstack/eslint-config": "^14.1.1",
"@release-it/conventional-changelog": "^5.1.1",
"@size-limit/preset-small-lib": "^11.1.2",
"@size-limit/preset-small-lib": "^11.1.6",
"@types/jest": "^29.5.12",
"babel-plugin-add-import-extension": "^1.6.0",
"del-cli": "^5.1.0",
Expand All @@ -73,9 +74,9 @@
"jest": "^29.7.0",
"prettier": "^2.8.8",
"release-it": "^15.11.0",
"size-limit": "^11.1.6",
"typescript": "^5.4.5"
},
"packageManager": "yarn@4.2.1",
"engines": {
"node": ">= 18.0.0"
},
Expand Down Expand Up @@ -149,5 +150,6 @@
"tabWidth": 2,
"trailingComma": "all",
"useTabs": false
}
},
"packageManager": "pnpm@10.2.1+sha512.398035c7bd696d0ba0b10a688ed558285329d27ea994804a52bad9167d8e3a72bcb993f9699585d3ca25779ac64949ef422757a6c31102c12ab932e5cbe5cc92"
}
Loading
Loading