Skip to content

Commit 21652e5

Browse files
authored
Switch to PNPM (joe-bell#92)
* refactor: initialize monorepo * chore: add tsc to ci
1 parent 625d008 commit 21652e5

22 files changed

+4406
-13402
lines changed

.config/.syncpackrc

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"workspace": false,
3+
"peer": false,
4+
"sortFirst": [
5+
"private",
6+
"name",
7+
"version",
8+
"description",
9+
"author",
10+
"license",
11+
"funding",
12+
"repository",
13+
"bugs",
14+
"homepage",
15+
"keywords",
16+
"source",
17+
"main",
18+
"module",
19+
"exports",
20+
"typings",
21+
"typesVersions",
22+
"files",
23+
"scripts",
24+
"browserslist",
25+
"peerDependencies",
26+
"peerDependenciesMeta",
27+
"dependencies",
28+
"devDependencies"
29+
]
30+
}

.config/lint-staged.config.mjs

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
export default {
22
"*": (filenames) =>
3-
`prettier --ignore-unknown --no-error-on-unmatched-pattern --write ${filenames
3+
`pnpm run prettier -- --write ${filenames
44
.map((filename) => `'${filename}'`)
55
.join(" ")}`,
6-
"src/**/*.{js,jsx,ts,tsx}": () => "npm run lint:tsc",
6+
"**/*.{js,jsx,ts,tsx}": () => "pnpm tsc",
7+
"**/package.json": (filenames) => [
8+
"pnpm syncpack:list-mismatches",
9+
`pnpm syncpack:format -- ${filenames
10+
.map((filename) => `--source '${filename}'`)
11+
.join(" ")}`,
12+
],
713
};

.github/workflows/ci.yml

+10-5
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,23 @@ on:
77
branches: [main]
88

99
jobs:
10-
npm:
10+
pnpm:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
script: [lint, build, test]
15+
script: [build, lint, tsc, test]
1616
steps:
1717
- uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0
20+
- uses: pnpm/action-setup@v2
21+
with:
22+
version: 7
1823
- uses: actions/setup-node@v3
1924
with:
25+
cache: "pnpm"
2026
node-version-file: ".nvmrc"
21-
cache: "npm"
22-
- run: npm ci
27+
- run: pnpm i
2328
- name: ${{ matrix.script }}
24-
run: npm run ${{ matrix.script }}
29+
run: pnpm ${{ matrix.script }}

.github/workflows/commitlint.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@ jobs:
88
- uses: actions/checkout@v3
99
with:
1010
fetch-depth: 0
11+
- uses: pnpm/action-setup@v2
12+
with:
13+
version: 7
1114
- uses: actions/setup-node@v3
1215
with:
16+
cache: "pnpm"
1317
node-version-file: ".nvmrc"
14-
cache: "npm"
15-
- run: npm ci
18+
- run: pnpm i
1619
- uses: wagoid/commitlint-github-action@v5
1720
env:
1821
NODE_PATH: ${{ github.workspace }}/node_modules

.husky/pre-commit

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
npm run pre-commit
4+
pnpm lint-staged

.prettierignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
coverage
2+
dist
3+
pnpm-lock.yaml

CONTRIBUTING.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ Welcome, and thanks for your interest in contributing! Please take a moment to r
1414

1515
1. [Fork the repo](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo) and clone to your machine.
1616
2. Create a new branch with your contribution.
17-
3. Install [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) on your machine.
17+
3. Install [pnpm](https://pnpm.io/installation) on your machine.
1818
4. In the repo, install dependencies via:
1919
```sh
20-
npm i
20+
pnpm i
2121
```
2222
5. Voilà, you're ready to go!
2323

2424
### Scripts
2525

26-
- `npm run dev` – runs jest, watching for file changes
27-
- `npm run build` – production build
28-
- `npm run check` – type checks
29-
- `npm run test`
26+
- `pnpm dev` – runs jest, watching for file changes
27+
- `pnpm build` – production build
28+
- `pnpm tsc` – type checks
29+
- `pnpm test`
3030

3131
## Releases
3232

0 commit comments

Comments
 (0)