From 3eef8a0fe5b8f476ac5136e26cc5c943c1e6cb68 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Sun, 22 Jun 2025 16:40:33 -0700 Subject: [PATCH 01/15] Versions --- PUBLISH.md | 41 ++++++ package.json | 1 + scripts/publish-single-version.js | 37 +++++ scripts/publish-versions.js | 215 ++++++++++++++++++++++++++---- versions/13/package.json | 2 +- versions/14/package.json | 2 +- versions/15/package.json | 2 +- versions/16/package.json | 2 +- versions/17/package.json | 2 +- 9 files changed, 274 insertions(+), 30 deletions(-) create mode 100644 scripts/publish-single-version.js mode change 100644 => 100755 scripts/publish-versions.js diff --git a/PUBLISH.md b/PUBLISH.md index fda1f86..0c43076 100644 --- a/PUBLISH.md +++ b/PUBLISH.md @@ -2,6 +2,19 @@ ## Automated Publishing (Recommended) +### Version Packages (libpg-query) +```bash +pnpm run publish:versions +``` + +This interactive script will: +- Check for uncommitted changes (will error if any exist) +- Let you select which versions to publish (or all) +- Also includes the full package (@libpg-query/parser) +- Ask for version bump type (patch or minor only) +- Build, test, and publish each selected version +- Optionally promote pg17 to latest + ### Types Packages ```bash pnpm run publish:types @@ -113,4 +126,32 @@ pnpm run publish:pkg npm install libpg-query@pg17 # PostgreSQL 17 specific npm install libpg-query@pg16 # PostgreSQL 16 specific npm install libpg-query # Latest/default version +``` + +## Full Package (@libpg-query/parser) + +### Quick Publish +```bash +cd full +pnpm version patch +git add . && git commit -m "release: bump @libpg-query/parser version" +pnpm build +pnpm test +pnpm publish --tag pg17 +``` + +### Promote to latest (optional) +```bash +npm dist-tag add @libpg-query/parser@pg17 latest +``` + +### What it does +- Publishes `@libpg-query/parser` with tag `pg17` +- Currently based on PostgreSQL 17 +- Includes full parser with all features + +### Install published package +```bash +npm install @libpg-query/parser@pg17 # PostgreSQL 17 specific +npm install @libpg-query/parser # Latest version ``` \ No newline at end of file diff --git a/package.json b/package.json index 66afd46..5766b8c 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "prepare:enums": "node scripts/prepare-enums.js", "publish:types": "node scripts/publish-types.js", "publish:enums": "node scripts/publish-enums.js", + "publish:versions": "node scripts/publish-versions.js", "update:versions-types": "node scripts/update-versions-types.js" }, "devDependencies": { diff --git a/scripts/publish-single-version.js b/scripts/publish-single-version.js new file mode 100644 index 0000000..c1ad0aa --- /dev/null +++ b/scripts/publish-single-version.js @@ -0,0 +1,37 @@ +#!/usr/bin/env node + +const fs = require('fs'); +const path = require('path'); +const { execSync } = require('child_process'); + +const pkgPath = path.join(process.cwd(), 'package.json'); + +if (!fs.existsSync(pkgPath)) { + console.error('โŒ No package.json found in current directory.'); + process.exit(1); +} + +const original = JSON.parse(fs.readFileSync(pkgPath, 'utf8')); +const publishMeta = original['x-publish'] || {}; + +const publishName = publishMeta.publishName || 'libpg-query'; +const distTag = process.env.TAG || publishMeta.distTag || 'latest'; + +if (!original.name || !original.version) { + console.error('โŒ package.json must include name and version'); + process.exit(1); +} + +const modified = { ...original, name: publishName }; + +try { + console.log(`๐Ÿ“ฆ Publishing ${publishName}@${original.version} with tag '${distTag}'...`); + fs.writeFileSync(pkgPath, JSON.stringify(modified, null, 2)); + execSync(`npm publish --tag ${distTag}`, { stdio: 'inherit' }); + console.log('โœ… Publish complete.'); +} catch (err) { + console.error('โŒ Publish failed:', err.message); +} finally { + fs.writeFileSync(pkgPath, JSON.stringify(original, null, 2)); + console.log('๐Ÿ”„ Restored original package.json'); +} diff --git a/scripts/publish-versions.js b/scripts/publish-versions.js old mode 100644 new mode 100755 index c1ad0aa..e5c8678 --- a/scripts/publish-versions.js +++ b/scripts/publish-versions.js @@ -3,35 +3,200 @@ const fs = require('fs'); const path = require('path'); const { execSync } = require('child_process'); +const readline = require('readline'); -const pkgPath = path.join(process.cwd(), 'package.json'); +const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout +}); -if (!fs.existsSync(pkgPath)) { - console.error('โŒ No package.json found in current directory.'); - process.exit(1); -} +const question = (query) => new Promise((resolve) => rl.question(query, resolve)); -const original = JSON.parse(fs.readFileSync(pkgPath, 'utf8')); -const publishMeta = original['x-publish'] || {}; +async function main() { + console.log('๐Ÿš€ Version Packages Publishing Tool\n'); -const publishName = publishMeta.publishName || 'libpg-query'; -const distTag = process.env.TAG || publishMeta.distTag || 'latest'; + // Check for uncommitted changes + try { + execSync('git diff --quiet && git diff --cached --quiet'); + } catch (error) { + console.error('โŒ You have uncommitted changes. Please commit or stash them first.'); + process.exit(1); + } -if (!original.name || !original.version) { - console.error('โŒ package.json must include name and version'); - process.exit(1); -} + // Get all version directories + const versionsDir = path.join(__dirname, '..', 'versions'); + const versionDirs = fs.readdirSync(versionsDir) + .filter(dir => /^\d+$/.test(dir)) + .sort((a, b) => parseInt(b) - parseInt(a)); // Sort descending + + // Also check for full package + const fullPackagePath = path.join(__dirname, '..', 'full', 'package.json'); + const hasFullPackage = fs.existsSync(fullPackagePath); + + console.log('๐Ÿ“ฆ Available packages:'); + versionDirs.forEach(v => console.log(` - PostgreSQL ${v} (versions/${v})`)); + if (hasFullPackage) { + console.log(` - Full package (./full) - PostgreSQL 17`); + } + console.log(); + + // Ask which versions to publish + const publishAll = await question('Publish all packages? (y/N): '); + let selectedVersions = []; + let includeFullPackage = false; + + if (publishAll.toLowerCase() === 'y') { + selectedVersions = versionDirs; + includeFullPackage = hasFullPackage; + } else { + // Let user select versions + for (const version of versionDirs) { + const publish = await question(`Publish PostgreSQL ${version}? (y/N): `); + if (publish.toLowerCase() === 'y') { + selectedVersions.push(version); + } + } + + if (hasFullPackage) { + const publishFull = await question(`Publish full package (PostgreSQL 17)? (y/N): `); + includeFullPackage = publishFull.toLowerCase() === 'y'; + } + } + + if (selectedVersions.length === 0 && !includeFullPackage) { + console.log('\nโŒ No packages selected for publishing.'); + rl.close(); + return; + } -const modified = { ...original, name: publishName }; - -try { - console.log(`๐Ÿ“ฆ Publishing ${publishName}@${original.version} with tag '${distTag}'...`); - fs.writeFileSync(pkgPath, JSON.stringify(modified, null, 2)); - execSync(`npm publish --tag ${distTag}`, { stdio: 'inherit' }); - console.log('โœ… Publish complete.'); -} catch (err) { - console.error('โŒ Publish failed:', err.message); -} finally { - fs.writeFileSync(pkgPath, JSON.stringify(original, null, 2)); - console.log('๐Ÿ”„ Restored original package.json'); + // Ask for version bump type + console.log('\n๐Ÿ“ˆ Version bump type:'); + console.log(' 1. patch (0.0.x)'); + console.log(' 2. minor (0.x.0)'); + const bumpType = await question('Select bump type (1 or 2): '); + const bump = bumpType === '2' ? 'minor' : 'patch'; + + console.log(`\n๐Ÿ“‹ Will publish:`); + selectedVersions.forEach(v => console.log(` - PostgreSQL ${v} (${bump} bump)`)); + if (includeFullPackage) { + console.log(` - Full package (${bump} bump)`); + } + + const confirm = await question('\nProceed? (y/N): '); + if (confirm.toLowerCase() !== 'y') { + console.log('โŒ Publishing cancelled.'); + rl.close(); + return; + } + + console.log('\n๐Ÿ”จ Starting publish process...\n'); + + // Process each selected version + for (const version of selectedVersions) { + console.log(`\n๐Ÿ“ฆ Publishing PostgreSQL ${version}...`); + const versionPath = path.join(versionsDir, version); + + try { + // Version bump + console.log(` ๐Ÿ“ Bumping version (${bump})...`); + execSync(`pnpm version ${bump}`, { cwd: versionPath, stdio: 'inherit' }); + + // Commit + console.log(` ๐Ÿ’พ Committing version bump...`); + execSync(`git add package.json`, { cwd: versionPath }); + execSync(`git commit -m "release: bump libpg-query v${version} version"`, { stdio: 'inherit' }); + + // Build + console.log(` ๐Ÿ”จ Building...`); + execSync('pnpm build', { cwd: versionPath, stdio: 'inherit' }); + + // Test + console.log(` ๐Ÿงช Running tests...`); + execSync('pnpm test', { cwd: versionPath, stdio: 'inherit' }); + + // Publish + console.log(` ๐Ÿ“ค Publishing to npm...`); + execSync('pnpm run publish:pkg', { cwd: versionPath, stdio: 'inherit' }); + + console.log(` โœ… PostgreSQL ${version} published successfully!`); + } catch (error) { + console.error(` โŒ Failed to publish PostgreSQL ${version}:`, error.message); + const continuePublish = await question('Continue with other versions? (y/N): '); + if (continuePublish.toLowerCase() !== 'y') { + rl.close(); + process.exit(1); + } + } + } + + // Process full package if selected + if (includeFullPackage) { + console.log(`\n๐Ÿ“ฆ Publishing full package...`); + const fullPath = path.join(__dirname, '..', 'full'); + + try { + // Version bump + console.log(` ๐Ÿ“ Bumping version (${bump})...`); + execSync(`pnpm version ${bump}`, { cwd: fullPath, stdio: 'inherit' }); + + // Commit + console.log(` ๐Ÿ’พ Committing version bump...`); + execSync(`git add package.json`, { cwd: fullPath }); + execSync(`git commit -m "release: bump @libpg-query/parser version"`, { stdio: 'inherit' }); + + // Build + console.log(` ๐Ÿ”จ Building...`); + execSync('pnpm build', { cwd: fullPath, stdio: 'inherit' }); + + // Test + console.log(` ๐Ÿงช Running tests...`); + execSync('pnpm test', { cwd: fullPath, stdio: 'inherit' }); + + // Publish with pg17 tag + console.log(` ๐Ÿ“ค Publishing to npm with pg17 tag...`); + execSync('pnpm publish --tag pg17', { cwd: fullPath, stdio: 'inherit' }); + + console.log(` โœ… Full package published successfully with pg17 tag!`); + } catch (error) { + console.error(` โŒ Failed to publish full package:`, error.message); + } + } + + // Ask about promoting to latest + if (selectedVersions.includes('17') || includeFullPackage) { + console.log('\n๐Ÿท๏ธ Tag Management'); + + if (selectedVersions.includes('17')) { + const promoteVersions = await question('Promote libpg-query@pg17 to latest? (y/N): '); + if (promoteVersions.toLowerCase() === 'y') { + try { + execSync('npm dist-tag add libpg-query@pg17 latest', { stdio: 'inherit' }); + console.log('โœ… libpg-query@pg17 promoted to latest'); + } catch (error) { + console.error('โŒ Failed to promote tag:', error.message); + } + } + } + + if (includeFullPackage) { + const promoteFullPackage = await question('Promote @libpg-query/parser@pg17 to latest? (y/N): '); + if (promoteFullPackage.toLowerCase() === 'y') { + try { + execSync('npm dist-tag add @libpg-query/parser@pg17 latest', { stdio: 'inherit' }); + console.log('โœ… @libpg-query/parser@pg17 promoted to latest'); + } catch (error) { + console.error('โŒ Failed to promote tag:', error.message); + } + } + } + } + + console.log('\nโœจ Publishing complete!'); + rl.close(); } + +main().catch(error => { + console.error('โŒ Error:', error); + rl.close(); + process.exit(1); +}); \ No newline at end of file diff --git a/versions/13/package.json b/versions/13/package.json index 90906ad..8e27ee4 100644 --- a/versions/13/package.json +++ b/versions/13/package.json @@ -22,7 +22,7 @@ "clean": "pnpm wasm:clean && rimraf wasm/*.js wasm/*.cjs wasm/*.d.ts", "build:js": "node scripts/build.js", "build": "pnpm clean && pnpm wasm:build && pnpm build:js", - "publish:pkg": "node ../../scripts/publish-versions.js", + "publish:pkg": "node ../../scripts/publish-single-version.js", "wasm:make": "docker run --rm -v $(pwd):/src -u $(id -u):$(id -g) -e EMSCRIPTEN=1 emscripten/emsdk emmake make", "wasm:build": "pnpm wasm:make build", "wasm:rebuild": "pnpm wasm:make rebuild", diff --git a/versions/14/package.json b/versions/14/package.json index cf555a3..92112f3 100644 --- a/versions/14/package.json +++ b/versions/14/package.json @@ -22,7 +22,7 @@ "clean": "pnpm wasm:clean && rimraf wasm/*.js wasm/*.cjs wasm/*.d.ts", "build:js": "node scripts/build.js", "build": "pnpm clean && pnpm wasm:build && pnpm build:js", - "publish:pkg": "node ../../scripts/publish-versions.js", + "publish:pkg": "node ../../scripts/publish-single-version.js", "wasm:make": "docker run --rm -v $(pwd):/src -u $(id -u):$(id -g) emscripten/emsdk emmake make", "wasm:build": "pnpm wasm:make build", "wasm:rebuild": "pnpm wasm:make rebuild", diff --git a/versions/15/package.json b/versions/15/package.json index ed17f9e..3991e7c 100644 --- a/versions/15/package.json +++ b/versions/15/package.json @@ -22,7 +22,7 @@ "clean": "pnpm wasm:clean && rimraf wasm/*.js wasm/*.cjs wasm/*.d.ts", "build:js": "node scripts/build.js", "build": "pnpm clean && pnpm wasm:build && pnpm build:js", - "publish:pkg": "node ../../scripts/publish-versions.js", + "publish:pkg": "node ../../scripts/publish-single-version.js", "wasm:make": "docker run --rm -v $(pwd):/src -u $(id -u):$(id -g) emscripten/emsdk emmake make", "wasm:build": "pnpm wasm:make build", "wasm:rebuild": "pnpm wasm:make rebuild", diff --git a/versions/16/package.json b/versions/16/package.json index 69fdff3..a70a492 100644 --- a/versions/16/package.json +++ b/versions/16/package.json @@ -22,7 +22,7 @@ "clean": "pnpm wasm:clean && rimraf wasm/*.js wasm/*.cjs wasm/*.d.ts", "build:js": "node scripts/build.js", "build": "pnpm clean && pnpm wasm:build && pnpm build:js", - "publish:pkg": "node ../../scripts/publish-versions.js", + "publish:pkg": "node ../../scripts/publish-single-version.js", "wasm:make": "docker run --rm -v $(pwd):/src -u $(id -u):$(id -g) emscripten/emsdk emmake make", "wasm:build": "pnpm wasm:make build", "wasm:rebuild": "pnpm wasm:make rebuild", diff --git a/versions/17/package.json b/versions/17/package.json index 10b20af..60b3366 100644 --- a/versions/17/package.json +++ b/versions/17/package.json @@ -22,7 +22,7 @@ "clean": "pnpm wasm:clean && rimraf wasm/*.js wasm/*.cjs wasm/*.d.ts", "build:js": "node scripts/build.js", "build": "pnpm clean && pnpm wasm:build && pnpm build:js", - "publish:pkg": "node ../../scripts/publish-versions.js", + "publish:pkg": "node ../../scripts/publish-single-version.js", "wasm:make": "docker run --rm -v $(pwd):/src -u $(id -u):$(id -g) emscripten/emsdk emmake make", "wasm:build": "pnpm wasm:make build", "wasm:rebuild": "pnpm wasm:make rebuild", From 1dd42dfa3fb97d47411de7b69100047849e8dc8e Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Sun, 22 Jun 2025 16:41:10 -0700 Subject: [PATCH 02/15] release: bump libpg-query v17 version --- versions/17/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/17/package.json b/versions/17/package.json index 60b3366..6394422 100644 --- a/versions/17/package.json +++ b/versions/17/package.json @@ -1,6 +1,6 @@ { "name": "@libpg-query/v17", - "version": "17.4.1", + "version": "17.5.0", "description": "The real PostgreSQL query parser", "homepage": "https://github.com/launchql/libpg-query-node", "main": "./wasm/index.cjs", From 1845da046917cc7abda85653504d53ae236b96c5 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Sun, 22 Jun 2025 16:42:21 -0700 Subject: [PATCH 03/15] release: bump libpg-query v16 version --- versions/16/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/16/package.json b/versions/16/package.json index a70a492..2160cb7 100644 --- a/versions/16/package.json +++ b/versions/16/package.json @@ -1,6 +1,6 @@ { "name": "@libpg-query/v16", - "version": "16.4.1", + "version": "16.5.0", "description": "The real PostgreSQL query parser", "homepage": "https://github.com/launchql/libpg-query-node", "main": "./wasm/index.cjs", From fb6bcef676308bbc0179a1e530523badd3e57790 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Sun, 22 Jun 2025 16:43:32 -0700 Subject: [PATCH 04/15] release: bump libpg-query v15 version --- versions/15/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/15/package.json b/versions/15/package.json index 3991e7c..a650801 100644 --- a/versions/15/package.json +++ b/versions/15/package.json @@ -1,6 +1,6 @@ { "name": "@libpg-query/v15", - "version": "15.3.1", + "version": "15.4.0", "description": "The real PostgreSQL query parser", "homepage": "https://github.com/launchql/libpg-query-node", "main": "./wasm/index.cjs", From c7a96f442d93412c07c9a1beb7e0e0ad22cc2648 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Sun, 22 Jun 2025 16:44:44 -0700 Subject: [PATCH 05/15] release: bump libpg-query v14 version --- versions/14/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/14/package.json b/versions/14/package.json index 92112f3..5218df2 100644 --- a/versions/14/package.json +++ b/versions/14/package.json @@ -1,6 +1,6 @@ { "name": "@libpg-query/v14", - "version": "14.1.1", + "version": "14.2.0", "description": "The real PostgreSQL query parser", "homepage": "https://github.com/launchql/libpg-query-node", "main": "./wasm/index.cjs", From c9e5cb229e2dab688cb71a5f6ca7bc3cb8c2d007 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Sun, 22 Jun 2025 16:45:54 -0700 Subject: [PATCH 06/15] release: bump libpg-query v13 version --- versions/13/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/13/package.json b/versions/13/package.json index 8e27ee4..3aed0e9 100644 --- a/versions/13/package.json +++ b/versions/13/package.json @@ -1,6 +1,6 @@ { "name": "@libpg-query/v13", - "version": "13.4.1", + "version": "13.5.0", "description": "The real PostgreSQL query parser", "homepage": "https://github.com/launchql/libpg-query-node", "main": "./wasm/index.cjs", From d7523e394e8aedf674b66349be0bac7cea329828 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Sun, 22 Jun 2025 16:47:05 -0700 Subject: [PATCH 07/15] release: bump @libpg-query/parser version --- full/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/full/package.json b/full/package.json index 26c93be..8244687 100644 --- a/full/package.json +++ b/full/package.json @@ -1,6 +1,6 @@ { "name": "@libpg-query/parser", - "version": "17.5.1", + "version": "17.6.0", "description": "The real PostgreSQL query parser", "homepage": "https://github.com/launchql/libpg-query-node", "main": "./wasm/index.cjs", From b2caafc128a90aac7e127cf564c389ccc7d392ce Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Sun, 22 Jun 2025 17:11:37 -0700 Subject: [PATCH 08/15] updates --- PUBLISH.md | 4 +++- README.md | 2 +- full/README.md | 2 +- scripts/publish-single-version.js | 1 + scripts/publish-versions.js | 35 +++++++++++++++++++++++-------- versions/13/README.md | 2 +- versions/13/package.json | 2 +- versions/14/README.md | 2 +- versions/14/package.json | 2 +- versions/15/README.md | 2 +- versions/15/package.json | 2 +- versions/16/README.md | 2 +- versions/16/package.json | 2 +- versions/17/README.md | 2 +- versions/17/package.json | 2 +- 15 files changed, 42 insertions(+), 22 deletions(-) diff --git a/PUBLISH.md b/PUBLISH.md index 0c43076..8077522 100644 --- a/PUBLISH.md +++ b/PUBLISH.md @@ -12,7 +12,9 @@ This interactive script will: - Let you select which versions to publish (or all) - Also includes the full package (@libpg-query/parser) - Ask for version bump type (patch or minor only) -- Build, test, and publish each selected version +- Ask if you want to skip the build step (useful if already built) +- Always run tests (even if build is skipped) +- Publish each selected version - Optionally promote pg17 to latest ### Types Packages diff --git a/README.md b/README.md index e2e92af..11aa3f6 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Built to power [pgsql-parser](https://github.com/pyramation/pgsql-parser), this ## ๐Ÿš€ For Round-trip Codegen > ๐ŸŽฏ **Want to parse + deparse (full round trip)?** -> We highly recommend using [`pgsql-parser`](https://github.com/launchql/pgsql-parser) which leverages a pure TypeScript deparser that has been battle-tested against 21,000+ SQL statements and is built on top of libpg-query. +> We highly recommend using [`pgsql-parser`](https://github.com/launchql/pgsql-parser) which leverages a pure TypeScript deparser that has been battle-tested against 23,000+ SQL statements and is built on top of libpg-query. ## Installation diff --git a/full/README.md b/full/README.md index 1a31dd9..ffef7e2 100644 --- a/full/README.md +++ b/full/README.md @@ -35,7 +35,7 @@ Built to power [pgsql-parser](https://github.com/pyramation/pgsql-parser), this ## ๐Ÿš€ For Round-trip Codegen > ๐ŸŽฏ **Want to parse + deparse (full round trip)?** -> We highly recommend using [`pgsql-parser`](https://github.com/launchql/pgsql-parser) which leverages a pure TypeScript deparser that has been battle-tested against 21,000+ SQL statements and is built on top of libpg-query. +> We highly recommend using [`pgsql-parser`](https://github.com/launchql/pgsql-parser) which leverages a pure TypeScript deparser that has been battle-tested against 23,000+ SQL statements and is built on top of libpg-query. ## Installation diff --git a/scripts/publish-single-version.js b/scripts/publish-single-version.js index c1ad0aa..4dc0b50 100644 --- a/scripts/publish-single-version.js +++ b/scripts/publish-single-version.js @@ -27,6 +27,7 @@ const modified = { ...original, name: publishName }; try { console.log(`๐Ÿ“ฆ Publishing ${publishName}@${original.version} with tag '${distTag}'...`); fs.writeFileSync(pkgPath, JSON.stringify(modified, null, 2)); + // npm OK here since it's version, not dist/ package... execSync(`npm publish --tag ${distTag}`, { stdio: 'inherit' }); console.log('โœ… Publish complete.'); } catch (err) { diff --git a/scripts/publish-versions.js b/scripts/publish-versions.js index e5c8678..ed9d8e0 100755 --- a/scripts/publish-versions.js +++ b/scripts/publish-versions.js @@ -82,6 +82,14 @@ async function main() { console.log(` - Full package (${bump} bump)`); } + // Ask about building + const skipBuild = await question('\nSkip build step? (y/N): '); + const shouldBuild = skipBuild.toLowerCase() !== 'y'; + + if (!shouldBuild) { + console.log('โš ๏ธ Build step will be skipped. Make sure packages are already built!'); + } + const confirm = await question('\nProceed? (y/N): '); if (confirm.toLowerCase() !== 'y') { console.log('โŒ Publishing cancelled.'); @@ -106,11 +114,15 @@ async function main() { execSync(`git add package.json`, { cwd: versionPath }); execSync(`git commit -m "release: bump libpg-query v${version} version"`, { stdio: 'inherit' }); - // Build - console.log(` ๐Ÿ”จ Building...`); - execSync('pnpm build', { cwd: versionPath, stdio: 'inherit' }); + // Build (if not skipped) + if (shouldBuild) { + console.log(` ๐Ÿ”จ Building...`); + execSync('pnpm build', { cwd: versionPath, stdio: 'inherit' }); + } else { + console.log(` โญ๏ธ Skipping build step`); + } - // Test + // Test (always run) console.log(` ๐Ÿงช Running tests...`); execSync('pnpm test', { cwd: versionPath, stdio: 'inherit' }); @@ -144,17 +156,22 @@ async function main() { execSync(`git add package.json`, { cwd: fullPath }); execSync(`git commit -m "release: bump @libpg-query/parser version"`, { stdio: 'inherit' }); - // Build - console.log(` ๐Ÿ”จ Building...`); - execSync('pnpm build', { cwd: fullPath, stdio: 'inherit' }); + // Build (if not skipped) + if (shouldBuild) { + console.log(` ๐Ÿ”จ Building...`); + execSync('pnpm build', { cwd: fullPath, stdio: 'inherit' }); + } else { + console.log(` โญ๏ธ Skipping build step`); + } - // Test + // Test (always run) console.log(` ๐Ÿงช Running tests...`); execSync('pnpm test', { cwd: fullPath, stdio: 'inherit' }); // Publish with pg17 tag console.log(` ๐Ÿ“ค Publishing to npm with pg17 tag...`); - execSync('pnpm publish --tag pg17', { cwd: fullPath, stdio: 'inherit' }); + // use npm so staged changes are OK + execSync('npm publish --tag pg17', { cwd: fullPath, stdio: 'inherit' }); console.log(` โœ… Full package published successfully with pg17 tag!`); } catch (error) { diff --git a/versions/13/README.md b/versions/13/README.md index f703732..745a2ae 100644 --- a/versions/13/README.md +++ b/versions/13/README.md @@ -35,7 +35,7 @@ Built to power [pgsql-parser](https://github.com/pyramation/pgsql-parser), this ## ๐Ÿš€ For Round-trip Codegen > ๐ŸŽฏ **Want to parse + deparse (full round trip)?** -> We highly recommend using [`pgsql-parser`](https://github.com/launchql/pgsql-parser) which leverages a pure TypeScript deparser that has been battle-tested against 21,000+ SQL statements and is built on top of libpg-query. +> We highly recommend using [`pgsql-parser`](https://github.com/launchql/pgsql-parser) which leverages a pure TypeScript deparser that has been battle-tested against 23,000+ SQL statements and is built on top of libpg-query. ## Installation diff --git a/versions/13/package.json b/versions/13/package.json index 3aed0e9..b61a8f2 100644 --- a/versions/13/package.json +++ b/versions/13/package.json @@ -49,4 +49,4 @@ "plpgsql", "database" ] -} +} \ No newline at end of file diff --git a/versions/14/README.md b/versions/14/README.md index f703732..745a2ae 100644 --- a/versions/14/README.md +++ b/versions/14/README.md @@ -35,7 +35,7 @@ Built to power [pgsql-parser](https://github.com/pyramation/pgsql-parser), this ## ๐Ÿš€ For Round-trip Codegen > ๐ŸŽฏ **Want to parse + deparse (full round trip)?** -> We highly recommend using [`pgsql-parser`](https://github.com/launchql/pgsql-parser) which leverages a pure TypeScript deparser that has been battle-tested against 21,000+ SQL statements and is built on top of libpg-query. +> We highly recommend using [`pgsql-parser`](https://github.com/launchql/pgsql-parser) which leverages a pure TypeScript deparser that has been battle-tested against 23,000+ SQL statements and is built on top of libpg-query. ## Installation diff --git a/versions/14/package.json b/versions/14/package.json index 5218df2..ec1d7ba 100644 --- a/versions/14/package.json +++ b/versions/14/package.json @@ -49,4 +49,4 @@ "plpgsql", "database" ] -} +} \ No newline at end of file diff --git a/versions/15/README.md b/versions/15/README.md index f703732..745a2ae 100644 --- a/versions/15/README.md +++ b/versions/15/README.md @@ -35,7 +35,7 @@ Built to power [pgsql-parser](https://github.com/pyramation/pgsql-parser), this ## ๐Ÿš€ For Round-trip Codegen > ๐ŸŽฏ **Want to parse + deparse (full round trip)?** -> We highly recommend using [`pgsql-parser`](https://github.com/launchql/pgsql-parser) which leverages a pure TypeScript deparser that has been battle-tested against 21,000+ SQL statements and is built on top of libpg-query. +> We highly recommend using [`pgsql-parser`](https://github.com/launchql/pgsql-parser) which leverages a pure TypeScript deparser that has been battle-tested against 23,000+ SQL statements and is built on top of libpg-query. ## Installation diff --git a/versions/15/package.json b/versions/15/package.json index a650801..051b65b 100644 --- a/versions/15/package.json +++ b/versions/15/package.json @@ -49,4 +49,4 @@ "plpgsql", "database" ] -} +} \ No newline at end of file diff --git a/versions/16/README.md b/versions/16/README.md index f703732..745a2ae 100644 --- a/versions/16/README.md +++ b/versions/16/README.md @@ -35,7 +35,7 @@ Built to power [pgsql-parser](https://github.com/pyramation/pgsql-parser), this ## ๐Ÿš€ For Round-trip Codegen > ๐ŸŽฏ **Want to parse + deparse (full round trip)?** -> We highly recommend using [`pgsql-parser`](https://github.com/launchql/pgsql-parser) which leverages a pure TypeScript deparser that has been battle-tested against 21,000+ SQL statements and is built on top of libpg-query. +> We highly recommend using [`pgsql-parser`](https://github.com/launchql/pgsql-parser) which leverages a pure TypeScript deparser that has been battle-tested against 23,000+ SQL statements and is built on top of libpg-query. ## Installation diff --git a/versions/16/package.json b/versions/16/package.json index 2160cb7..d82a39b 100644 --- a/versions/16/package.json +++ b/versions/16/package.json @@ -49,4 +49,4 @@ "plpgsql", "database" ] -} +} \ No newline at end of file diff --git a/versions/17/README.md b/versions/17/README.md index f703732..745a2ae 100644 --- a/versions/17/README.md +++ b/versions/17/README.md @@ -35,7 +35,7 @@ Built to power [pgsql-parser](https://github.com/pyramation/pgsql-parser), this ## ๐Ÿš€ For Round-trip Codegen > ๐ŸŽฏ **Want to parse + deparse (full round trip)?** -> We highly recommend using [`pgsql-parser`](https://github.com/launchql/pgsql-parser) which leverages a pure TypeScript deparser that has been battle-tested against 21,000+ SQL statements and is built on top of libpg-query. +> We highly recommend using [`pgsql-parser`](https://github.com/launchql/pgsql-parser) which leverages a pure TypeScript deparser that has been battle-tested against 23,000+ SQL statements and is built on top of libpg-query. ## Installation diff --git a/versions/17/package.json b/versions/17/package.json index 6394422..63830a3 100644 --- a/versions/17/package.json +++ b/versions/17/package.json @@ -49,4 +49,4 @@ "plpgsql", "database" ] -} +} \ No newline at end of file From f684b53fe1629fd0b1e07c79c85119713ac83abd Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Sun, 22 Jun 2025 17:12:02 -0700 Subject: [PATCH 09/15] release: bump libpg-query v17 version --- versions/17/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/17/package.json b/versions/17/package.json index 63830a3..2015694 100644 --- a/versions/17/package.json +++ b/versions/17/package.json @@ -1,6 +1,6 @@ { "name": "@libpg-query/v17", - "version": "17.5.0", + "version": "17.5.1", "description": "The real PostgreSQL query parser", "homepage": "https://github.com/launchql/libpg-query-node", "main": "./wasm/index.cjs", @@ -49,4 +49,4 @@ "plpgsql", "database" ] -} \ No newline at end of file +} From 379a0c14004ec466faaa75ccf2af976e6cb2c738 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Sun, 22 Jun 2025 17:12:06 -0700 Subject: [PATCH 10/15] release: bump libpg-query v16 version --- versions/16/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/16/package.json b/versions/16/package.json index d82a39b..aa0c51f 100644 --- a/versions/16/package.json +++ b/versions/16/package.json @@ -1,6 +1,6 @@ { "name": "@libpg-query/v16", - "version": "16.5.0", + "version": "16.5.1", "description": "The real PostgreSQL query parser", "homepage": "https://github.com/launchql/libpg-query-node", "main": "./wasm/index.cjs", @@ -49,4 +49,4 @@ "plpgsql", "database" ] -} \ No newline at end of file +} From 70e746b5a871fc92fa4317784a5f20e864e6f5b8 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Sun, 22 Jun 2025 17:12:09 -0700 Subject: [PATCH 11/15] release: bump libpg-query v15 version --- versions/15/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/15/package.json b/versions/15/package.json index 051b65b..4547853 100644 --- a/versions/15/package.json +++ b/versions/15/package.json @@ -1,6 +1,6 @@ { "name": "@libpg-query/v15", - "version": "15.4.0", + "version": "15.4.1", "description": "The real PostgreSQL query parser", "homepage": "https://github.com/launchql/libpg-query-node", "main": "./wasm/index.cjs", @@ -49,4 +49,4 @@ "plpgsql", "database" ] -} \ No newline at end of file +} From 2bea229feb950d23bea0de6bbba4ad693c0a4bb6 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Sun, 22 Jun 2025 17:12:11 -0700 Subject: [PATCH 12/15] release: bump libpg-query v14 version --- versions/14/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/14/package.json b/versions/14/package.json index ec1d7ba..2e4e182 100644 --- a/versions/14/package.json +++ b/versions/14/package.json @@ -1,6 +1,6 @@ { "name": "@libpg-query/v14", - "version": "14.2.0", + "version": "14.2.1", "description": "The real PostgreSQL query parser", "homepage": "https://github.com/launchql/libpg-query-node", "main": "./wasm/index.cjs", @@ -49,4 +49,4 @@ "plpgsql", "database" ] -} \ No newline at end of file +} From b2677743d54ae4416d3f197b06ebe2276ff72802 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Sun, 22 Jun 2025 17:12:14 -0700 Subject: [PATCH 13/15] release: bump libpg-query v13 version --- versions/13/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/13/package.json b/versions/13/package.json index b61a8f2..0a810a4 100644 --- a/versions/13/package.json +++ b/versions/13/package.json @@ -1,6 +1,6 @@ { "name": "@libpg-query/v13", - "version": "13.5.0", + "version": "13.5.1", "description": "The real PostgreSQL query parser", "homepage": "https://github.com/launchql/libpg-query-node", "main": "./wasm/index.cjs", @@ -49,4 +49,4 @@ "plpgsql", "database" ] -} \ No newline at end of file +} From d477c1b3bae8a1c6c90b9310e5be958d0dbe64b0 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Sun, 22 Jun 2025 17:12:17 -0700 Subject: [PATCH 14/15] release: bump @libpg-query/parser version --- full/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/full/package.json b/full/package.json index 8244687..0b08b3c 100644 --- a/full/package.json +++ b/full/package.json @@ -1,6 +1,6 @@ { "name": "@libpg-query/parser", - "version": "17.6.0", + "version": "17.6.1", "description": "The real PostgreSQL query parser", "homepage": "https://github.com/launchql/libpg-query-node", "main": "./wasm/index.cjs", From 9c1ca922fb207caaddfa357edc95d78bfca72379 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Sun, 22 Jun 2025 17:12:39 -0700 Subject: [PATCH 15/15] pkg --- versions/13/package.json | 2 +- versions/14/package.json | 2 +- versions/15/package.json | 2 +- versions/16/package.json | 2 +- versions/17/package.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/versions/13/package.json b/versions/13/package.json index 0a810a4..f44e132 100644 --- a/versions/13/package.json +++ b/versions/13/package.json @@ -49,4 +49,4 @@ "plpgsql", "database" ] -} +} \ No newline at end of file diff --git a/versions/14/package.json b/versions/14/package.json index 2e4e182..6ed8606 100644 --- a/versions/14/package.json +++ b/versions/14/package.json @@ -49,4 +49,4 @@ "plpgsql", "database" ] -} +} \ No newline at end of file diff --git a/versions/15/package.json b/versions/15/package.json index 4547853..20b7cc0 100644 --- a/versions/15/package.json +++ b/versions/15/package.json @@ -49,4 +49,4 @@ "plpgsql", "database" ] -} +} \ No newline at end of file diff --git a/versions/16/package.json b/versions/16/package.json index aa0c51f..8fcf62f 100644 --- a/versions/16/package.json +++ b/versions/16/package.json @@ -49,4 +49,4 @@ "plpgsql", "database" ] -} +} \ No newline at end of file diff --git a/versions/17/package.json b/versions/17/package.json index 2015694..e7d9cf3 100644 --- a/versions/17/package.json +++ b/versions/17/package.json @@ -49,4 +49,4 @@ "plpgsql", "database" ] -} +} \ No newline at end of file