pgserve 1.0.7 → 1.0.9-rc.4

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,165 @@
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
+ workflow_dispatch:
16
+ inputs:
17
+ version:
18
+ description: 'Version (leave empty for build-only)'
19
+ required: false
20
+ type: string
21
+ npm_tag:
22
+ description: 'npm dist-tag'
23
+ required: false
24
+ type: choice
25
+ options:
26
+ - next
27
+ - latest
28
+ default: 'next'
29
+
30
+ concurrency:
31
+ group: build-all-platforms-${{ github.ref }}
32
+ cancel-in-progress: true
33
+
34
+ jobs:
35
+ build:
36
+ name: Build ${{ matrix.platform }}
37
+ runs-on: ubuntu-latest
38
+ strategy:
39
+ fail-fast: false
40
+ matrix:
41
+ include:
42
+ - target: bun-linux-x64
43
+ platform: linux-x64
44
+ output: pgserve-linux-x64
45
+ - target: bun-linux-arm64
46
+ platform: linux-arm64
47
+ output: pgserve-linux-arm64
48
+ - target: bun-darwin-x64
49
+ platform: darwin-x64
50
+ output: pgserve-darwin-x64
51
+ - target: bun-darwin-arm64
52
+ platform: darwin-arm64
53
+ output: pgserve-darwin-arm64
54
+ - target: bun-windows-x64
55
+ platform: windows-x64
56
+ output: pgserve-windows-x64.exe
57
+
58
+ steps:
59
+ - name: Checkout
60
+ uses: actions/checkout@v4
61
+
62
+ - name: Setup Bun
63
+ uses: oven-sh/setup-bun@v2
64
+ with:
65
+ bun-version: latest
66
+
67
+ - name: Install dependencies
68
+ run: bun install
69
+
70
+ - name: Build for ${{ matrix.platform }}
71
+ run: |
72
+ mkdir -p dist
73
+ bun build --compile --target=${{ matrix.target }} bin/pglite-server.js --outfile dist/${{ matrix.output }}
74
+ ls -lh dist/
75
+
76
+ - name: Upload artifact
77
+ uses: actions/upload-artifact@v4
78
+ with:
79
+ name: binaries-${{ matrix.platform }}
80
+ path: dist/${{ matrix.output }}*
81
+ retention-days: 7
82
+
83
+ publish:
84
+ name: Publish to npm
85
+ needs: build
86
+ runs-on: ubuntu-latest
87
+ if: inputs.version != ''
88
+ environment: npm-publish
89
+ permissions:
90
+ id-token: write
91
+ contents: read
92
+
93
+ steps:
94
+ - name: Checkout
95
+ uses: actions/checkout@v4
96
+
97
+ - name: Setup Node.js
98
+ uses: actions/setup-node@v4
99
+ with:
100
+ node-version: '20'
101
+ registry-url: 'https://registry.npmjs.org'
102
+
103
+ - name: Setup Bun
104
+ uses: oven-sh/setup-bun@v2
105
+ with:
106
+ bun-version: latest
107
+
108
+ - name: Install dependencies
109
+ run: bun install
110
+
111
+ - name: Download all artifacts
112
+ uses: actions/download-artifact@v4
113
+ with:
114
+ path: dist/
115
+ pattern: binaries-*
116
+ merge-multiple: true
117
+
118
+ - name: Verify binaries
119
+ run: |
120
+ echo "Downloaded binaries:"
121
+ ls -la dist/
122
+
123
+ MISSING=""
124
+ for platform in linux-x64 linux-arm64 darwin-x64 darwin-arm64; do
125
+ if [ ! -f "dist/pgserve-$platform" ]; then
126
+ MISSING="$MISSING pgserve-$platform"
127
+ fi
128
+ done
129
+ if [ ! -f "dist/pgserve-windows-x64.exe" ]; then
130
+ MISSING="$MISSING pgserve-windows-x64.exe"
131
+ fi
132
+
133
+ if [ -n "$MISSING" ]; then
134
+ echo "Missing binaries:$MISSING"
135
+ exit 1
136
+ fi
137
+
138
+ echo "All binaries present!"
139
+
140
+ - name: Check if version already published
141
+ id: check
142
+ run: |
143
+ VERSION="${{ inputs.version }}"
144
+ if npm view pgserve@$VERSION version >/dev/null 2>&1; then
145
+ echo "Version $VERSION already published"
146
+ echo "published=true" >> $GITHUB_OUTPUT
147
+ else
148
+ echo "Version $VERSION not yet published"
149
+ echo "published=false" >> $GITHUB_OUTPUT
150
+ fi
151
+
152
+ - name: Publish to npm
153
+ if: steps.check.outputs.published == 'false'
154
+ run: |
155
+ echo "Publishing version ${{ inputs.version }} with tag ${{ inputs.npm_tag }}"
156
+ npm publish --access public --tag ${{ inputs.npm_tag }}
157
+ env:
158
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
159
+
160
+ - name: Verify publish
161
+ if: steps.check.outputs.published == 'false'
162
+ run: |
163
+ sleep 5
164
+ npm view pgserve@${{ inputs.version }} version
165
+ echo "Successfully published pgserve@${{ inputs.version }} with tag @${{ inputs.npm_tag }}"
@@ -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,208 @@
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
+ secrets: inherit
118
+
119
+ # Promote: Just update npm tags (no rebuild)
120
+ promote:
121
+ name: Promote to Latest
122
+ needs: version
123
+ if: needs.version.outputs.is_promote == 'true'
124
+ runs-on: ubuntu-latest
125
+ environment: npm-publish
126
+
127
+ steps:
128
+ - name: Setup Node.js
129
+ uses: actions/setup-node@v4
130
+ with:
131
+ node-version: '20'
132
+ registry-url: 'https://registry.npmjs.org'
133
+
134
+ - name: Get RC version from @next tag
135
+ id: get-rc
136
+ run: |
137
+ RC_VERSION=$(npm view pgserve@next version 2>/dev/null || echo "")
138
+ if [ -z "$RC_VERSION" ]; then
139
+ echo "No RC version found at @next tag"
140
+ exit 1
141
+ fi
142
+ echo "rc_version=$RC_VERSION" >> $GITHUB_OUTPUT
143
+ echo "Found RC version: $RC_VERSION"
144
+
145
+ - name: Promote @next to @latest
146
+ run: |
147
+ echo "Promoting pgserve@${{ steps.get-rc.outputs.rc_version }} to @latest"
148
+ npm dist-tag add pgserve@${{ steps.get-rc.outputs.rc_version }} latest
149
+ env:
150
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
151
+
152
+ - name: Verify promotion
153
+ run: |
154
+ LATEST=$(npm view pgserve@latest version)
155
+ echo "Latest version is now: $LATEST"
156
+ if [ "$LATEST" != "${{ steps.get-rc.outputs.rc_version }}" ]; then
157
+ echo "Warning: Version mismatch after promotion"
158
+ fi
159
+
160
+ # GitHub Release: Create release with changelog
161
+ github-release:
162
+ name: Create GitHub Release
163
+ needs: [version, build]
164
+ if: always() && needs.version.result == 'success' && (needs.build.result == 'success' || needs.build.result == 'skipped')
165
+ runs-on: ubuntu-latest
166
+ permissions:
167
+ contents: write
168
+
169
+ steps:
170
+ - name: Checkout
171
+ uses: actions/checkout@v4
172
+ with:
173
+ ref: ${{ needs.version.outputs.tag }}
174
+
175
+ - name: Download artifacts
176
+ if: needs.build.result == 'success'
177
+ uses: actions/download-artifact@v4
178
+ with:
179
+ path: dist/
180
+ pattern: binaries-*
181
+ merge-multiple: true
182
+
183
+ - name: List artifacts
184
+ run: |
185
+ if [ -d "dist" ]; then
186
+ echo "Release artifacts:"
187
+ ls -la dist/
188
+ else
189
+ echo "No artifacts (promote release)"
190
+ fi
191
+
192
+ - name: Create GitHub Release
193
+ uses: softprops/action-gh-release@v2
194
+ with:
195
+ tag_name: ${{ needs.version.outputs.tag }}
196
+ name: ${{ needs.version.outputs.tag }}
197
+ generate_release_notes: true
198
+ body: |
199
+ ## Install
200
+
201
+ ```bash
202
+ npm install pgserve@${{ needs.version.outputs.npm_tag }}
203
+ bunx pgserve@${{ needs.version.outputs.npm_tag }}
204
+ ```
205
+ prerelease: ${{ contains(needs.version.outputs.version, '-rc.') }}
206
+ files: |
207
+ dist/*
208
+ fail_on_unmatched_files: false