Skip to content

Commit 20026f3

Browse files
committed
update build
1 parent 6c6ce7c commit 20026f3

12 files changed

Lines changed: 88 additions & 24 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Build Wasm No Docker 🛠
22
'on':
33
workflow_dispatch: null
44
jobs:
5-
build-wasm:
5+
build-wasm-no-docker:
66
runs-on: ubuntu-latest
77
steps:
88
- name: Checkout Repository 📥

.github/workflows/build-wasm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55

66
jobs:
77
build-wasm:
8-
runs-on: ubuntu-latest
8+
runs-on: macos-latest
99
steps:
1010
- name: Checkout Repository 📥
1111
uses: actions/checkout@v4

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
jobs:
1111
build-wasm:
1212
name: Build WASM ${{ matrix.package }} 🔧
13-
runs-on: ubuntu-latest
13+
runs-on: macos-latest
1414
strategy:
1515
matrix:
1616
package:

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
"build": "pnpm --filter libpg-query build",
88
"test": "pnpm --filter libpg-query test",
99
"clean": "pnpm --filter libpg-query clean",
10-
"build:v17": "pnpm --filter @libpg-query/v17 build",
11-
"test:v17": "pnpm --filter @libpg-query/v17 test",
12-
"clean:v17": "pnpm --filter @libpg-query/v17 clean",
1310
"build:all": "pnpm -r build",
1411
"test:all": "pnpm -r test",
1512
"clean:all": "pnpm -r clean",

scripts/publish.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env node
2+
3+
const fs = require('fs');
4+
const path = require('path');
5+
const { execSync } = require('child_process');
6+
7+
const pkgPath = path.join(process.cwd(), 'package.json');
8+
9+
if (!fs.existsSync(pkgPath)) {
10+
console.error('❌ No package.json found in current directory.');
11+
process.exit(1);
12+
}
13+
14+
const original = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
15+
const publishMeta = original['x-publish'] || {};
16+
17+
const publishName = publishMeta.publishName || 'libpg-query';
18+
const distTag = process.env.TAG || publishMeta.distTag || 'latest';
19+
20+
if (!original.name || !original.version) {
21+
console.error('❌ package.json must include name and version');
22+
process.exit(1);
23+
}
24+
25+
const modified = { ...original, name: publishName };
26+
27+
try {
28+
console.log(`📦 Publishing ${publishName}@${original.version} with tag '${distTag}'...`);
29+
fs.writeFileSync(pkgPath, JSON.stringify(modified, null, 2));
30+
execSync(`pnpm publish --tag ${distTag}`, { stdio: 'inherit' });
31+
console.log('✅ Publish complete.');
32+
} catch (err) {
33+
console.error('❌ Publish failed:', err.message);
34+
} finally {
35+
fs.writeFileSync(pkgPath, JSON.stringify(original, null, 2));
36+
console.log('🔄 Restored original package.json');
37+
}

versions/13/package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
{
22
"name": "@libpg-query/v13",
3-
"version": "13.0.0",
4-
"description": "PostgreSQL 13 query parser (parse only) - Simplified API with smaller bundle size",
3+
"version": "13.4.0",
4+
"description": "The real PostgreSQL query parser",
55
"homepage": "https://github.com/launchql/libpg-query-node",
66
"main": "./wasm/index.cjs",
77
"module": "./wasm/index.js",
88
"typings": "./wasm/index.d.ts",
99
"publishConfig": {
1010
"access": "public"
1111
},
12+
"x-publish": {
13+
"publishName": "libpg-query",
14+
"pgVersion": "13",
15+
"distTag": "pg13"
16+
},
1217
"files": [
1318
"wasm/*"
1419
],
1520
"scripts": {
1621
"clean": "pnpm wasm:clean && rimraf wasm/*.js wasm/*.cjs wasm/*.d.ts",
1722
"build:js": "node scripts/build.js",
1823
"build": "pnpm clean && pnpm wasm:build && pnpm build:js",
24+
"publish:pkg": "node ../../scripts/publish.js",
1925
"wasm:make": "docker run --rm -v $(pwd):/src -u $(id -u):$(id -g) -e EMSCRIPTEN=1 emscripten/emsdk emmake make",
2026
"wasm:build": "pnpm wasm:make build",
2127
"wasm:rebuild": "pnpm wasm:make rebuild",

versions/13/test/parsing.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function removeLocationProperties(obj) {
2525

2626
describe("Query Parsing", () => {
2727
before(async () => {
28-
await query.parse("SELECT 1");
28+
await query.loadModule();
2929
});
3030

3131
describe("Sync Parsing", () => {
@@ -40,9 +40,9 @@ describe("Query Parsing", () => {
4040
(it) => it.stmts[0].stmt.SelectStmt.targetList
4141
);
4242

43-
assert.equal(selectedDatas[0][0].ResTarget.val.A_Const.ival.ival, 1);
44-
assert.equal(selectedDatas[1][0].ResTarget.val.A_Const.isnull, true);
45-
assert.equal(selectedDatas[2][0].ResTarget.val.A_Const.sval.sval, "");
43+
assert.equal(selectedDatas[0][0].ResTarget.val.A_Const.val.Integer.ival, 1);
44+
assert.ok(selectedDatas[1][0].ResTarget.val.A_Const.val.Null);
45+
assert.equal(selectedDatas[2][0].ResTarget.val.A_Const.val.String.str, "");
4646
assert.equal(selectedDatas[3].length, 2);
4747
});
4848

versions/14/package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
{
22
"name": "@libpg-query/v14",
3-
"version": "14.0.0",
4-
"description": "PostgreSQL 14 query parser (parse only) - Simplified API with smaller bundle size",
3+
"version": "14.1.0",
4+
"description": "The real PostgreSQL query parser",
55
"homepage": "https://github.com/launchql/libpg-query-node",
66
"main": "./wasm/index.cjs",
77
"module": "./wasm/index.js",
88
"typings": "./wasm/index.d.ts",
99
"publishConfig": {
1010
"access": "public"
1111
},
12+
"x-publish": {
13+
"publishName": "libpg-query",
14+
"pgVersion": "14",
15+
"distTag": "pg14"
16+
},
1217
"files": [
1318
"wasm/*"
1419
],
1520
"scripts": {
1621
"clean": "pnpm wasm:clean && rimraf wasm/*.js wasm/*.cjs wasm/*.d.ts",
1722
"build:js": "node scripts/build.js",
1823
"build": "pnpm clean && pnpm wasm:build && pnpm build:js",
24+
"publish:pkg": "node ../../scripts/publish.js",
1925
"wasm:make": "docker run --rm -v $(pwd):/src -u $(id -u):$(id -g) emscripten/emsdk emmake make",
2026
"wasm:build": "pnpm wasm:make build",
2127
"wasm:rebuild": "pnpm wasm:make rebuild",

versions/14/test/parsing.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function removeLocationProperties(obj) {
2525

2626
describe("Query Parsing", () => {
2727
before(async () => {
28-
await query.parse("SELECT 1");
28+
await query.loadModule();
2929
});
3030

3131
describe("Sync Parsing", () => {
@@ -40,9 +40,9 @@ describe("Query Parsing", () => {
4040
(it) => it.stmts[0].stmt.SelectStmt.targetList
4141
);
4242

43-
assert.equal(selectedDatas[0][0].ResTarget.val.A_Const.ival.ival, 1);
44-
assert.equal(selectedDatas[1][0].ResTarget.val.A_Const.isnull, true);
45-
assert.equal(selectedDatas[2][0].ResTarget.val.A_Const.sval.sval, "");
43+
assert.equal(selectedDatas[0][0].ResTarget.val.A_Const.val.Integer.ival, 1);
44+
assert.ok(selectedDatas[1][0].ResTarget.val.A_Const.val.Null);
45+
assert.equal(selectedDatas[2][0].ResTarget.val.A_Const.val.String.str, "");
4646
assert.equal(selectedDatas[3].length, 2);
4747
});
4848

versions/15/package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
{
22
"name": "@libpg-query/v15",
3-
"version": "15.0.0",
4-
"description": "PostgreSQL 15 query parser (parse only) - Simplified API with smaller bundle size",
3+
"version": "15.3.0",
4+
"description": "The real PostgreSQL query parser",
55
"homepage": "https://github.com/launchql/libpg-query-node",
66
"main": "./wasm/index.cjs",
77
"module": "./wasm/index.js",
88
"typings": "./wasm/index.d.ts",
99
"publishConfig": {
1010
"access": "public"
1111
},
12+
"x-publish": {
13+
"publishName": "libpg-query",
14+
"pgVersion": "15",
15+
"distTag": "pg15"
16+
},
1217
"files": [
1318
"wasm/*"
1419
],
1520
"scripts": {
1621
"clean": "pnpm wasm:clean && rimraf wasm/*.js wasm/*.cjs wasm/*.d.ts",
1722
"build:js": "node scripts/build.js",
1823
"build": "pnpm clean && pnpm wasm:build && pnpm build:js",
24+
"publish:pkg": "node ../../scripts/publish.js",
1925
"wasm:make": "docker run --rm -v $(pwd):/src -u $(id -u):$(id -g) emscripten/emsdk emmake make",
2026
"wasm:build": "pnpm wasm:make build",
2127
"wasm:rebuild": "pnpm wasm:make rebuild",

0 commit comments

Comments
 (0)