Skip to content

Commit eede793

Browse files
committed
pnpm
1 parent b5fed06 commit eede793

File tree

10 files changed

+1482
-1427
lines changed

10 files changed

+1482
-1427
lines changed

.github/workflows/build-wasm-no-docker.yaml

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,28 @@ jobs:
1111
uses: actions/setup-node@v4
1212
with:
1313
node-version: 20.x
14-
cache: yarn
15-
cache-dependency-path: 'libpg-query/yarn.lock'
16-
- name: Install and Build 🚀
14+
15+
- name: Setup pnpm 📦
16+
uses: pnpm/action-setup@v2
17+
with:
18+
version: 8.15.0
19+
20+
- name: Get pnpm store directory 📁
21+
shell: bash
1722
run: |
18-
yarn
19-
working-directory: libpg-query
23+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
24+
25+
- name: Setup pnpm cache 🗄️
26+
uses: actions/cache@v3
27+
with:
28+
path: ${{ env.STORE_PATH }}
29+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
30+
restore-keys: |
31+
${{ runner.os }}-pnpm-store-
32+
33+
- name: Install Dependencies 🧶
34+
run: pnpm install
35+
2036
- name: Install Emscripten ✍🏻
2137
run: |
2238
sudo apt-get update
@@ -26,15 +42,15 @@ jobs:
2642
./emsdk install 3.1.59
2743
./emsdk activate 3.1.59
2844
source ./emsdk_env.sh
29-
working-directory: libpg-query
45+
working-directory: libpq-query
3046
- name: Build with Emscripten 🏗
3147
run: |
3248
source ./emsdk/emsdk_env.sh
3349
emmake make
3450
emmake make build
35-
working-directory: libpg-query
51+
working-directory: libpq-query
3652
- name: Archive production artifacts 🏛
3753
uses: actions/upload-artifact@v4
3854
with:
3955
name: wasm-artifacts
40-
path: libpg-query/wasm
56+
path: libpq-query/wasm

.github/workflows/build-wasm.yml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,35 @@ jobs:
1414
uses: actions/setup-node@v4
1515
with:
1616
node-version: '20.x'
17-
cache: 'yarn'
18-
cache-dependency-path: 'libpg-query/yarn.lock'
17+
18+
- name: Setup pnpm 📦
19+
uses: pnpm/action-setup@v2
20+
with:
21+
version: 8.15.0
22+
23+
- name: Get pnpm store directory 📁
24+
shell: bash
25+
run: |
26+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
27+
28+
- name: Setup pnpm cache 🗄️
29+
uses: actions/cache@v3
30+
with:
31+
path: ${{ env.STORE_PATH }}
32+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
33+
restore-keys: |
34+
${{ runner.os }}-pnpm-store-
1935
2036
- name: Install Dependencies 🧶
21-
run: yarn install
22-
working-directory: libpg-query
37+
run: pnpm install
2338

2439
- name: Build WASM 🏗
25-
run: npm run wasm:build
26-
working-directory: libpg-query
40+
run: pnpm run build
41+
working-directory: libpq-query
2742

2843
- name: Archive production artifacts 🏛
2944
uses: actions/upload-artifact@v4
3045
with:
3146
name: wasm-artifacts
32-
path: libpg-query/wasm/
47+
path: libpq-query/wasm/
3348
retention-days: 7

.github/workflows/ci.yml

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,37 @@ jobs:
1919
uses: actions/setup-node@v4
2020
with:
2121
node-version: '20.x'
22-
cache: 'yarn'
23-
cache-dependency-path: 'libpg-query/yarn.lock'
22+
23+
- name: Setup pnpm 📦
24+
uses: pnpm/action-setup@v2
25+
with:
26+
version: 8.15.0
27+
28+
- name: Get pnpm store directory 📁
29+
shell: bash
30+
run: |
31+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
32+
33+
- name: Setup pnpm cache 🗄️
34+
uses: actions/cache@v3
35+
with:
36+
path: ${{ env.STORE_PATH }}
37+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
38+
restore-keys: |
39+
${{ runner.os }}-pnpm-store-
2440
2541
- name: Install Dependencies 🧶
26-
run: yarn install
27-
working-directory: libpg-query
42+
run: pnpm install
2843

2944
- name: Build WASM 🏗
30-
run: npm run wasm:build
31-
working-directory: libpg-query
45+
run: pnpm run build
46+
working-directory: libpq-query
3247

3348
- name: Upload WASM Artifacts 📦
3449
uses: actions/upload-artifact@v4
3550
with:
3651
name: wasm-artifacts
37-
path: libpg-query/wasm/
52+
path: libpq-query/wasm/
3853
retention-days: 1
3954

4055
test:
@@ -53,19 +68,33 @@ jobs:
5368
uses: actions/setup-node@v4
5469
with:
5570
node-version: '20.x'
56-
cache: 'yarn'
57-
cache-dependency-path: 'libpg-query/yarn.lock'
71+
72+
- name: Setup pnpm 📦
73+
uses: pnpm/action-setup@v2
74+
with:
75+
version: 8.15.0
76+
77+
- name: Get pnpm store directory 📁
78+
shell: bash
79+
run: |
80+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
81+
82+
- name: Setup pnpm cache 🗄️
83+
uses: actions/cache@v3
84+
with:
85+
path: ${{ env.STORE_PATH }}
86+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
87+
restore-keys: |
88+
${{ runner.os }}-pnpm-store-
5889
5990
- name: Install Dependencies 🧶
60-
run: yarn install
61-
working-directory: libpg-query
91+
run: pnpm install
6292

6393
- name: Download WASM Artifacts 📥
6494
uses: actions/download-artifact@v4
6595
with:
6696
name: wasm-artifacts
67-
path: libpg-query/wasm/
97+
path: libpq-query/wasm/
6898

6999
- name: Run Tests 🔍
70-
run: yarn test
71-
working-directory: libpg-query
100+
run: pnpm run test

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ wasm/libpg-query.js
99
esm/
1010
cjs/
1111
.claude
12+
13+
# pnpm
14+
.pnpm-store/

README.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# libpg-query
22

3+
---
4+
5+
## 🚨 Updates
6+
7+
**2024-06: This project has migrated to a [pnpm workspace](https://pnpm.io/workspaces)!**
8+
9+
- All development and CI now use pnpm for dependency management and scripts.
10+
- The main package is now located in the `libpq-query` subdirectory.
11+
- Please use `pnpm install`, `pnpm run build`, `pnpm run test`, and `pnpm run clean` from the root directory.
12+
- See below for updated instructions.
13+
14+
---
15+
316
<p align="center" width="100%">
417
<img src="https://github.com/launchql/libpg-query-node/assets/545047/5fd420cc-cdc6-4211-9b0f-0eca8321ba72" alt="webincubator" width="100">
518
</p>
@@ -267,27 +280,28 @@ This package uses a **WASM-only build system** for true cross-platform compatibi
267280
### Prerequisites
268281

269282
- Node.js (version 16 or higher recommended)
283+
- [pnpm](https://pnpm.io/) (v8+ recommended)
270284

271285
### Building WASM Artifacts
272286

273287
1. **Install dependencies:**
274288
```bash
275-
npm install
289+
pnpm install
276290
```
277291

278292
2. **Build WASM artifacts:**
279293
```bash
280-
npm run wasm:build
294+
pnpm run build
281295
```
282296

283297
3. **Clean WASM build (if needed):**
284298
```bash
285-
npm run wasm:clean
299+
pnpm run clean
286300
```
287301

288302
4. **Rebuild WASM artifacts from scratch:**
289303
```bash
290-
npm run wasm:clean && npm run wasm:build
304+
pnpm run clean && pnpm run build
291305
```
292306

293307
### Build Process Details
@@ -303,15 +317,15 @@ The WASM build process:
303317
### Running Tests
304318

305319
```bash
306-
npm test
320+
pnpm run test
307321
```
308322

309323
### Test Requirements
310324

311325
- WASM artifacts must be built before running tests
312326
- If tests fail with "fetch failed" errors, rebuild WASM artifacts:
313327
```bash
314-
npm run wasm:clean && npm run wasm:build && npm test
328+
pnpm run clean && pnpm run build && pnpm run test
315329
```
316330

317331

@@ -339,7 +353,7 @@ Our latest is built with `17-latest` branch from libpg_query
339353

340354
**"fetch failed" errors during tests:**
341355
- This indicates stale or missing WASM artifacts
342-
- Solution: `npm run wasm:clean && npm run wasm:build`
356+
- Solution: `pnpm run clean && pnpm run build`
343357

344358
**"WASM module not initialized" errors:**
345359
- Ensure you call an async method first to initialize the WASM module

libpq-query/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
"proto.js"
1515
],
1616
"scripts": {
17-
"clean": "yarn wasm:clean && rimraf cjs esm",
17+
"clean": "pnpm wasm:clean && rimraf cjs esm",
1818
"build:js": "node scripts/build.js",
19-
"build": "yarn clean; yarn wasm:build; yarn build:js",
19+
"build": "pnpm clean; pnpm wasm:build; pnpm build:js",
2020
"wasm:make": "docker run --rm -v $(pwd):/src -u $(id -u):$(id -g) emscripten/emsdk emmake make",
21-
"wasm:build": "yarn wasm:make build",
22-
"wasm:rebuild": "yarn wasm:make rebuild",
23-
"wasm:clean": "yarn wasm:make clean",
24-
"wasm:clean-cache": "yarn wasm:make clean-cache",
21+
"wasm:build": "pnpm wasm:make build",
22+
"wasm:rebuild": "pnpm wasm:make rebuild",
23+
"wasm:clean": "pnpm wasm:make clean",
24+
"wasm:clean-cache": "pnpm wasm:make clean-cache",
2525
"test": "mocha test/*.test.js --timeout 5000",
2626
"yamlize": "node ./scripts/yamlize.js",
2727
"protogen": "node ./scripts/protogen.js"

0 commit comments

Comments
 (0)