Skip to content

Commit

Permalink
Resolve merge conflicts
Browse files Browse the repository at this point in the history
Signed-off-by: Prateek Kumar <[email protected]>
  • Loading branch information
prateek-kumar-improving committed Dec 10, 2024
1 parent 94212bf commit 7cc2b1a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 54 deletions.
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
2 changes: 1 addition & 1 deletion node/npm/glide/package.json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@typescript-eslint/parser": "^5.48.0",
"eslint": "^8.31.0",
"typescript": "^4.9.4",
"@valkey/valkey-glide-impl": "../.."
"${scope}valkey-glide-${nativeStr}": "../.."
},
"optionalDependencies": {
"${scope}valkey-glide-darwin-arm64": "${package_version}",
Expand Down
57 changes: 8 additions & 49 deletions node/npm/glide/tests/ExportedSymbols.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,9 @@ describe("Exported Symbols test", () => {
// }

async function getFiles(folderName: string): Promise<string[]> {
// console.log(folderName);

const files = await f.readdir(folderName, { withFileTypes: true });

const skipFolders = [
// 'build-ts',
'commonjs-test',
'glide-logs',
'hybrid-node-tests',
Expand All @@ -71,31 +68,9 @@ async function getFiles(folderName: string): Promise<string[]> {

filesWithNodeCode.push(...(await getFiles(folderName + file.name + '/')));
} else {
// console.log("not a dir: " + file.name);

// if (file.name.endsWith('.js') ||
// file.name.endsWith('.d.ts') ||
// file.name.endsWith('.json') ||
// file.name.endsWith('.rs') ||
// file.name.endsWith('.html') ||
// file.name.endsWith('.node') ||
// file.name.endsWith('.lock') ||
// file.name.endsWith('.toml') ||
// file.name.endsWith('.yml') ||
// file.name.endsWith('.rdb') ||
// file.name.endsWith('.md') ||
// file.name.localeCompare('.gitignore') == 0 ||
// file.name.localeCompare('.prettierignore') == 0 ||
// file.name.localeCompare('THIRD_PARTY_LICENSES_NODE') == 0 ||
// file.name.localeCompare('index.ts') == 0) {
// continue;
// }

if (!file.name.endsWith('.d.ts')) {
continue;
}

// i++;
filesWithNodeCode.push(folderName + file.name);
}
}
Expand All @@ -104,18 +79,17 @@ async function getFiles(folderName: string): Promise<string[]> {
}

function visitRoot(root: ts.Node) {
// (Root Level)->(Level 1)
const children: ts.Node[] = root.getChildren();

const resultList: string[] = [];

// (Root Level) -> (Level 1) -> Level 2. This is the level in the AST where all the exported symbols in a file are present.
for (const node of children) {
const nodeList: string[] = node.getChildren().map(c => visit(c)).filter(c => c !== undefined);

if (nodeList.length > 0) {
resultList.push(...nodeList);
}

console.log(resultList);
}

return resultList;
Expand All @@ -124,6 +98,7 @@ function visitRoot(root: ts.Node) {
function visit(node: ts.Node) {
let name: string | undefined = "";

// List of exported symbols we want to ignore.
switch (node.kind) {
case ts.SyntaxKind.FirstStatement:
case ts.SyntaxKind.ExportDeclaration:
Expand All @@ -132,10 +107,7 @@ function visit(node: ts.Node) {
return;
}

// list of kind we like:
// InterfaceDeclaration
// FunctionDeclaration

// list exported symbols we want to check for, like, InterfaceDeclaration, FunctionDeclaration, etc.
if (ts.isFunctionDeclaration(node)) {
name = node.name?.text;
} else if (ts.isVariableStatement(node)) {
Expand All @@ -152,37 +124,24 @@ function visit(node: ts.Node) {
name = node.name?.text;
}

const debug: string[] = [];
const children = node.getChildren();
const isInternal = children.find(c => (ts.SyntaxKind[c.kind] == "JSDocComment"))?.getText().includes('@internal');
const isExported = children.find(c => (ts.SyntaxKind[c.kind] == "SyntaxList"))?.getChildren().find(c => (ts.SyntaxKind[c.kind] == "ExportKeyword"));

if (isExported && !isInternal) {
// debug.push('depth=' + depth + ", ts.SyntaxKind===" + ts.SyntaxKind[node.kind] + ", name=" + name);
// if (name) {
// debug.push(`name=${name} kind=${ts.SyntaxKind[node.kind]}`);
// } else {
// debug.push(`name=unnamed kind=${ts.SyntaxKind[node.kind]}`);
// }

// console.log(debug);
// Not internal symbol exported for external use.
return name;
}

if (isExported && isInternal) {
// marked correctly... no-op
if ((isExported && isInternal)) {
// marked correctly... no-op. Exported for internal use in the code.
}

if (!isExported && isInternal) {
// no-op
}

if (!isExported && !isInternal) {
// these are okay for now...
// debug.push(`PRIVATE??? name=unnamed kind=${ts.SyntaxKind[node.kind]} text=${node.getText()}`);
// no-op
}

// if (debug.length > 0) {
// console.log(debug);
// }
}

0 comments on commit 7cc2b1a

Please sign in to comment.