Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node: Check API exports symbols #2721

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
353410b
Node: Check exports
prateek-kumar-improving Nov 20, 2024
2039066
Node: Get all .ts file names
prateek-kumar-improving Nov 21, 2024
07b96df
Node: code cleanup
prateek-kumar-improving Nov 21, 2024
6c74411
Node: code cleanup
prateek-kumar-improving Nov 21, 2024
7bda107
Node: find missing symbols
prateek-kumar-improving Nov 25, 2024
befe812
Revert "Python: add AZ Affinity ReadFrom strategy Support" (#2719)
adarovadya Nov 20, 2024
9111740
Python: rename glide json (#2702)
shohamazon Nov 20, 2024
9c26a5b
Node: add AZ Affinity ReadFrom strategy Support (#2686)
Muhammad-awawdi-amazon Nov 20, 2024
d15769c
Python: add AZAffinity ReadFrom strategy support (#2723)
adarovadya Nov 20, 2024
07e55c6
Java: AZ Awareness (#2678)
tjzhang-BQ Nov 20, 2024
e19e500
Java: Add password update API (#2677)
Yury-Fridlyand Nov 21, 2024
6e94ff3
Python: nit fix (#2726)
adarovadya Nov 21, 2024
cb2525b
Allow user to set different logging directory by passing environment …
eifrah-aws Nov 21, 2024
417369a
Node - Client API for retrieving internal statistics (#2727)
Muhammad-awawdi-amazon Nov 21, 2024
62686e1
Decrease Warnings in the CI (#2703)
Muhammad-awawdi-amazon Nov 21, 2024
cb9ce08
Java: adding changelog for java az support change (#2734)
tjzhang-BQ Nov 21, 2024
7d84045
Node rc fixes + unpublish on failure mechanism (#2737)
avifenesh Nov 25, 2024
6fa46eb
Fix node scripts and docs. (#2744)
Yury-Fridlyand Nov 25, 2024
7123a68
Java: Fix readme (#2751)
Yury-Fridlyand Nov 25, 2024
ebd33c5
fix changelog (#2752)
Yury-Fridlyand Nov 25, 2024
bcae875
Node: check exports
prateek-kumar-improving Nov 26, 2024
90a1d43
Merge branch 'release-1.2' into node-exports-check
prateek-kumar-improving Nov 26, 2024
0e7d169
Node package.json updated
prateek-kumar-improving Nov 26, 2024
cbf93a8
Node: add API test for glide release package
acarbonetto Nov 26, 2024
385bbae
Fix build script
acarbonetto Nov 26, 2024
a48d8b8
Node: Update loadNativeBinding() in index.ts
prateek-kumar-improving Nov 27, 2024
0232cc8
Additional cleanup for Node package builder
acarbonetto Nov 27, 2024
10cf60d
Node: branch rebased
prateek-kumar-improving Nov 27, 2024
d88e21a
Node: update list type
prateek-kumar-improving Nov 27, 2024
94212bf
Merge branch 'main' into node-exports-check
prateek-kumar-improving Dec 10, 2024
7cc2b1a
Resolve merge conflicts
prateek-kumar-improving Dec 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions node/DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,24 @@ Before starting this step, make sure you've installed all software requirments.
5. Integrating the built GLIDE package into your project:
Add the package to your project using the folder path with the command `npm install <path to GLIDE>/node`.

6. Testing the GLIDE npm package:
The `node/npm/glide` folder contains a package wrapper that re-exports all the native bindings. To build and test this package, follow these steps:
```bash
cd node;
npm run build; # build the @valkey/valkey-glide-impl package
cd npm/glide; # navigate to the npm package directory

export scope=@valkey/
export pkg_name=valkey-glide
export package_version=99.99.0 # set the version as desired
export native_binding=impl # to run against the local build at ../..
envsubst < package.json.tmpl > "package.json" # only needs to be run when the env variables change

npm i
npm run build:test
npm test
```

- For a fast build, execute `npm run build`. This will perform a full, unoptimized build, which is suitable for developing tests. Keep in mind that performance is significantly affected in an unoptimized build, so it's required to build with the `build:release` or `build:benchmark` option when measuring performance.
- If your modifications are limited to the TypeScript code, run `npm run build-external` to build the external package without rebuilding the internal package.
- If your modifications are limited to the Rust code, execute `npm run build-internal` to build the internal package and generate TypeScript code.
Expand Down
111 changes: 57 additions & 54 deletions node/npm/glide/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,67 +11,70 @@ let globalObject = global as unknown;

/* eslint-disable @typescript-eslint/no-require-imports */
function loadNativeBinding() {
let nativeBinding = null;
const scope = process.env.scope || "@scope";

switch (platform) {
case "linux":
switch (arch) {
case "x64":
switch (familySync()) {
case GLIBC:
nativeBinding = require("@scope/valkey-glide-linux-x64");
break;
case MUSL:
nativeBinding = require("@scope/valkey-glide-linux-musl-x64");
break;
default:
nativeBinding = require("@scope/valkey-glide-linux-x64");
break;
}
let nativeBinding = [];
let nativeStr = process.env.native_binding;

break;
case "arm64":
switch (familySync()) {
case GLIBC:
nativeBinding = require("@scope/valkey-glide-linux-arm64");
break;
case MUSL:
nativeBinding = require("@scope/valkey-glide-linux-musl-arm64");
break;
default:
nativeBinding = require("@scope/valkey-glide-linux-arm64");
break;
}
if (nativeStr == undefined) {
switch (platform) {
case "linux":
switch (arch) {
case "x64":
switch (familySync()) {
case MUSL:
nativeStr = "linux-musl-x64";
break;
case GLIBC:
default:
nativeStr = "linux-x64";
break;
}

break;
default:
throw new Error(
`Unsupported OS: ${platform}, architecture: ${arch}`,
);
}
break;
case "arm64":
switch (familySync()) {
case MUSL:
nativeStr = "linux-musl-arm64";
break;
case GLIBC:
default:
nativeStr = "linux-arm64";
break;
}

break;
case "darwin":
switch (arch) {
case "x64":
nativeBinding = require("@scope/valkey-glide-darwin-x64");
break;
case "arm64":
nativeBinding = require("@scope/valkey-glide-darwin-arm64");
break;
default:
throw new Error(
`Unsupported OS: ${platform}, architecture: ${arch}`,
);
}
break;
default:
throw new Error(
`Unsupported OS: ${platform}, architecture: ${arch}`,
);
}

break;
default:
throw new Error(
`Unsupported OS: ${platform}, architecture: ${arch}`,
);
break;
case "darwin":
switch (arch) {
case "x64":
nativeStr = "darwin-x64";
break;
case "arm64":
nativeStr = "darwin-arm64";
break;
default:
throw new Error(
`Unsupported OS: ${platform}, architecture: ${arch}`,
);
}

break;
default:
throw new Error(
`Unsupported OS: ${platform}, architecture: ${arch}`,
);
}
}

nativeBinding = require(`${scope}valkey-glide-${nativeStr}`);

if (!nativeBinding) {
throw new Error(`Failed to load native binding`);
}
Expand Down
32 changes: 32 additions & 0 deletions node/npm/glide/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/* eslint no-undef: off */
module.exports = {
preset: "ts-jest",
transform: {
"^.+\\.(t|j)s$": ["ts-jest", { isolatedModules: true }],
},
testEnvironment: "node",
testRegex: "/tests/.*\\.(test|spec)?\\.(ts|tsx)$",
moduleFileExtensions: [
"ts",
"tsx",
"js",
"jsx",
"json",
"node",
"cjs",
"mjs",
],
testTimeout: 600000,
reporters: [
"default",
[
"./node_modules/jest-html-reporter",
{
includeFailureMsg: true,
includeSuiteFailure: true,
executionTimeWarningThreshold: 60,
sort: "status",
},
],
]
};
16 changes: 12 additions & 4 deletions node/npm/glide/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "${scope}${pkg_name}",
"name": "@valkey/valkey-glide",
"types": "build-ts/index.d.ts",
"version": "${package_version}",
"version": "99.99.0",
"description": "General Language Independent Driver for the Enterprise (GLIDE) for Valkey",
"main": "build-ts/index.js",
"module": "build-ts/index.js",
Expand All @@ -11,7 +11,9 @@
"lint:fix": "eslint . --fix",
"clean": "rm -rf build-ts/",
"copy-declaration-files": "cp ../../build-ts/*.d.ts build-ts/ && cp ../../build-ts/src/*.d.ts build-ts/src/ && cp ../../build-ts/src/server-modules/*.d.ts build-ts/src/server-modules/",
"build": "tsc && mkdir -p build-ts/src && mkdir -p build-ts/src/server-modules && npm run copy-declaration-files"
"build": "tsc && mkdir -p build-ts/src && mkdir -p build-ts/src/server-modules && npm run copy-declaration-files",
"build:test": "npm i && npm run build",
"test": "jest --verbose"
},
"files": [
"/build-ts"
Expand All @@ -33,11 +35,17 @@
},
"homepage": "https://github.com/valkey-io/valkey-glide#readme",
"devDependencies": {
"@jest/globals": "^29.7.0",
"@types/jest": "^29.5.14",
"ts-jest": "^29.2.5",
"jest": "^29.7.0",
"jest-html-reporter": "^3.10.2",
"@types/node": "^18.11.18",
"@typescript-eslint/eslint-plugin": "^5.48.0",
"@typescript-eslint/parser": "^5.48.0",
"eslint": "^8.31.0",
"typescript": "^4.9.4"
"typescript": "^4.9.4",
"@valkey/valkey-glide-darwin-x64": "../.."
},
"optionalDependencies": {
"${scope}valkey-glide-darwin-arm64": "${package_version}",
Expand Down
75 changes: 75 additions & 0 deletions node/npm/glide/package.json.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"name": "${scope}${pkg_name}",
"types": "build-ts/index.d.ts",
"version": "${package_version}",
"description": "General Language Independent Driver for the Enterprise (GLIDE) for Valkey",
"main": "build-ts/index.js",
"module": "build-ts/index.js",
"type": "commonjs",
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"clean": "rm -rf build-ts/",
"copy-declaration-files": "cp ../../build-ts/*.d.ts build-ts/ && cp ../../build-ts/src/*.d.ts build-ts/src/ && cp ../../build-ts/src/server-modules/*.d.ts build-ts/src/server-modules/",
"build": "tsc && mkdir -p build-ts/src && mkdir -p build-ts/src/server-modules && npm run copy-declaration-files",
"build:test": "npm i && npm run build",
"test": "jest --verbose"
},
"files": [
"/build-ts"
],
"repository": {
"type": "git",
"url": "git+https://github.com/valkey-io/valkey-glide.git"
},
"keywords": [
"valkey",
"valkeyClient",
"client",
"valkey-glide"
],
"author": "Valkey GLIDE Maintainers",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/valkey-io/valkey-glide/issues"
},
"homepage": "https://github.com/valkey-io/valkey-glide#readme",
"devDependencies": {
"@jest/globals": "^29.7.0",
"@types/jest": "^29.5.14",
"ts-jest": "^29.2.5",
"jest": "^29.7.0",
"jest-html-reporter": "^3.10.2",
"@types/node": "^18.11.18",
"@typescript-eslint/eslint-plugin": "^5.48.0",
"@typescript-eslint/parser": "^5.48.0",
"eslint": "^8.31.0",
"typescript": "^4.9.4",
"${scope}valkey-glide-${nativeStr}": "../.."
},
"optionalDependencies": {
"${scope}valkey-glide-darwin-arm64": "${package_version}",
"${scope}valkey-glide-darwin-x64": "${package_version}",
"${scope}valkey-glide-linux-arm64": "${package_version}",
"${scope}valkey-glide-linux-x64": "${package_version}",
"${scope}valkey-glide-linux-musl-arm64": "${package_version}",
"${scope}valkey-glide-linux-musl-x64": "${package_version}"
},
"eslintConfig": {
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"ignorePatterns": [
"build-ts/*"
],
"root": true
},
"dependencies": {
"detect-libc": "^2.0.3"
}
}
Loading
Loading