Skip to content

Commit 61ef7b0

Browse files
committed
Switch to pnpm
1 parent bd04bde commit 61ef7b0

30 files changed

+7119
-7786
lines changed
Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,29 @@
1-
name: 'Setup test environment'
2-
description: ''
1+
name: "Setup test environment"
2+
description: ""
33
inputs: {}
44
outputs: {}
55
runs:
6-
using: "composite"
7-
steps:
8-
- name: Use Node.js ${{ matrix.node-version }}
9-
uses: actions/setup-node@v2
6+
using: "composite"
7+
steps:
8+
- uses: pnpm/action-setup@v2
9+
name: Install pnpm
1010
with:
11-
node-version: ${{ matrix.node-version }}
12-
cache: 'yarn'
13-
- run: yarn install --frozen-lockfile
14-
shell: "bash"
11+
version: 8
12+
run_install: false
13+
14+
- name: Get pnpm store directory
15+
shell: bash
16+
run: |
17+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
18+
19+
- uses: actions/cache@v3
20+
name: Setup pnpm cache
21+
with:
22+
path: ${{ env.STORE_PATH }}
23+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
24+
restore-keys: |
25+
${{ runner.os }}-pnpm-store-
26+
27+
- name: Install dependencies
28+
shell: bash
29+
run: pnpm install

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ jobs:
88

99
strategy:
1010
matrix:
11-
node-version: [16.x, 18.x]
11+
node-version: [16.x, 18.x, 20.x]
1212
os: [ubuntu-latest]
1313

1414
steps:
1515
- uses: actions/checkout@v2
1616
- uses: ./.github/actions/setup-test-env
1717
- name: Build JS
18-
run: yarn build
18+
run: pnpm build
1919
- name: Run Tests
20-
run: yarn run test
20+
run: pnpm run test
2121
- name: Run Lint
22-
run: yarn run lint
22+
run: pnpm run lint
2323

2424
automerge:
2525
needs: build

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- uses: actions/checkout@v2
1818
- uses: ./.github/actions/setup-test-env
1919
- name: Build all packages
20-
run: yarn build
20+
run: pnpm build
2121
- id: npm-publish
2222
name: Publish fastify-renderer
2323
uses: JS-DevTools/npm-publish@v1
@@ -30,4 +30,4 @@ jobs:
3030
if: ${{ steps.npm-publish.outputs.type != 'none' }}
3131
with:
3232
tag_name: ${{ steps.npm-publish.outputs.version }}
33-
generate_release_notes: true
33+
generate_release_notes: true

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jspm_packages/
2929
# Output of 'npm pack'
3030
*.tgz
3131

32-
# Yarn Integrity file
32+
# pnpm Integrity file
3333
.yarn-integrity
3434

3535
# dotenv environment variables file

.swcrc

Lines changed: 0 additions & 18 deletions
This file was deleted.

Contributing.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,47 @@
1-
# Contributing to fastify-renderer
1+
# Contributing to fastify-renderer
22

33
See below for information on how fastify-renderer's community is governed.
4+
5+
## Development
6+
7+
### Running a development server for a test app
8+
9+
To run a local dev server that mounts the monorepo version of `fastify-render` in a test app, run
10+
11+
```shell
12+
pnpm -F=simple-react dev
13+
```
14+
15+
### Running tests
16+
17+
You can run all the tests with:
18+
19+
```shell
20+
pnpm test
21+
```
22+
23+
You can run a specific test file with:
24+
25+
```shell
26+
pnpm test packages/test-apps/simple-react/test/some-test-file.spec.ts
27+
```
28+
29+
You can run a specific test case with:
30+
31+
```shell
32+
pnpm test packages/test-apps/simple-react/test/some-test-file.spec.ts -- -t "the case name"
33+
```
34+
35+
#### Debugging Playwright tests
36+
37+
Playwright supports a handy debug environment variable:
38+
39+
```shell
40+
PWDEBUG=1 pnpm test packages/test-apps/simple-react/test/some-test-file.spec.ts
41+
```
42+
43+
This pops open a headful browser for running tests, and a UI for stepping through each execution element as it happens.
44+
445
## Releases
546

647
Bump the version with `npm version <minor|major|patch>` then commit the change to git. When your changes get pushed/merged to `main` on github, Github Actions will run the `release` workflow and automatically publish the release to NPM.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ Features:
2222
npm install fastify-renderer --save
2323
# Using yarn
2424
yarn install fastify-renderer
25+
# Using pnpm
26+
pnpm install fastify-renderer
2527
```
2628

2729
## Registering the plugin

package.json

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,15 @@
22
"name": "workspace",
33
"private": true,
44
"description": "Simple, high performance client side app renderer for Fastify.",
5-
"workspaces": [
6-
"packages/fastify-renderer",
7-
"packages/test-apps/*"
8-
],
95
"scripts": {
10-
"watch": "yarn workspace fastify-renderer watch",
11-
"build": "yarn workspaces run build",
12-
"typecheck": "yarn workspaces run typecheck",
6+
"watch": "pnpm -F=fastify-renderer watch",
7+
"build": "pnpm -r build",
8+
"typecheck": "pnpm -r typecheck",
139
"lint": "eslint \"packages/**/*.{js,ts,tsx}\"",
1410
"lint:fix": "prettier --loglevel warn --write \"packages/**/*.{ts,tsx}\" && eslint \"packages/**/*.{ts,tsx}\" --quiet --fix",
15-
"release": "yarn workspace fastify-renderer publish",
16-
"prerelease": "yarn workspace fastify-renderer run gitpkg publish",
11+
"release": "pnpm -F=fastify-renderer publish",
12+
"preinstall": "npx only-allow pnpm",
13+
"prerelease": "pnpm -F=fastify-renderer run gitpkg publish",
1714
"test": "jest --forceExit -w=1",
1815
"test:debug": "cross-env FR_DEBUG_SERVE=1 node --inspect-brk ./node_modules/.bin/jest --forceExit"
1916
},
@@ -37,18 +34,30 @@
3734
"node": ">= 12.0.0"
3835
},
3936
"dependencies": {
40-
"fastify-renderer": "*"
41-
},
42-
"resolutions": {
43-
"react": "0.0.0-experimental-4ead6b530",
44-
"react-dom": "0.0.0-experimental-4ead6b530",
45-
"@types/react": "17.0.4",
46-
"@types/react-dom": "17.0.4"
37+
"fastify-renderer": "workspace:*"
4738
},
4839
"devDependencies": {
4940
"cross-env": "^7.0.3",
41+
"eslint": "^7.32.0",
42+
"eslint-config-prettier": "^8.5.0",
43+
"eslint-plugin-import": "^2.26.0",
44+
"eslint-plugin-prettier": "^3.4.1",
45+
"eslint-plugin-react": "^7.31.7",
46+
"eslint-plugin-react-hooks": "^4.6.0",
47+
"expect-playwright": "^0.8.0",
5048
"fs-extra": "^10.1.0",
49+
"jest": "^28.1.3",
5150
"playwright-chromium": "^1.25.0",
52-
"wds": "^0.12.0"
51+
"prettier": "^2.7.1",
52+
"prettier-plugin-organize-imports": "^2.3.4",
53+
"wds": "^0.18.1"
54+
},
55+
"pnpm": {
56+
"overrides": {
57+
"react": "0.0.0-experimental-4ead6b530",
58+
"react-dom": "0.0.0-experimental-4ead6b530",
59+
"@types/react": "17.0.4",
60+
"@types/react-dom": "17.0.4"
61+
}
5362
}
5463
}

packages/fastify-renderer/.swcrc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"jsc": {
3+
"parser": {
4+
"syntax": "typescript",
5+
"tsx": true,
6+
"decorators": true,
7+
"dynamicImport": true,
8+
"externalHelpers": true
9+
},
10+
"target": "es2022"
11+
},
12+
"module": {
13+
"type": "commonjs",
14+
// turn on lazy imports for maximum reboot performance
15+
"lazy": true
16+
}
17+
}

packages/fastify-renderer/package.json

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@
5959
"dependencies": {
6060
"@opentelemetry/api": "^1.4.0",
6161
"@vitejs/plugin-react-refresh": "^1.3.6",
62-
"fastify-accepts": "^2.1.0",
62+
"@fastify/accepts": "^3.0.0",
63+
"@fastify/static": "^5.0.0",
6364
"fastify-express": "^0.3.3",
6465
"fastify-plugin": "^3.0.1",
65-
"fastify-static": "^4.6.1",
6666
"http-errors": "^1.8.1",
6767
"middie": "^5.4.0",
6868
"path-to-regexp": "^6.2.1",
@@ -77,8 +77,8 @@
7777
"react-dom": "experimental"
7878
},
7979
"devDependencies": {
80-
"@swc/core": "^1.3.9",
81-
"@swc/jest": "^0.2.26",
80+
"@swc/core": "^1.3.95",
81+
"@swc/jest": "^0.2.29",
8282
"@types/connect": "^3.4.35",
8383
"@types/jest": "^26.0.24",
8484
"@types/node": "^14.17.20",
@@ -88,20 +88,12 @@
8888
"@typescript-eslint/eslint-plugin": "^5.40.0",
8989
"@typescript-eslint/parser": "^5.40.0",
9090
"cheerio": "^1.0.0-rc.12",
91-
"eslint": "^7.32.0",
92-
"eslint-config-prettier": "^8.5.0",
93-
"eslint-plugin-import": "^2.26.0",
94-
"eslint-plugin-prettier": "^3.4.1",
95-
"eslint-plugin-react": "^7.31.7",
96-
"eslint-plugin-react-hooks": "^4.6.0",
9791
"fastify": "^3.29.0",
9892
"gitpkg": "^1.0.0-beta.2",
9993
"jest": "^28.1.3",
10094
"jest-playwright-preset": "^2.0.0",
10195
"npm-run-all": "^4.1.5",
10296
"pino-pretty": "^4.8.0",
103-
"prettier": "^2.7.1",
104-
"prettier-plugin-organize-imports": "^2.3.4",
10597
"react": "0.0.0-experimental-4ead6b530",
10698
"react-dom": "0.0.0-experimental-4ead6b530",
10799
"rimraf": "^3.0.2",

0 commit comments

Comments
 (0)