Skip to content

Commit dd052bf

Browse files
committed
refactor: mark packages as private with placeholder versions
Set all packages to private: true to prevent accidental publishing: - packages/socket: private: true (version: 2.0.0) - packages/cli: private: true, version: 0.0.0-copied-from-packages-socket - packages/cli-with-sentry: private: true, version: 0.0.0-copied-from-packages-socket - All 9 socketbin-* packages: private: true Update provenance.yml workflow to: - Remove private field before publishing - Sync cli and cli-with-sentry versions from socket package version - All three packages now publish with matching versions This ensures packages can only be published through CI workflows, preventing manual publishing mistakes and maintaining version consistency.
1 parent 196bf63 commit dd052bf

File tree

12 files changed

+45
-8
lines changed

12 files changed

+45
-8
lines changed

.github/workflows/provenance.yml

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,20 @@ jobs:
4242
- run: pnpm install
4343

4444
# Build and publish 'socket' package (default).
45+
- name: Prepare socket package for publishing
46+
run: |
47+
SOCKET_VERSION=$(node -p "require('./packages/socket/package.json').version")
48+
echo "Socket version: $SOCKET_VERSION"
49+
50+
# Remove private field from socket package
51+
node -e "
52+
const fs = require('fs');
53+
const pkgPath = './packages/socket/package.json';
54+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
55+
delete pkg.private;
56+
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
57+
"
58+
echo "SOCKET_VERSION=$SOCKET_VERSION" >> $GITHUB_ENV
4559
- name: Build socket package
4660
run: INLINED_SOCKET_CLI_PUBLISHED_BUILD=1 pnpm run build:dist
4761
- name: Validate socket package
@@ -54,6 +68,18 @@ jobs:
5468
SOCKET_CLI_DEBUG: ${{ inputs.debug }}
5569

5670
# Build and publish '@socketsecurity/cli' package (legacy).
71+
- name: Prepare @socketsecurity/cli package for publishing
72+
run: |
73+
# Remove private field and set version from socket package
74+
node -e "
75+
const fs = require('fs');
76+
const pkgPath = './packages/cli/package.json';
77+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
78+
delete pkg.private;
79+
pkg.version = '${{ env.SOCKET_VERSION }}';
80+
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
81+
"
82+
echo "Synced @socketsecurity/cli to version ${{ env.SOCKET_VERSION }}"
5783
- name: Build @socketsecurity/cli package
5884
run: INLINED_SOCKET_CLI_PUBLISHED_BUILD=1 INLINED_SOCKET_CLI_LEGACY_BUILD=1 pnpm run build:dist
5985
env:
@@ -68,17 +94,18 @@ jobs:
6894
SOCKET_CLI_DEBUG: ${{ inputs.debug }}
6995

7096
# Build and publish '@socketsecurity/cli-with-sentry' package.
71-
- name: Sync @socketsecurity/cli-with-sentry version with @socketsecurity/cli
97+
- name: Prepare @socketsecurity/cli-with-sentry package for publishing
7298
run: |
73-
CLI_VERSION=$(node -p "require('./packages/cli/package.json').version")
74-
echo "Syncing cli-with-sentry version to $CLI_VERSION"
99+
# Remove private field and set version from socket package
75100
node -e "
76101
const fs = require('fs');
77102
const pkgPath = './packages/cli-with-sentry/package.json';
78103
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
79-
pkg.version = '$CLI_VERSION';
104+
delete pkg.private;
105+
pkg.version = '${{ env.SOCKET_VERSION }}';
80106
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
81107
"
108+
echo "Synced @socketsecurity/cli-with-sentry to version ${{ env.SOCKET_VERSION }}"
82109
- name: Build @socketsecurity/cli-with-sentry package
83110
run: INLINED_SOCKET_CLI_PUBLISHED_BUILD=1 INLINED_SOCKET_CLI_SENTRY_BUILD=1 pnpm run build:dist
84111
env:

packages/cli-with-sentry/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"name": "@socketsecurity/cli-with-sentry",
3-
"version": "2.0.0",
3+
"version": "0.0.0-copied-from-packages-socket",
44
"description": "Socket CLI with Sentry telemetry for enhanced error reporting",
5+
"private": true,
56
"homepage": "https://github.com/SocketDev/socket-cli",
67
"license": "MIT",
78
"repository": {
@@ -54,6 +55,5 @@
5455
"publishConfig": {
5556
"access": "public",
5657
"registry": "https://registry.npmjs.org/"
57-
},
58-
"private": true
58+
}
5959
}

packages/cli/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"name": "@socketsecurity/cli",
3-
"version": "2.0.0",
3+
"version": "0.0.0-copied-from-packages-socket",
44
"description": "CLI for Socket.dev",
5+
"private": true,
56
"homepage": "https://github.com/SocketDev/socket-cli",
67
"license": "MIT",
78
"repository": {

packages/socket/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "socket",
33
"version": "2.0.0",
44
"description": "CLI for Socket.dev",
5+
"private": true,
56
"homepage": "https://github.com/SocketDev/socket-cli",
67
"license": "MIT",
78
"repository": {

packages/socketbin-cli-alpine-arm64/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "@socketbin/cli-alpine-arm64",
33
"version": "0.0.0",
44
"description": "Socket CLI binary",
5+
"private": true,
56
"license": "MIT",
67
"bin": {
78
"socket": "./bin/socket"

packages/socketbin-cli-alpine-x64/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "@socketbin/cli-alpine-x64",
33
"version": "0.0.0",
44
"description": "Socket CLI binary",
5+
"private": true,
56
"license": "MIT",
67
"bin": {
78
"socket": "./bin/socket"

packages/socketbin-cli-darwin-arm64/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "@socketbin/cli-darwin-arm64",
33
"version": "0.0.0",
44
"description": "Socket CLI binary",
5+
"private": true,
56
"license": "MIT",
67
"bin": {
78
"socket": "./bin/socket"

packages/socketbin-cli-darwin-x64/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "@socketbin/cli-darwin-x64",
33
"version": "0.0.0",
44
"description": "Socket CLI binary",
5+
"private": true,
56
"license": "MIT",
67
"bin": {
78
"socket": "./bin/socket"

packages/socketbin-cli-linux-arm64/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "@socketbin/cli-linux-arm64",
33
"version": "0.0.0",
44
"description": "Socket CLI binary",
5+
"private": true,
56
"license": "MIT",
67
"bin": {
78
"socket": "./bin/socket"

packages/socketbin-cli-linux-x64/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "@socketbin/cli-linux-x64",
33
"version": "0.0.0",
44
"description": "Socket CLI binary",
5+
"private": true,
56
"license": "MIT",
67
"bin": {
78
"socket": "./bin/socket"

0 commit comments

Comments
 (0)