Skip to content

Commit 8ee9d4b

Browse files
committed
refactor(publish): fix publish order and remove update script
Publish order now: 1. @socketsecurity/cli and @socketsecurity/cli-with-sentry (independent) 2. @socketbin/* SEA binaries (8 platforms) 3. socket (last, depends on @socketbin/*) Changes: - Reorder publish steps so socket is last - Remove update-socketbin-versions.mjs (not needed with lockstep) - Update preparePackageForPublish to set optionalDependencies version All packages use the same VERSION, so socket's optionalDependencies are set to VERSION at publish time (no npm fetch needed).
1 parent 2157d21 commit 8ee9d4b

File tree

3 files changed

+19
-107
lines changed

3 files changed

+19
-107
lines changed

.github/workflows/publish.yml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -182,39 +182,37 @@ jobs:
182182
done
183183
184184
# Build and publish JS packages.
185+
# Order: cli/cli-with-sentry first (independent), then socket (depends on @socketbin/*).
185186
- name: Build CLI
186187
run: INLINED_SOCKET_CLI_PUBLISHED_BUILD=1 pnpm run build
187188

188-
- name: Update socketbin versions
189-
if: ${{ inputs.publish-socket }}
190-
run: node scripts/update-socketbin-versions.mjs --prod
191-
192-
- name: Publish socket
193-
if: ${{ inputs.publish-socket && !inputs.dry-run }}
189+
- name: Publish @socketsecurity/cli
190+
if: ${{ inputs.publish-cli && !inputs.dry-run }}
194191
env:
195192
VERSION: ${{ steps.version.outputs.version }}
196193
run: |
197-
PKG_DIR="packages/package-builder/build/prod/out/socket"
194+
PKG_DIR="packages/package-builder/build/prod/out/cli"
198195
node scripts/prepare-package-for-publish.mjs "$PKG_DIR" "$VERSION"
199196
cd "$PKG_DIR"
200197
npm publish --provenance --access public --no-git-checks
201198
202-
- name: Publish @socketsecurity/cli
203-
if: ${{ inputs.publish-cli && !inputs.dry-run }}
199+
- name: Publish @socketsecurity/cli-with-sentry
200+
if: ${{ inputs.publish-cli-sentry && !inputs.dry-run }}
204201
env:
205202
VERSION: ${{ steps.version.outputs.version }}
206203
run: |
207-
PKG_DIR="packages/package-builder/build/prod/out/cli"
204+
PKG_DIR="packages/package-builder/build/prod/out/cli-with-sentry"
208205
node scripts/prepare-package-for-publish.mjs "$PKG_DIR" "$VERSION"
209206
cd "$PKG_DIR"
210207
npm publish --provenance --access public --no-git-checks
211208
212-
- name: Publish @socketsecurity/cli-with-sentry
213-
if: ${{ inputs.publish-cli-sentry && !inputs.dry-run }}
209+
# socket published last - depends on @socketbin/* being published first.
210+
- name: Publish socket
211+
if: ${{ inputs.publish-socket && !inputs.dry-run }}
214212
env:
215213
VERSION: ${{ steps.version.outputs.version }}
216214
run: |
217-
PKG_DIR="packages/package-builder/build/prod/out/cli-with-sentry"
215+
PKG_DIR="packages/package-builder/build/prod/out/socket"
218216
node scripts/prepare-package-for-publish.mjs "$PKG_DIR" "$VERSION"
219217
cd "$PKG_DIR"
220218
npm publish --provenance --access public --no-git-checks

packages/package-builder/scripts/utils/prepare-package.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const logger = getDefaultLogger()
1414
* - Removes private field
1515
* - Sets version if provided
1616
* - Sets buildMethod if provided
17+
* - Updates optionalDependencies versions (for lockstep publishing)
1718
*
1819
* @param {string} packageDir - Path to the package directory
1920
* @param {object} [options] - Options
@@ -35,6 +36,13 @@ export function preparePackageForPublish(packageDir, options = {}) {
3536
// Set version if provided.
3637
if (version) {
3738
pkg.version = version
39+
40+
// Update optionalDependencies to use the same version (lockstep).
41+
if (pkg.optionalDependencies) {
42+
for (const dep of Object.keys(pkg.optionalDependencies)) {
43+
pkg.optionalDependencies[dep] = version
44+
}
45+
}
3846
}
3947

4048
// Set buildMethod if provided (for socketbin packages).

scripts/update-socketbin-versions.mjs

Lines changed: 0 additions & 94 deletions
This file was deleted.

0 commit comments

Comments
 (0)