diff --git a/web/package.json b/web/package.json index 4ecaa8445..6ff990dc4 100644 --- a/web/package.json +++ b/web/package.json @@ -1,117 +1,118 @@ { "name": "web", "version": "0.0.1", "type": "module", "private": true, "license": "BSD-3-Clause", "scripts": { "clean": "rm -rf dist/ && rm -rf node_modules/ && rm -rf database/sqlite/", "dev": "yarn workspace keyserver babel-build-comm-config && yarn concurrently --names=\"NODESSR,BROWSER,WORKERS\" -c \"bgBlue.bold,bgMagenta.bold,bgCyan.bold\" \"yarn webpack --config webpack.config.cjs --config-name=server --watch\" \"yarn webpack-dev-server --config webpack.config.cjs --config-name=browser\" \"yarn webpack --config webpack.config.cjs --config-name=webworkers --watch\"", "prod": "yarn workspace keyserver babel-build-comm-config && yarn webpack --config webpack.config.cjs --env prod --progress", "test": "jest", "build-db-wasm": "./scripts/run_emscripten.sh", - "clean-db-wasm": "rm -rf database/_generated/ && rm -rf database/sqlite/" + "clean-db-wasm": "rm -rf database/_generated/ && rm -rf database/sqlite/", + "codegen-identity-grpc": "./scripts/codegen-identity-grpc.sh" }, "devDependencies": { "@babel/core": "^7.13.14", "@babel/plugin-proposal-class-properties": "^7.13.0", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.13.8", "@babel/plugin-proposal-object-rest-spread": "^7.13.8", "@babel/plugin-proposal-optional-chaining": "^7.13.12", "@babel/plugin-transform-react-constant-elements": "^7.13.13", "@babel/plugin-transform-runtime": "^7.13.10", "@babel/preset-env": "^7.13.12", "@babel/preset-flow": "^7.13.13", "@babel/preset-react": "^7.13.13", "babel-jest": "^26.6.3", "babel-plugin-transform-remove-console": "^6.9.4", "concurrently": "^5.3.0", "copy-webpack-plugin": "^11.0.0", "flow-bin": "^0.182.0", "flow-typed": "^3.2.1", "identity-obj-proxy": "^3.0.0", "jest": "^26.6.3", "protoc-gen-js": "^3.21.2", "webpack-cli": "^5.0.1", "webpack-dev-server": "^4.11.1", "webpack-manifest-plugin": "^5.0.0" }, "dependencies": { "@babel/runtime": "^7.13.10", "@commapp/olm": "0.0.10", "@commapp/opaque-ke-wasm": "npm:@commapp/opaque-ke-wasm@^0.0.3", "@emoji-mart/data": "^1.1.2", "@emoji-mart/react": "^1.1.1", "@fortawesome/fontawesome-svg-core": "1.2.25", "@fortawesome/free-regular-svg-icons": "5.11.2", "@fortawesome/free-solid-svg-icons": "5.11.2", "@fortawesome/react-fontawesome": "0.1.5", "@matrix-org/olm": "3.2.14", "@rainbow-me/rainbowkit": "^1.1.1", "basscss": "8.0.2", "brotli": "^1.3.3", "classnames": "^2.2.5", "core-js": "^3.6.5", "dateformat": "^3.0.3", "detect-browser": "^4.0.4", "emoji-mart": "^5.5.2", "ethers": "^5.7.2", "exif-js": "^2.3.0", "google-protobuf": "^3.21.2", "grpc-web": "^1.4.2", "history": "^4.6.3", "invariant": "^2.2.4", "is-svg": "^4.3.0", "isomorphic-fetch": "^3.0.0", "lib": "0.0.1", "localforage": "^1.10.0", "lodash": "^4.17.21", "qrcode.react": "^3.1.0", "react": "18.1.0", "react-circular-progressbar": "^2.0.2", "react-color": "^2.13.0", "react-dnd": "^11.1.3", "react-dnd-html5-backend": "^11.1.3", "react-dom": "18.1.0", "react-feather": "^2.0.3", "react-icomoon": "^2.5.7", "react-icons": "^4.4.0", "react-redux": "^7.1.1", "react-router": "^5.2.0", "react-router-dom": "^5.2.0", "react-switch": "^7.0.0", "react-timeago": "^7.1.0", "react-virtualized-auto-sizer": "^1.0.19", "react-window": "^1.8.9", "redux": "^4.0.4", "redux-devtools-extension": "^2.13.2", "redux-persist": "^6.0.0", "redux-thunk": "^2.2.0", "reselect": "^4.0.0", "simple-markdown": "^0.7.2", "siwe": "^1.1.6", "thumbhash": "^0.1.1", "tinycolor2": "^1.4.1", "uuid": "^3.4.0", "viem": "^1.15.4", "visibilityjs": "^2.0.2", "wagmi": "^1.4.3" }, "jest": { "roots": [ "" ], "transform": { "\\.js$": "babel-jest" }, "transformIgnorePatterns": [ "/node_modules/(?!@babel/runtime)" ], "moduleNameMapper": { "\\.(css)$": "identity-obj-proxy" }, "setupFiles": [ "/jest-setup.js" ] } } diff --git a/web/scripts/codegen-identity-grpc.sh b/web/scripts/codegen-identity-grpc.sh new file mode 100755 index 000000000..760e7a6f0 --- /dev/null +++ b/web/scripts/codegen-identity-grpc.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -Eeuo pipefail + +protoc -I=../shared/protos/ identity_client.proto --js_out=import_style=commonjs:protobufs --grpc-web_out=import_style=commonjs+dts,mode=grpcwebtext:protobufs + +mv protobufs/identity_client_pb.js protobufs/identity-structs.cjs +mv protobufs/identity_client_grpc_web_pb.js protobufs/identity-client.cjs +mv protobufs/identity_client_pb.d.ts protobufs/identity-structs.cjs.flow +mv protobufs/identity_client_grpc_web_pb.d.ts protobufs/identity-client.cjs.flow + +# This echo statement splits the string to ensure that Phabricator shows this file in reviews +echo "Make sure to edit the files to correct import paths, reintroduce @""generated annotation, and convert TS to Flow!"