Skip to content

Commit 376dd7c

Browse files
Refactor: Separate Rust client into standalone npm package
Signed-off-by: Muhammad Awawdi <[email protected]>
1 parent d31d3fa commit 376dd7c

File tree

9 files changed

+46
-22
lines changed

9 files changed

+46
-22
lines changed

.github/workflows/install-shared-dependencies/action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ inputs:
1313
description: "Specified target for rust toolchain, ex. x86_64-apple-darwin"
1414
type: string
1515
required: false
16-
defalt: "x86_64-unknown-linux-gnu"
16+
default: "x86_64-unknown-linux-gnu"
1717
options:
1818
- x86_64-unknown-linux-gnu
1919
- aarch64-unknown-linux-gnu

.github/workflows/npm-cd.yml

+33-3
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,37 @@ jobs:
6262
# Get the matrix from the matrix.json file, without the object that has the IMAGE key
6363
export "PLATFORM_MATRIX=$(jq 'map(select(.PACKAGE_MANAGERS != null and (.PACKAGE_MANAGERS | contains(["npm"]))))' < .github/json_matrices/build-matrix.json | jq -c .)"
6464
echo "PLATFORM_MATRIX=${PLATFORM_MATRIX}" >> $GITHUB_OUTPUT
65+
66+
publish-rust-client:
67+
needs: [start-self-hosted-runner, load-platform-matrix]
68+
if: github.repository_owner == 'valkey-io'
69+
name: Publish Rust client to NPM
70+
runs-on: ubuntu-latest
71+
steps:
72+
- name: Checkout
73+
uses: actions/checkout@v4
74+
with:
75+
submodules: "true"
76+
77+
- name: Setup node
78+
uses: actions/setup-node@v4
79+
with:
80+
node-version: "latest"
81+
registry-url: "https://registry.npmjs.org"
82+
scope: "${{ vars.NPM_SCOPE }}"
83+
always-auth: true
84+
85+
- name: Publish Rust client
86+
working-directory: ./node/rust-client
87+
run: |
88+
npm ci
89+
npm run build
90+
npm publish --access public
91+
env:
92+
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
6593

6694
publish-binaries:
67-
needs: [start-self-hosted-runner, load-platform-matrix]
95+
needs: [start-self-hosted-runner, load-platform-matrix, publish-rust-client]
6896
if: github.repository_owner == 'valkey-io'
6997
name: Publish packages to NPM
7098
runs-on: ${{ matrix.build.RUNNER }}
@@ -216,7 +244,7 @@ jobs:
216244
publish-base-to-npm:
217245
if: github.event_name != 'pull_request'
218246
name: Publish the base NPM package
219-
needs: publish-binaries
247+
needs: [publish-binaries, publish-rust-client]
220248
runs-on: ubuntu-latest
221249
steps:
222250
- name: Checkout
@@ -378,7 +406,7 @@ jobs:
378406
working-directory: ./utils/release-candidate-testing/node
379407
run: |
380408
npm install
381-
npm install --no-save @valkey/valkey-glide@${{ env.NPM_TAG }}
409+
npm install --no-save @valkey/valkey-glide@${{ env.NPM_TAG }} @valkey/glide-rs@${{ env.NPM_TAG }}
382410
npm run test
383411
384412
- name: Deprecating packages on failure
@@ -417,6 +445,8 @@ jobs:
417445
418446
# Deprecating base package
419447
npm deprecate "@valkey/valkey-glide@${RELEASE_VERSION}" "This version has been deprecated" --force || true
448+
# Deprecating Rust client package
449+
npm deprecate "@valkey/glide-rs@${RELEASE_VERSION}" "This version has been deprecated" --force || true
420450
421451
# Process platform matrix
422452
echo "${PLATFORM_MATRIX}" > platform_matrix.json

node/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
* Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
33
*/
44

5-
export { ClusterScanCursor, Script } from "glide-rs";
5+
export { ClusterScanCursor, Script } from "@valkey/glide-rs";
66
export * from "./src/BaseClient";
77
export * from "./src/Commands";
88
export * from "./src/Errors";
99
export * from "./src/GlideClient";
1010
export * from "./src/GlideClusterClient";
1111
export * from "./src/Logger";
12-
export * from "./src/server-modules/GlideJson";
1312
export * from "./src/server-modules/GlideFt";
1413
export * from "./src/server-modules/GlideFtOptions";
14+
export * from "./src/server-modules/GlideJson";
1515
export * from "./src/Transaction";

node/package.json

+4-10
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,15 @@
1111
},
1212
"homepage": "https://github.com/valkey-io/valkey-glide#readme",
1313
"dependencies": {
14-
"glide-rs": "file:rust-client",
14+
"@valkey/glide-rs": "^0.1.0",
1515
"long": "^5.2.3",
1616
"npmignore": "^0.3.1",
1717
"protobufjs": "^7.4.0"
1818
},
19-
"bundleDependencies": [
20-
"glide-rs"
21-
],
2219
"scripts": {
23-
"build": "npm run prereq && npm run build-internal && npm run build-protobuf && npm run build-external",
24-
"build:release": "npm run build-internal:release && npm run build-protobuf && npm run build-external:release",
25-
"build:benchmark": "npm run build-internal:benchmark && npm run build-protobuf && npm run build-external",
26-
"build-internal": "cd rust-client && npm run build",
27-
"build-internal:release": "cd rust-client && npm run build:release",
28-
"build-internal:benchmark": "cd rust-client && npm run build:benchmark",
20+
"build": "npm run prereq && npm run build-protobuf && npm run build-external",
21+
"build:release": " npm run build-protobuf && npm run build-external:release",
22+
"build:benchmark": " npm run build-protobuf && npm run build-external",
2923
"build-external": "rm -rf build-ts && tsc",
3024
"build-external:release": "rm -rf build-ts && tsc --stripInternal",
3125
"build-protobuf": "npm run compile-protobuf-files && npm run fix-protobuf-file",

node/rust-client/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "glide-rs",
2+
"name": "@valkey/glide-rs",
33
"version": "0.1.0",
44
"description": "Valkey client",
55
"main": "index.js",

node/src/BaseClient.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
StartSocketConnection,
1111
getStatistics,
1212
valueFromSplitPointer,
13-
} from "glide-rs";
13+
} from "@valkey/glide-rs";
1414
import * as net from "net";
1515
import { Buffer, BufferWriter, Long, Reader, Writer } from "protobufjs";
1616
import {

node/src/Commands.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
33
*/
44

5-
import { createLeakedStringVec, MAX_REQUEST_ARGS_LEN } from "glide-rs";
5+
import { createLeakedStringVec, MAX_REQUEST_ARGS_LEN } from "@valkey/glide-rs";
66
import Long from "long";
77

88
import {

node/src/GlideClusterClient.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
33
*/
44

5-
import { ClusterScanCursor, Script } from "glide-rs";
5+
import { ClusterScanCursor, Script } from "@valkey/glide-rs";
66
import * as net from "net";
77
import {
88
AdvancedBaseClientConfiguration,
@@ -17,14 +17,14 @@ import {
1717
convertGlideRecordToRecord,
1818
} from "./BaseClient";
1919
import {
20+
ClusterScanOptions,
2021
FlushMode,
2122
FunctionListOptions,
2223
FunctionListResponse,
2324
FunctionRestorePolicy,
2425
FunctionStatsSingleResponse,
2526
InfoOptions,
2627
LolwutOptions,
27-
ClusterScanOptions,
2828
createClientGetName,
2929
createClientId,
3030
createConfigGet,

node/src/Logger.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
33
*/
44

5-
import { InitInternalLogger, Level, log } from "glide-rs";
5+
import { InitInternalLogger, Level, log } from "@valkey/glide-rs";
66

77
const LEVEL = new Map<LevelOptions | undefined, Level | undefined>([
88
["error", Level.Error],

0 commit comments

Comments
 (0)