Skip to content
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
30 changes: 25 additions & 5 deletions .github/workflows/build-wasm-no-docker.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build Wasm 🛠
name: Build Wasm No Docker 🛠
'on':
workflow_dispatch: null
jobs:
Expand All @@ -11,10 +11,28 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: yarn
- name: Install and Build 🚀

- name: Setup pnpm 📦
uses: pnpm/action-setup@v2
with:
version: 8.15.0

- name: Get pnpm store directory 📁
shell: bash
run: |
yarn
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup pnpm cache 🗄️
uses: actions/cache@v3
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install Dependencies 🧶
run: pnpm install

- name: Install Emscripten ✍🏻
run: |
sudo apt-get update
Expand All @@ -24,13 +42,15 @@ jobs:
./emsdk install 3.1.59
./emsdk activate 3.1.59
source ./emsdk_env.sh
working-directory: libpg-query
- name: Build with Emscripten 🏗
run: |
source ./emsdk/emsdk_env.sh
emmake make
emmake make build
working-directory: libpg-query
- name: Archive production artifacts 🏛
uses: actions/upload-artifact@v4
with:
name: wasm-artifacts
path: wasm
path: libpg-query/wasm
26 changes: 22 additions & 4 deletions .github/workflows/build-wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,35 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'yarn'

- name: Setup pnpm 📦
uses: pnpm/action-setup@v2
with:
version: 8.15.0

- name: Get pnpm store directory 📁
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup pnpm cache 🗄️
uses: actions/cache@v3
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install Dependencies 🧶
run: yarn install
run: pnpm install

- name: Build WASM 🏗
run: npm run wasm:build
run: pnpm run build
working-directory: libpg-query

- name: Archive production artifacts 🏛
uses: actions/upload-artifact@v4
with:
name: wasm-artifacts
path: wasm/
path: libpg-query/wasm/
retention-days: 7
51 changes: 43 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,37 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'yarn'

- name: Setup pnpm 📦
uses: pnpm/action-setup@v2
with:
version: 8.15.0

- name: Get pnpm store directory 📁
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup pnpm cache 🗄️
uses: actions/cache@v3
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install Dependencies 🧶
run: yarn install
run: pnpm install

- name: Build WASM 🏗
run: npm run wasm:build
run: pnpm run build
working-directory: libpg-query

- name: Upload WASM Artifacts 📦
uses: actions/upload-artifact@v4
with:
name: wasm-artifacts
path: wasm/
path: libpg-query/wasm/
retention-days: 1

test:
Expand All @@ -50,16 +68,33 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'yarn'

- name: Setup pnpm 📦
uses: pnpm/action-setup@v2
with:
version: 8.15.0

- name: Get pnpm store directory 📁
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup pnpm cache 🗄️
uses: actions/cache@v3
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install Dependencies 🧶
run: yarn install
run: pnpm install

- name: Download WASM Artifacts 📥
uses: actions/download-artifact@v4
with:
name: wasm-artifacts
path: wasm/
path: libpg-query/wasm/

- name: Run Tests 🔍
run: yarn test
run: pnpm run test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ wasm/libpg-query.js
esm/
cjs/
.claude

# pnpm
.pnpm-store/
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"workbench.colorTheme": "Default Dark Modern",
"workbench.startupEditor": "none"
}
5 changes: 0 additions & 5 deletions .yamlize/config/config.yaml

This file was deleted.

8 changes: 0 additions & 8 deletions .yamlize/workflows/build.yaml

This file was deleted.

19 changes: 0 additions & 19 deletions .yamlize/workflows/yaml/build-wasm.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions .yamlize/workflows/yaml/emscripten/build.yaml

This file was deleted.

9 changes: 0 additions & 9 deletions .yamlize/workflows/yaml/emscripten/install.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions .yamlize/workflows/yaml/git/checkout.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions .yamlize/workflows/yaml/git/configure.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions .yamlize/workflows/yaml/node/setup.yaml

This file was deleted.

28 changes: 21 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# libpg-query

---

## 🚨 Updates

**2024-06: This project has migrated to a [pnpm workspace](https://pnpm.io/workspaces)!**

- All development and CI now use pnpm for dependency management and scripts.
- The main package is now located in the `libpg-query` subdirectory.
- Please use `pnpm install`, `pnpm run build`, `pnpm run test`, and `pnpm run clean` from the root directory.
- See below for updated instructions.

---

<p align="center" width="100%">
<img src="https://github.com/launchql/libpg-query-node/assets/545047/5fd420cc-cdc6-4211-9b0f-0eca8321ba72" alt="webincubator" width="100">
</p>
Expand Down Expand Up @@ -267,27 +280,28 @@ This package uses a **WASM-only build system** for true cross-platform compatibi
### Prerequisites

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

### Building WASM Artifacts

1. **Install dependencies:**
```bash
npm install
pnpm install
```

2. **Build WASM artifacts:**
```bash
npm run wasm:build
pnpm run build
```

3. **Clean WASM build (if needed):**
```bash
npm run wasm:clean
pnpm run clean
```

4. **Rebuild WASM artifacts from scratch:**
```bash
npm run wasm:clean && npm run wasm:build
pnpm run clean && pnpm run build
```

### Build Process Details
Expand All @@ -303,15 +317,15 @@ The WASM build process:
### Running Tests

```bash
npm test
pnpm run test
```

### Test Requirements

- WASM artifacts must be built before running tests
- If tests fail with "fetch failed" errors, rebuild WASM artifacts:
```bash
npm run wasm:clean && npm run wasm:build && npm test
pnpm run clean && pnpm run build && pnpm run test
```


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

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

**"WASM module not initialized" errors:**
- Ensure you call an async method first to initialize the WASM module
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading