pgserve 1.0.8 → 1.0.9-rc.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,29 @@
1
+ # GitGuardian Configuration
2
+ # https://docs.gitguardian.com/ggshield-docs/reference/gitguardian-yaml
3
+
4
+ version: 2
5
+
6
+ secret:
7
+ # Don't show actual secret values in output
8
+ show_secrets: false
9
+ # Ignore files containing default development passwords
10
+ # These are well-known defaults for local PostgreSQL testing, not real secrets
11
+ ignored_paths:
12
+ - tests/**
13
+ - "**/*.test.js"
14
+ - "**/*.spec.js"
15
+ - "**/*.bench.js"
16
+ - src/sync.js
17
+ - src/pg-wire.js
18
+ - src/postgres.js
19
+ - src/restore.js
20
+
21
+ # Ignore "postgres" as a password - this is a well-known default for local dev
22
+ ignored_matches:
23
+ - name: "Default postgres password"
24
+ match: postgres
25
+
26
+ # Ignore generic password detector (too many false positives for default creds)
27
+ ignored_detectors:
28
+ - Generic Password
29
+ - Generic High Entropy Secret
@@ -0,0 +1,16 @@
1
+ # GitGuardian Ignore File
2
+ # Files containing default development passwords (not real secrets)
3
+
4
+ # PostgreSQL wire protocol client with example code containing default password
5
+ src/pg-wire.js
6
+
7
+ # All test files use default postgres password
8
+ tests/**
9
+ **/*.test.js
10
+ **/*.spec.js
11
+ **/*.bench.js
12
+
13
+ # Other source files with default connection settings
14
+ src/sync.js
15
+ src/postgres.js
16
+ src/restore.js
@@ -0,0 +1,30 @@
1
+ # GitHub Release Notes Configuration
2
+ # Automatically generates release notes from merged PRs
3
+ # See: https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes
4
+
5
+ changelog:
6
+ exclude:
7
+ labels:
8
+ - ignore-for-changelog
9
+ - internal
10
+ - bot
11
+ authors:
12
+ - github-actions[bot]
13
+ categories:
14
+ - title: "Features"
15
+ labels:
16
+ - feature
17
+ - enhancement
18
+ - title: "Bug Fixes"
19
+ labels:
20
+ - bug
21
+ - fix
22
+ - title: "Breaking Changes"
23
+ labels:
24
+ - breaking
25
+ - title: "Dependencies"
26
+ labels:
27
+ - dependencies
28
+ - title: "Other Changes"
29
+ labels:
30
+ - "*"
@@ -0,0 +1,182 @@
1
+ name: Build All Platforms
2
+
3
+ on:
4
+ workflow_call:
5
+ inputs:
6
+ version:
7
+ description: 'Version to publish'
8
+ required: true
9
+ type: string
10
+ npm_tag:
11
+ description: 'npm dist-tag (next or latest)'
12
+ required: false
13
+ type: string
14
+ default: 'next'
15
+ ref:
16
+ description: 'Git ref to checkout (tag or commit)'
17
+ required: false
18
+ type: string
19
+ workflow_dispatch:
20
+ inputs:
21
+ version:
22
+ description: 'Version (leave empty for build-only)'
23
+ required: false
24
+ type: string
25
+ npm_tag:
26
+ description: 'npm dist-tag'
27
+ required: false
28
+ type: choice
29
+ options:
30
+ - next
31
+ - latest
32
+ default: 'next'
33
+
34
+ concurrency:
35
+ group: build-all-platforms-${{ github.ref }}
36
+ cancel-in-progress: true
37
+
38
+ jobs:
39
+ build:
40
+ name: Build ${{ matrix.platform }}
41
+ runs-on: ubuntu-latest
42
+ strategy:
43
+ fail-fast: false
44
+ matrix:
45
+ include:
46
+ - target: bun-linux-x64
47
+ platform: linux-x64
48
+ output: pgserve-linux-x64
49
+ - target: bun-linux-arm64
50
+ platform: linux-arm64
51
+ output: pgserve-linux-arm64
52
+ - target: bun-darwin-x64
53
+ platform: darwin-x64
54
+ output: pgserve-darwin-x64
55
+ - target: bun-darwin-arm64
56
+ platform: darwin-arm64
57
+ output: pgserve-darwin-arm64
58
+ - target: bun-windows-x64
59
+ platform: windows-x64
60
+ output: pgserve-windows-x64.exe
61
+
62
+ steps:
63
+ - name: Checkout
64
+ uses: actions/checkout@v4
65
+ with:
66
+ ref: ${{ inputs.ref || github.ref }}
67
+
68
+ - name: Setup Bun
69
+ uses: oven-sh/setup-bun@v2
70
+ with:
71
+ bun-version: latest
72
+
73
+ - name: Install dependencies
74
+ run: bun install
75
+
76
+ - name: Build for ${{ matrix.platform }}
77
+ run: |
78
+ mkdir -p dist
79
+ bun build --compile --target=${{ matrix.target }} bin/pglite-server.js --outfile dist/${{ matrix.output }}
80
+ ls -lh dist/
81
+
82
+ - name: Upload artifact
83
+ uses: actions/upload-artifact@v4
84
+ with:
85
+ name: binaries-${{ matrix.platform }}
86
+ path: dist/${{ matrix.output }}*
87
+ retention-days: 7
88
+
89
+ publish:
90
+ name: Publish to npm
91
+ needs: build
92
+ runs-on: ubuntu-latest
93
+ if: inputs.version != ''
94
+ environment: npm-publish
95
+ permissions:
96
+ id-token: write
97
+ contents: read
98
+
99
+ steps:
100
+ - name: Checkout
101
+ uses: actions/checkout@v4
102
+ with:
103
+ ref: ${{ inputs.ref || github.ref }}
104
+
105
+ - name: Setup Node.js
106
+ uses: actions/setup-node@v4
107
+ with:
108
+ node-version: '20'
109
+ registry-url: 'https://registry.npmjs.org'
110
+
111
+ - name: Setup Bun
112
+ uses: oven-sh/setup-bun@v2
113
+ with:
114
+ bun-version: latest
115
+
116
+ - name: Install dependencies
117
+ run: bun install
118
+
119
+ - name: Download all artifacts
120
+ uses: actions/download-artifact@v4
121
+ with:
122
+ path: dist/
123
+ pattern: binaries-*
124
+ merge-multiple: true
125
+
126
+ - name: Verify binaries
127
+ run: |
128
+ echo "Downloaded binaries:"
129
+ ls -la dist/
130
+
131
+ MISSING=""
132
+ for platform in linux-x64 linux-arm64 darwin-x64 darwin-arm64; do
133
+ if [ ! -f "dist/pgserve-$platform" ]; then
134
+ MISSING="$MISSING pgserve-$platform"
135
+ fi
136
+ done
137
+ if [ ! -f "dist/pgserve-windows-x64.exe" ]; then
138
+ MISSING="$MISSING pgserve-windows-x64.exe"
139
+ fi
140
+
141
+ if [ -n "$MISSING" ]; then
142
+ echo "Missing binaries:$MISSING"
143
+ exit 1
144
+ fi
145
+
146
+ echo "All binaries present!"
147
+
148
+ - name: Check if version already published
149
+ id: check
150
+ run: |
151
+ VERSION="${{ inputs.version }}"
152
+ if npm view pgserve@$VERSION version >/dev/null 2>&1; then
153
+ echo "Version $VERSION already published"
154
+ echo "published=true" >> $GITHUB_OUTPUT
155
+ else
156
+ echo "Version $VERSION not yet published"
157
+ echo "published=false" >> $GITHUB_OUTPUT
158
+ fi
159
+
160
+ - name: Publish to npm
161
+ if: steps.check.outputs.published == 'false'
162
+ run: |
163
+ echo "Publishing version ${{ inputs.version }} with tag ${{ inputs.npm_tag }}"
164
+ npm publish --access public --tag ${{ inputs.npm_tag }}
165
+ env:
166
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
167
+
168
+ - name: Verify publish
169
+ if: steps.check.outputs.published == 'false'
170
+ run: |
171
+ # npm registry can take up to 30s to propagate
172
+ for i in 1 2 3 4 5; do
173
+ echo "Attempt $i: Checking npm for pgserve@${{ inputs.version }}..."
174
+ if npm view pgserve@${{ inputs.version }} version 2>/dev/null; then
175
+ echo "Successfully published pgserve@${{ inputs.version }} with tag @${{ inputs.npm_tag }}"
176
+ exit 0
177
+ fi
178
+ echo "Not found yet, waiting 10s..."
179
+ sleep 10
180
+ done
181
+ echo "Warning: Version not found after 50s, but publish command succeeded"
182
+ exit 0
@@ -0,0 +1,84 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main, dev]
6
+ pull_request:
7
+ branches: [main, dev]
8
+
9
+ jobs:
10
+ test:
11
+ name: Test
12
+ runs-on: ubuntu-latest
13
+
14
+ steps:
15
+ - name: Checkout
16
+ uses: actions/checkout@v4
17
+
18
+ - name: Setup Bun
19
+ uses: oven-sh/setup-bun@v2
20
+ with:
21
+ bun-version: latest
22
+
23
+ - name: Install dependencies
24
+ run: bun install
25
+
26
+ - name: Run linter
27
+ run: bun run lint
28
+
29
+ - name: Run dead code check
30
+ run: bun run deadcode
31
+
32
+ - name: Run tests
33
+ run: bun test
34
+
35
+ # Optional: Run on multiple platforms
36
+ test-matrix:
37
+ name: Test (${{ matrix.os }})
38
+ runs-on: ${{ matrix.os }}
39
+ strategy:
40
+ matrix:
41
+ os: [ubuntu-latest, macos-latest]
42
+ fail-fast: false
43
+
44
+ steps:
45
+ - name: Checkout
46
+ uses: actions/checkout@v4
47
+
48
+ - name: Setup Bun
49
+ uses: oven-sh/setup-bun@v2
50
+ with:
51
+ bun-version: latest
52
+
53
+ - name: Install dependencies
54
+ run: bun install
55
+
56
+ - name: Run tests
57
+ run: bun test
58
+
59
+ # Validate build works
60
+ build-check:
61
+ name: Build Check
62
+ runs-on: ubuntu-latest
63
+
64
+ steps:
65
+ - name: Checkout
66
+ uses: actions/checkout@v4
67
+
68
+ - name: Setup Bun
69
+ uses: oven-sh/setup-bun@v2
70
+ with:
71
+ bun-version: latest
72
+
73
+ - name: Install dependencies
74
+ run: bun install
75
+
76
+ - name: Build executable
77
+ run: |
78
+ mkdir -p dist
79
+ bun build --compile bin/pglite-server.js --outfile dist/pgserve
80
+
81
+ - name: Verify executable
82
+ run: |
83
+ ./dist/pgserve --help
84
+ echo "Build successful!"
@@ -0,0 +1,209 @@
1
+ name: Unified Release
2
+
3
+ on:
4
+ pull_request:
5
+ types: [closed]
6
+ branches: [main]
7
+ workflow_dispatch:
8
+ inputs:
9
+ action:
10
+ description: 'Release action'
11
+ required: true
12
+ type: choice
13
+ options:
14
+ - bump-rc
15
+ - promote
16
+
17
+ concurrency:
18
+ group: unified-release
19
+ cancel-in-progress: false
20
+
21
+ permissions:
22
+ contents: write
23
+ pull-requests: read
24
+ id-token: write
25
+
26
+ jobs:
27
+ # Gate: Skip bot commits, detect action from PR labels
28
+ gate:
29
+ name: Release Gate
30
+ runs-on: ubuntu-latest
31
+ if: |
32
+ github.event_name == 'workflow_dispatch' ||
33
+ (github.event.pull_request.merged == true &&
34
+ (contains(github.event.pull_request.labels.*.name, 'rc') ||
35
+ contains(github.event.pull_request.labels.*.name, 'stable')))
36
+ outputs:
37
+ should_run: ${{ steps.check.outputs.should_run }}
38
+ action: ${{ steps.detect.outputs.action }}
39
+
40
+ steps:
41
+ - name: Check for bot commits
42
+ id: check
43
+ run: |
44
+ # Skip if this is a bot commit (prevents infinite loops)
45
+ if [[ "${{ github.actor }}" == "github-actions[bot]" ]]; then
46
+ echo "Skipping: bot commit detected"
47
+ echo "should_run=false" >> $GITHUB_OUTPUT
48
+ else
49
+ echo "should_run=true" >> $GITHUB_OUTPUT
50
+ fi
51
+
52
+ - name: Detect action
53
+ id: detect
54
+ if: steps.check.outputs.should_run == 'true'
55
+ run: |
56
+ if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
57
+ echo "action=${{ inputs.action }}" >> $GITHUB_OUTPUT
58
+ echo "Action from dispatch: ${{ inputs.action }}"
59
+ elif [[ "${{ contains(github.event.pull_request.labels.*.name, 'stable') }}" == "true" ]]; then
60
+ echo "action=promote" >> $GITHUB_OUTPUT
61
+ echo "Action from label: promote (stable)"
62
+ elif [[ "${{ contains(github.event.pull_request.labels.*.name, 'rc') }}" == "true" ]]; then
63
+ echo "action=bump-rc" >> $GITHUB_OUTPUT
64
+ echo "Action from label: bump-rc"
65
+ else
66
+ echo "No release label found"
67
+ echo "action=" >> $GITHUB_OUTPUT
68
+ fi
69
+
70
+ # Version: Bump version and create tag
71
+ version:
72
+ name: Bump Version
73
+ needs: gate
74
+ if: needs.gate.outputs.should_run == 'true' && needs.gate.outputs.action != ''
75
+ runs-on: ubuntu-latest
76
+ outputs:
77
+ version: ${{ steps.bump.outputs.version }}
78
+ tag: ${{ steps.bump.outputs.tag }}
79
+ npm_tag: ${{ steps.bump.outputs.npm_tag }}
80
+ is_promote: ${{ steps.bump.outputs.is_promote }}
81
+
82
+ steps:
83
+ - name: Checkout
84
+ uses: actions/checkout@v4
85
+ with:
86
+ fetch-depth: 0
87
+ token: ${{ secrets.GITHUB_TOKEN }}
88
+
89
+ - name: Setup Node.js
90
+ uses: actions/setup-node@v4
91
+ with:
92
+ node-version: '20'
93
+
94
+ - name: Configure Git
95
+ run: |
96
+ git config user.name "github-actions[bot]"
97
+ git config user.email "github-actions[bot]@users.noreply.github.com"
98
+
99
+ - name: Run release script
100
+ id: bump
101
+ run: node scripts/release.cjs --action ${{ needs.gate.outputs.action }}
102
+
103
+ - name: Push changes
104
+ run: |
105
+ git push origin HEAD:${{ github.ref_name }}
106
+ git push origin --tags
107
+
108
+ # Build: Build all platforms (skip for promote)
109
+ build:
110
+ name: Build & Publish
111
+ needs: version
112
+ if: needs.version.outputs.is_promote != 'true'
113
+ uses: ./.github/workflows/build-all-platforms.yml
114
+ with:
115
+ version: ${{ needs.version.outputs.version }}
116
+ npm_tag: ${{ needs.version.outputs.npm_tag }}
117
+ ref: ${{ needs.version.outputs.tag }}
118
+ secrets: inherit
119
+
120
+ # Promote: Just update npm tags (no rebuild)
121
+ promote:
122
+ name: Promote to Latest
123
+ needs: version
124
+ if: needs.version.outputs.is_promote == 'true'
125
+ runs-on: ubuntu-latest
126
+ environment: npm-publish
127
+
128
+ steps:
129
+ - name: Setup Node.js
130
+ uses: actions/setup-node@v4
131
+ with:
132
+ node-version: '20'
133
+ registry-url: 'https://registry.npmjs.org'
134
+
135
+ - name: Get RC version from @next tag
136
+ id: get-rc
137
+ run: |
138
+ RC_VERSION=$(npm view pgserve@next version 2>/dev/null || echo "")
139
+ if [ -z "$RC_VERSION" ]; then
140
+ echo "No RC version found at @next tag"
141
+ exit 1
142
+ fi
143
+ echo "rc_version=$RC_VERSION" >> $GITHUB_OUTPUT
144
+ echo "Found RC version: $RC_VERSION"
145
+
146
+ - name: Promote @next to @latest
147
+ run: |
148
+ echo "Promoting pgserve@${{ steps.get-rc.outputs.rc_version }} to @latest"
149
+ npm dist-tag add pgserve@${{ steps.get-rc.outputs.rc_version }} latest
150
+ env:
151
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
152
+
153
+ - name: Verify promotion
154
+ run: |
155
+ LATEST=$(npm view pgserve@latest version)
156
+ echo "Latest version is now: $LATEST"
157
+ if [ "$LATEST" != "${{ steps.get-rc.outputs.rc_version }}" ]; then
158
+ echo "Warning: Version mismatch after promotion"
159
+ fi
160
+
161
+ # GitHub Release: Create release with changelog
162
+ github-release:
163
+ name: Create GitHub Release
164
+ needs: [version, build]
165
+ if: always() && needs.version.result == 'success' && (needs.build.result == 'success' || needs.build.result == 'skipped')
166
+ runs-on: ubuntu-latest
167
+ permissions:
168
+ contents: write
169
+
170
+ steps:
171
+ - name: Checkout
172
+ uses: actions/checkout@v4
173
+ with:
174
+ ref: ${{ needs.version.outputs.tag }}
175
+
176
+ - name: Download artifacts
177
+ if: needs.build.result == 'success'
178
+ uses: actions/download-artifact@v4
179
+ with:
180
+ path: dist/
181
+ pattern: binaries-*
182
+ merge-multiple: true
183
+
184
+ - name: List artifacts
185
+ run: |
186
+ if [ -d "dist" ]; then
187
+ echo "Release artifacts:"
188
+ ls -la dist/
189
+ else
190
+ echo "No artifacts (promote release)"
191
+ fi
192
+
193
+ - name: Create GitHub Release
194
+ uses: softprops/action-gh-release@v2
195
+ with:
196
+ tag_name: ${{ needs.version.outputs.tag }}
197
+ name: ${{ needs.version.outputs.tag }}
198
+ generate_release_notes: true
199
+ body: |
200
+ ## Install
201
+
202
+ ```bash
203
+ npm install pgserve@${{ needs.version.outputs.npm_tag }}
204
+ bunx pgserve@${{ needs.version.outputs.npm_tag }}
205
+ ```
206
+ prerelease: ${{ contains(needs.version.outputs.version, '-rc.') }}
207
+ files: |
208
+ dist/*
209
+ fail_on_unmatched_files: false