From 1855fb8d9b2b53ed8037033092ee6c94cd36332b Mon Sep 17 00:00:00 2001 From: William Oldham Date: Sun, 24 Nov 2024 17:58:04 +0000 Subject: [PATCH 1/4] Change TS compiler to ts-proto and nice-grpc for backwards compatibility --- buf.gen.yaml | 13 ++-- package-lock.json | 159 ++++++++++++++++++++++++++++++---------------- package.json | 13 ++-- tsconfig.json | 17 +++++ 4 files changed, 138 insertions(+), 64 deletions(-) create mode 100644 tsconfig.json diff --git a/buf.gen.yaml b/buf.gen.yaml index 578a734..8d9017f 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -11,10 +11,13 @@ plugins: out: go opt: - paths=source_relative - - local: protoc-gen-ts + - local: protoc-gen-ts_proto + strategy: all opt: - - eslint_disable - - output_javascript - - output_legacy_commonjs - - ts_nocheck + - outputServices=nice-grpc + - outputServices=generic-definitions + - useExactTypes=false + - esModuleInterop=true + - env=node + - forceLong=bigint out: javascript \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index d5d9072..d6f9dfa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,14 +9,17 @@ "version": "2.0.0", "license": "AGPL-3.0-only", "dependencies": { - "@protobuf-ts/runtime": "^2.9.4" + "@bufbuild/protobuf": "^2.2.2", + "nice-grpc-common": "^2.0.2", + "typescript": "^5.7.2" }, "devDependencies": { "@bufbuild/buf": "^1.46.0", - "@protobuf-ts/plugin": "^2.9.4", + "@types/node": "^22.9.3", "copyfiles": "^2.4.1", "npm-run-all": "^4.1.5", - "rimraf": "^6.0.1" + "rimraf": "^6.0.1", + "ts-proto": "^2.3.0" } }, "node_modules/@bufbuild/buf": { @@ -138,6 +141,11 @@ "node": ">=12" } }, + "node_modules/@bufbuild/protobuf": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-2.2.2.tgz", + "integrity": "sha512-UNtPCbrwrenpmrXuRwn9jYpPoweNXj8X5sMvYgsqYyaH8jQ6LfUJSk3dJLnBK+6sfYPrF4iAIo5sd5HQ+tg75A==" + }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -234,54 +242,13 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/@protobuf-ts/plugin": { - "version": "2.9.4", - "resolved": "https://registry.npmjs.org/@protobuf-ts/plugin/-/plugin-2.9.4.tgz", - "integrity": "sha512-Db5Laq5T3mc6ERZvhIhkj1rn57/p8gbWiCKxQWbZBBl20wMuqKoHbRw4tuD7FyXi+IkwTToaNVXymv5CY3E8Rw==", - "dev": true, - "dependencies": { - "@protobuf-ts/plugin-framework": "^2.9.4", - "@protobuf-ts/protoc": "^2.9.4", - "@protobuf-ts/runtime": "^2.9.4", - "@protobuf-ts/runtime-rpc": "^2.9.4", - "typescript": "^3.9" - }, - "bin": { - "protoc-gen-dump": "bin/protoc-gen-dump", - "protoc-gen-ts": "bin/protoc-gen-ts" - } - }, - "node_modules/@protobuf-ts/plugin-framework": { - "version": "2.9.4", - "resolved": "https://registry.npmjs.org/@protobuf-ts/plugin-framework/-/plugin-framework-2.9.4.tgz", - "integrity": "sha512-9nuX1kjdMliv+Pes8dQCKyVhjKgNNfwxVHg+tx3fLXSfZZRcUHMc1PMwB9/vTvc6gBKt9QGz5ERqSqZc0++E9A==", - "dev": true, - "dependencies": { - "@protobuf-ts/runtime": "^2.9.4", - "typescript": "^3.9" - } - }, - "node_modules/@protobuf-ts/protoc": { - "version": "2.9.4", - "resolved": "https://registry.npmjs.org/@protobuf-ts/protoc/-/protoc-2.9.4.tgz", - "integrity": "sha512-hQX+nOhFtrA+YdAXsXEDrLoGJqXHpgv4+BueYF0S9hy/Jq0VRTVlJS1Etmf4qlMt/WdigEes5LOd/LDzui4GIQ==", - "dev": true, - "bin": { - "protoc": "protoc.js" - } - }, - "node_modules/@protobuf-ts/runtime": { - "version": "2.9.4", - "resolved": "https://registry.npmjs.org/@protobuf-ts/runtime/-/runtime-2.9.4.tgz", - "integrity": "sha512-vHRFWtJJB/SiogWDF0ypoKfRIZ41Kq+G9cEFj6Qm1eQaAhJ1LDFvgZ7Ja4tb3iLOQhz0PaoPnnOijF1qmEqTxg==" - }, - "node_modules/@protobuf-ts/runtime-rpc": { - "version": "2.9.4", - "resolved": "https://registry.npmjs.org/@protobuf-ts/runtime-rpc/-/runtime-rpc-2.9.4.tgz", - "integrity": "sha512-y9L9JgnZxXFqH5vD4d7j9duWvIJ7AShyBRoNKJGhu9Q27qIbchfzli66H9RvrQNIFk5ER7z1Twe059WZGqERcA==", + "node_modules/@types/node": { + "version": "22.9.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.3.tgz", + "integrity": "sha512-F3u1fs/fce3FFk+DAxbxc78DF8x0cY09RRL8GnXLmkJ1jvx3TtPdWoTT5/NiYfI5ASqXBmfqJi9dZ3gxMx4lzw==", "dev": true, "dependencies": { - "@protobuf-ts/runtime": "^2.9.4" + "undici-types": "~6.19.8" } }, "node_modules/ansi-regex": { @@ -396,6 +363,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/case-anything": { + "version": "2.1.13", + "resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.13.tgz", + "integrity": "sha512-zlOQ80VrQ2Ue+ymH5OuM/DlDq64mEm+B9UTdHULv5osUMD6HalNTblf2b1u/m6QecjsnOkBpqVZ+XPwIVsy7Ng==", + "dev": true, + "engines": { + "node": ">=12.13" + }, + "funding": { + "url": "https://github.com/sponsors/mesqueeb" + } + }, "node_modules/chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -598,6 +577,27 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/dprint-node": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/dprint-node/-/dprint-node-1.0.8.tgz", + "integrity": "sha512-iVKnUtYfGrYcW1ZAlfR/F59cUVL8QIhWoBJoSjkkdua/dkWIgjZfiLMeTjiB06X0ZLkQ0M2C1VbUj/CxkIf1zg==", + "dev": true, + "dependencies": { + "detect-libc": "^1.0.3" + } + }, + "node_modules/dprint-node/node_modules/detect-libc": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==", + "dev": true, + "bin": { + "detect-libc": "bin/detect-libc.js" + }, + "engines": { + "node": ">=0.10" + } + }, "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", @@ -1435,6 +1435,14 @@ "node": ">=10" } }, + "node_modules/nice-grpc-common": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/nice-grpc-common/-/nice-grpc-common-2.0.2.tgz", + "integrity": "sha512-7RNWbls5kAL1QVUOXvBsv1uO0wPQK3lHv+cY1gwkTzirnG1Nop4cBJZubpgziNbaVc/bl9QJcyvsf/NQxa3rjQ==", + "dependencies": { + "ts-error": "^1.0.6" + } + }, "node_modules/nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", @@ -2186,6 +2194,44 @@ "safe-buffer": "~5.1.0" } }, + "node_modules/ts-error": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/ts-error/-/ts-error-1.0.6.tgz", + "integrity": "sha512-tLJxacIQUM82IR7JO1UUkKlYuUTmoY9HBJAmNWFzheSlDS5SPMcNIepejHJa4BpPQLAcbRhRf3GDJzyj6rbKvA==" + }, + "node_modules/ts-poet": { + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/ts-poet/-/ts-poet-6.9.0.tgz", + "integrity": "sha512-roe6W6MeZmCjRmppyfOURklO5tQFQ6Sg7swURKkwYJvV7dbGCrK28um5+51iW3twdPRKtwarqFAVMU6G1mvnuQ==", + "dev": true, + "dependencies": { + "dprint-node": "^1.0.8" + } + }, + "node_modules/ts-proto": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/ts-proto/-/ts-proto-2.3.0.tgz", + "integrity": "sha512-dOkOa4gac9zhDFsHDtTRdcAJJRDorySWwGbNhpyxtZKbTnZOM2DlnCB390ZrjTOxtx6dOB4mjFmEUcgUtbwnaQ==", + "dev": true, + "dependencies": { + "@bufbuild/protobuf": "^2.0.0", + "case-anything": "^2.1.13", + "ts-poet": "^6.7.0", + "ts-proto-descriptors": "2.0.0" + }, + "bin": { + "protoc-gen-ts_proto": "protoc-gen-ts_proto" + } + }, + "node_modules/ts-proto-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ts-proto-descriptors/-/ts-proto-descriptors-2.0.0.tgz", + "integrity": "sha512-wHcTH3xIv11jxgkX5OyCSFfw27agpInAd6yh89hKG6zqIXnjW9SYqSER2CVQxdPj4czeOhGagNvZBEbJPy7qkw==", + "dev": true, + "dependencies": { + "@bufbuild/protobuf": "^2.0.0" + } + }, "node_modules/typed-array-buffer": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.2.tgz", @@ -2260,16 +2306,15 @@ } }, "node_modules/typescript": { - "version": "3.9.10", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz", - "integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==", - "dev": true, + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", + "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=14.17" } }, "node_modules/unbox-primitive": { @@ -2287,6 +2332,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/undici-types": { + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "dev": true + }, "node_modules/untildify": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", diff --git a/package.json b/package.json index 361108c..c0424f1 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,8 @@ "scripts": { "build": "npm-run-all clean generate copy:*", "clean": "rimraf javascript go", - "generate": "buf generate", - "generate:debug": "buf generate --debug", + "generate": "buf generate && tsc", + "generate:debug": "buf generate --debug && tsc --debug", "copy:js": "copyfiles -f package.json README.md template/GENERATED_DO_NOT_EDIT.md javascript", "copy:go": "copyfiles -f template/GENERATED_DO_NOT_EDIT.md template/go/* go", "lint": "buf lint", @@ -17,12 +17,15 @@ }, "devDependencies": { "@bufbuild/buf": "^1.46.0", - "@protobuf-ts/plugin": "^2.9.4", + "@types/node": "^22.9.3", "copyfiles": "^2.4.1", "npm-run-all": "^4.1.5", - "rimraf": "^6.0.1" + "rimraf": "^6.0.1", + "ts-proto": "^2.3.0" }, "dependencies": { - "@protobuf-ts/runtime": "^2.9.4" + "@bufbuild/protobuf": "^2.2.2", + "nice-grpc-common": "^2.0.2", + "typescript": "^5.7.2" } } diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..bedb87d --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "moduleResolution": "node", + "skipLibCheck": true, + "declaration": true, + "module": "CommonJS", + "target": "ES2020", + "outDir": "javascript", + "strict": true, + "noEmitOnError": true, + "esModuleInterop": true, + }, + "include": [ + "javascript" + ], + "exclude": [] +} \ No newline at end of file From 0a7a690f75c70d9e9bd837559bae98b2e4a4738d Mon Sep 17 00:00:00 2001 From: William Oldham Date: Sun, 24 Nov 2024 18:12:31 +0000 Subject: [PATCH 2/4] Use linux file separator for the lint ignore --- buf.yaml | 82 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/buf.yaml b/buf.yaml index 1bb8c8e..54ee0b9 100644 --- a/buf.yaml +++ b/buf.yaml @@ -6,47 +6,47 @@ lint: - STANDARD ignore: # We ignore all the old files as these should remain unchanged - - protobufs\account\account_service.proto - - protobufs\account\exchange_token_for_user_data.proto - - protobufs\account\get_nex_data_rpc.proto - - protobufs\account\get_nex_password_rpc.proto - - protobufs\account\get_user_data_rpc.proto - - protobufs\account\mii.proto - - protobufs\account\pnid_permission_flags.proto - - protobufs\account\update_pnid_permissions.proto - - protobufs\api\api_service.proto - - protobufs\api\forgot_password_rpc.proto - - protobufs\api\get_user_data_rpc.proto - - protobufs\api\login_rpc.proto - - protobufs\api\mii.proto - - protobufs\api\register_rpc.proto - - protobufs\api\reset_password_rpc.proto - - protobufs\api\set_discord_connection_data_rpc.proto - - protobufs\api\set_stripe_connection_data_rpc.proto - - protobufs\api\update_user_data_rpc.proto - - protobufs\api\user_connections.proto - - protobufs\boss\boss_service.proto - - protobufs\boss\delete_file.proto - - protobufs\boss\delete_task.proto - - protobufs\boss\file.proto - - protobufs\boss\list_files.proto - - protobufs\boss\list_known_boss_apps.proto - - protobufs\boss\list_tasks.proto - - protobufs\boss\register_task.proto - - protobufs\boss\task.proto - - protobufs\boss\update_file_metadata.proto - - protobufs\boss\update_task.proto - - protobufs\boss\upload_file.proto - - protobufs\friends\accept_friend_request_rpc.proto - - protobufs\friends\deny_friend_request_rpc.proto - - protobufs\friends\friend_request.proto - - protobufs\friends\friends_service.proto - - protobufs\friends\get_user_friend_pids_rpc.proto - - protobufs\friends\get_user_friend_requests_incoming_rpc.proto - - protobufs\friends\send_user_friend_request_rpc.proto - - protobufs\friends\send_user_notification_wiiu_rpc.proto - - protobufs\miiverse\miiverse_service.proto - - protobufs\miiverse\smm_request_post_id_rpc.proto + - protobufs/account/account_service.proto + - protobufs/account/exchange_token_for_user_data.proto + - protobufs/account/get_nex_data_rpc.proto + - protobufs/account/get_nex_password_rpc.proto + - protobufs/account/get_user_data_rpc.proto + - protobufs/account/mii.proto + - protobufs/account/pnid_permission_flags.proto + - protobufs/account/update_pnid_permissions.proto + - protobufs/api/api_service.proto + - protobufs/api/forgot_password_rpc.proto + - protobufs/api/get_user_data_rpc.proto + - protobufs/api/login_rpc.proto + - protobufs/api/mii.proto + - protobufs/api/register_rpc.proto + - protobufs/api/reset_password_rpc.proto + - protobufs/api/set_discord_connection_data_rpc.proto + - protobufs/api/set_stripe_connection_data_rpc.proto + - protobufs/api/update_user_data_rpc.proto + - protobufs/api/user_connections.proto + - protobufs/boss/boss_service.proto + - protobufs/boss/delete_file.proto + - protobufs/boss/delete_task.proto + - protobufs/boss/file.proto + - protobufs/boss/list_files.proto + - protobufs/boss/list_known_boss_apps.proto + - protobufs/boss/list_tasks.proto + - protobufs/boss/register_task.proto + - protobufs/boss/task.proto + - protobufs/boss/update_file_metadata.proto + - protobufs/boss/update_task.proto + - protobufs/boss/upload_file.proto + - protobufs/friends/accept_friend_request_rpc.proto + - protobufs/friends/deny_friend_request_rpc.proto + - protobufs/friends/friend_request.proto + - protobufs/friends/friends_service.proto + - protobufs/friends/get_user_friend_pids_rpc.proto + - protobufs/friends/get_user_friend_requests_incoming_rpc.proto + - protobufs/friends/send_user_friend_request_rpc.proto + - protobufs/friends/send_user_notification_wiiu_rpc.proto + - protobufs/miiverse/miiverse_service.proto + - protobufs/miiverse/smm_request_post_id_rpc.proto breaking: use: - FILE \ No newline at end of file From 5d294fcf410d6ae3ffef9590e5860a1d14ca2506 Mon Sep 17 00:00:00 2001 From: William Oldham Date: Sun, 24 Nov 2024 18:20:14 +0000 Subject: [PATCH 3/4] Bump version to 2.0.1 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index d6f9dfa..8bfd578 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@pretendonetwork/grpc", - "version": "2.0.0", + "version": "2.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@pretendonetwork/grpc", - "version": "2.0.0", + "version": "2.0.1", "license": "AGPL-3.0-only", "dependencies": { "@bufbuild/protobuf": "^2.2.2", diff --git a/package.json b/package.json index c0424f1..5bbfc84 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@pretendonetwork/grpc", - "version": "2.0.0", + "version": "2.0.1", "license": "AGPL-3.0-only", "scripts": { "build": "npm-run-all clean generate copy:*", From 1cdbc145c31bad5392c1d50bce95b68411ae18c6 Mon Sep 17 00:00:00 2001 From: William Oldham Date: Sun, 24 Nov 2024 18:23:03 +0000 Subject: [PATCH 4/4] tsc --debug doesn't exist, remove the flag --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5bbfc84..118b7d1 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "build": "npm-run-all clean generate copy:*", "clean": "rimraf javascript go", "generate": "buf generate && tsc", - "generate:debug": "buf generate --debug && tsc --debug", + "generate:debug": "buf generate --debug && tsc", "copy:js": "copyfiles -f package.json README.md template/GENERATED_DO_NOT_EDIT.md javascript", "copy:go": "copyfiles -f template/GENERATED_DO_NOT_EDIT.md template/go/* go", "lint": "buf lint",