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
2 changes: 1 addition & 1 deletion PUBLISH.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ This interactive script will:
- 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 (`latest` is currently pg18; to keep it there, answer no)
- If the highest major (pg18) was published, optionally promote it to `latest`

### Types Packages
```bash
Expand Down
6 changes: 4 additions & 2 deletions scripts/publish-single-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ if (!fs.existsSync(pkgPath)) {
process.exit(1);
}

const original = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
const originalText = fs.readFileSync(pkgPath, 'utf8');
const original = JSON.parse(originalText);
const publishMeta = original['x-publish'] || {};

const publishName = publishMeta.publishName || 'libpg-query';
Expand Down Expand Up @@ -48,7 +49,8 @@ try {
console.log('✅ Publish complete.');
} catch (err) {
console.error('❌ Publish failed:', err.message);
process.exitCode = 1;
} finally {
fs.writeFileSync(pkgPath, JSON.stringify(original, null, 2));
fs.writeFileSync(pkgPath, originalText);
console.log('🔄 Restored original package.json');
}
9 changes: 5 additions & 4 deletions scripts/publish-versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,15 @@ async function main() {
}

// Ask about promoting to latest
if (selectedVersions.includes('17')) {
const latestVersion = versionDirs[0];
if (selectedVersions.includes(latestVersion)) {
console.log('\n🏷️ Tag Management');

const promoteVersions = await question('Promote libpg-query@pg17 to latest? (y/N): ');
const promoteVersions = await question(`Promote libpg-query@pg${latestVersion} 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');
execSync(`npm dist-tag add libpg-query@pg${latestVersion} latest`, { stdio: 'inherit' });
console.log(`✅ libpg-query@pg${latestVersion} promoted to latest`);
} catch (error) {
console.error('❌ Failed to promote tag:', error.message);
}
Expand Down
4 changes: 2 additions & 2 deletions versions/17/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Our latest is built with the `18-latest` branch from libpg_query
| PG Major Version | libpg_query | npm dist-tag
|--------------------------|-------------|---------|
| 18 | 18.0.0 | [`pg18`](https://www.npmjs.com/package/libpg-query/v/pg18)
| 17 | 17-6.1.0 | [`pg17`](https://www.npmjs.com/package/libpg-query/v/latest)
| 17 | 17-6.1.0 | [`pg17`](https://www.npmjs.com/package/libpg-query/v/pg17)
| 16 | 16-5.2.0 | [`pg16`](https://www.npmjs.com/package/libpg-query/v/pg16)
| 15 | 15-4.2.4 | [`pg15`](https://www.npmjs.com/package/libpg-query/v/pg15)
| 14 | 14-3.0.0 | [`pg14`](https://www.npmjs.com/package/libpg-query/v/pg14)
Expand Down Expand Up @@ -89,7 +89,7 @@ const result = parseSync('SELECT * FROM users WHERE active = true');
// Returns: ParseResult - parsed query object
```

⚠ **Note:** If you need additional functionality like `fingerprint`, `scan`, `deparse`, or `normalize`, check out the full package (`@libpg-query/parser`) in the [./full](https://github.com/constructive-io/libpg-query-node/tree/main/full) folder of the repo.
⚠ **Note:** This package only parses. For `fingerprint`, `normalize`, `scan` and `parsePlPgSQL`, upgrade to [`libpg-query@pg18`](https://www.npmjs.com/package/libpg-query/v/pg18).

### Initialization

Expand Down
Loading