Refactor thrift proto generation and add skipper proto (#187)

This commit is contained in:
Rinat Arsaev 2020-09-24 14:57:38 +03:00 committed by GitHub
parent 2e98776b11
commit 785b65309b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 282 additions and 142 deletions

9
.gitignore vendored
View File

@ -38,13 +38,8 @@ testem.log
.DS_Store
Thumbs.db
/src/assets/meta-damsel.json
/src/app/thrift-services/damsel/gen-*
/src/app/thrift-services/machinegun/gen-*
/src/app/thrift-services/fistful/gen-*
/src/app/thrift-services/messages/gen-*
/src/app/thrift-services/ank/gen-*
/src/app/thrift-services/file-storage/gen-*
/src/assets/meta-*.json
/src/app/thrift-services/**/gen-*/
# Sonar
.scannerwork

View File

@ -4,5 +4,5 @@ node_modules
dist
build_utils
.scannerwork
gen-*
src/app/thrift-services/**/gen-*/
src/assets/icons

View File

@ -42,67 +42,12 @@ init:
echo -e "//npm.pkg.github.com/:_authToken=$(NPM_TOKEN)" >> .npmrc
npm ci
compile: compile-damsel compile-machinegun compile-fistful compile-messages compile-file-storage compile-ank
compile:
npm run compile-thrift
build: check lint compile
npm run build
clean-compile: clean compile
clean:
rm -rf dist src/app/thrift/gen-* src/assets/meta-damsel.json src/app/gen-model src/app/machinegun/gen-* src/app/fistful/gen-* src/app/messages/gen-* src/app/file-storage/gen-* src/app/ank/gen-*
compile-damsel: damsel-client damsel-model damsel-meta
damsel-client:
@$(foreach file,domain_config payment_processing merch_stat claim_management,echo $(file); thrift -r -gen js:node,runtime_package=woody_js/dist/thrift -o ./src/app/thrift-services/damsel ./node_modules/damsel/proto/$(file).thrift;)
damsel-meta:
npm run damsel-meta
damsel-model:
npm run damsel-model
compile-machinegun: machinegun-model machinegun-client
machinegun-client:
@$(foreach file,state_processing,echo $(file); thrift -r -gen js:node,runtime_package=woody_js/dist/thrift -o ./src/app/thrift-services/machinegun ./node_modules/machinegun_proto/proto/$(file).thrift;)
machinegun-model:
npm run machinegun-model
compile-fistful: fistful-model fistful-client
fistful-client:
@$(foreach file,withdrawal_session fistful_admin fistful_stat,echo $(file); thrift -r -gen js:node,runtime_package=woody_js/dist/thrift -o ./src/app/thrift-services/fistful ./node_modules/fistful-proto/proto/$(file).thrift;)
fistful-model:
npm run fistful-model
compile-messages: messages-model messages-client
messages-client:
@$(foreach file,messages,echo $(file); thrift -r -gen js:node,runtime_package=woody_js/dist/thrift -o ./src/app/thrift-services/messages ./node_modules/messages-proto/proto/$(file).thrift;)
messages-model:
npm run messages-model
compile-file-storage: file-storage-model file-storage-client
file-storage-client:
@$(foreach file,file_storage,echo $(file); thrift -r -gen js:node,runtime_package=woody_js/dist/thrift -o ./src/app/thrift-services/file-storage ./node_modules/file-storage-proto/proto/$(file).thrift;)
file-storage-model:
npm run file-storage-model
compile-ank: ank-model ank-client
ank-client:
@$(foreach file,questionary_manager,echo $(file); thrift -r -gen js:node,runtime_package=woody_js/dist/thrift -o ./src/app/thrift-services/ank ./node_modules/ank-proto/proto/$(file).thrift;)
ank-model:
npm run ank-model
lint:
npm run lint

View File

@ -4,7 +4,7 @@
```sh
make wc_shell
make clean-compile
make compile
```
## Запуск Sonar'a

215
package-lock.json generated
View File

@ -3799,6 +3799,15 @@
"resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz",
"integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ=="
},
"@types/del": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@types/del/-/del-4.0.0.tgz",
"integrity": "sha512-LDE5atstX5kKnTobWknpmGHC52DH/tp8pIVsD2SSxaOFqW3AQr0EpdzYIfkZ331xe7l9Vn9NlJsBG6viU3mjBA==",
"dev": true,
"requires": {
"del": "*"
}
},
"@types/fs-extra": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-5.1.0.tgz",
@ -7343,95 +7352,84 @@
}
},
"del": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/del/-/del-4.1.1.tgz",
"integrity": "sha512-QwGuEUouP2kVwQenAsOof5Fv8K9t3D8Ca8NxcXKrIpEHjTXK5J2nXLdP+ALI1cgv8wj7KuwBhTwBkOZSJKM5XQ==",
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/del/-/del-5.1.0.tgz",
"integrity": "sha512-wH9xOVHnczo9jN2IW68BabcecVPxacIA3g/7z6vhSU/4stOKQzeCRK0yD0A24WiAAUJmmVpWqrERcTxnLo3AnA==",
"dev": true,
"requires": {
"@types/glob": "^7.1.1",
"globby": "^6.1.0",
"is-path-cwd": "^2.0.0",
"is-path-in-cwd": "^2.0.0",
"p-map": "^2.0.0",
"pify": "^4.0.1",
"rimraf": "^2.6.3"
"globby": "^10.0.1",
"graceful-fs": "^4.2.2",
"is-glob": "^4.0.1",
"is-path-cwd": "^2.2.0",
"is-path-inside": "^3.0.1",
"p-map": "^3.0.0",
"rimraf": "^3.0.0",
"slash": "^3.0.0"
},
"dependencies": {
"array-union": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz",
"integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==",
"dev": true
},
"globby": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz",
"integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=",
"version": "10.0.2",
"resolved": "https://registry.npmjs.org/globby/-/globby-10.0.2.tgz",
"integrity": "sha512-7dUi7RvCoT/xast/o/dLN53oqND4yk0nsHkhRgn9w65C4PofCLOoJ39iSOg+qVDdWQPIEj+eszMHQ+aLVwwQSg==",
"dev": true,
"requires": {
"array-union": "^1.0.1",
"glob": "^7.0.3",
"object-assign": "^4.0.1",
"pify": "^2.0.0",
"pinkie-promise": "^2.0.0"
},
"dependencies": {
"pify": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
"dev": true
}
"@types/glob": "^7.1.1",
"array-union": "^2.1.0",
"dir-glob": "^3.0.1",
"fast-glob": "^3.0.3",
"glob": "^7.1.3",
"ignore": "^5.1.1",
"merge2": "^1.2.3",
"slash": "^3.0.0"
}
},
"graceful-fs": {
"version": "4.2.4",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
"integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==",
"dev": true
},
"is-path-cwd": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz",
"integrity": "sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ==",
"dev": true
},
"is-path-in-cwd": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-2.1.0.tgz",
"integrity": "sha512-rNocXHgipO+rvnP6dk3zI20RpOtrAM/kzbB258Uw5BWr3TpXi861yzjo16Dn4hUox07iw5AyeMLHWsujkjzvRQ==",
"dev": true,
"requires": {
"is-path-inside": "^2.1.0"
}
},
"is-path-inside": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-2.1.0.tgz",
"integrity": "sha512-wiyhTzfDWsvwAW53OBWF5zuvaOGlZ6PwYxAbPVDhpm+gM09xKQGjBq/8uYN12aDvMxnAnq3dxTyoSoRNmg5YFg==",
"dev": true,
"requires": {
"path-is-inside": "^1.0.2"
}
},
"p-map": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/p-map/-/p-map-2.1.0.tgz",
"integrity": "sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==",
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.2.tgz",
"integrity": "sha512-/2UGPSgmtqwo1ktx8NDHjuPwZWmHhO+gj0f93EkhLB5RgW9RZevWYYlIkS6zePc6U2WpOdQYIwHe9YC4DWEBVg==",
"dev": true
},
"p-map": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz",
"integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==",
"dev": true,
"requires": {
"aggregate-error": "^3.0.0"
}
},
"rimraf": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
"integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
"dev": true,
"requires": {
"glob": "^7.1.3"
},
"dependencies": {
"glob": {
"version": "7.1.6",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
"integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.0.4",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
}
}
},
"slash": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
"integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
"dev": true
}
}
},
@ -8906,9 +8904,9 @@
}
},
"glob": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz",
"integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==",
"version": "7.1.6",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
"integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
@ -14838,6 +14836,10 @@
}
}
},
"skipper-proto": {
"version": "github:rbkmoney/skipper-proto#d33d87cd9080925861f755b11ee1f16378076f74",
"from": "github:rbkmoney/skipper-proto#d33d87cd9080925861f755b11ee1f16378076f74"
},
"slash": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz",
@ -17844,6 +17846,21 @@
"ms": "^2.1.1"
}
},
"del": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/del/-/del-4.1.1.tgz",
"integrity": "sha512-QwGuEUouP2kVwQenAsOof5Fv8K9t3D8Ca8NxcXKrIpEHjTXK5J2nXLdP+ALI1cgv8wj7KuwBhTwBkOZSJKM5XQ==",
"dev": true,
"requires": {
"@types/glob": "^7.1.1",
"globby": "^6.1.0",
"is-path-cwd": "^2.0.0",
"is-path-in-cwd": "^2.0.0",
"p-map": "^2.0.0",
"pify": "^4.0.1",
"rimraf": "^2.6.3"
}
},
"emoji-regex": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
@ -17888,6 +17905,27 @@
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
"dev": true
},
"globby": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz",
"integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=",
"dev": true,
"requires": {
"array-union": "^1.0.1",
"glob": "^7.0.3",
"object-assign": "^4.0.1",
"pify": "^2.0.0",
"pinkie-promise": "^2.0.0"
},
"dependencies": {
"pify": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
"dev": true
}
}
},
"is-absolute-url": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-3.0.3.tgz",
@ -17909,6 +17947,30 @@
"kind-of": "^3.0.2"
}
},
"is-path-cwd": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz",
"integrity": "sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ==",
"dev": true
},
"is-path-in-cwd": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-2.1.0.tgz",
"integrity": "sha512-rNocXHgipO+rvnP6dk3zI20RpOtrAM/kzbB258Uw5BWr3TpXi861yzjo16Dn4hUox07iw5AyeMLHWsujkjzvRQ==",
"dev": true,
"requires": {
"is-path-inside": "^2.1.0"
}
},
"is-path-inside": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-2.1.0.tgz",
"integrity": "sha512-wiyhTzfDWsvwAW53OBWF5zuvaOGlZ6PwYxAbPVDhpm+gM09xKQGjBq/8uYN12aDvMxnAnq3dxTyoSoRNmg5YFg==",
"dev": true,
"requires": {
"path-is-inside": "^1.0.2"
}
},
"kind-of": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz",
@ -17924,6 +17986,12 @@
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"dev": true
},
"p-map": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/p-map/-/p-map-2.1.0.tgz",
"integrity": "sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==",
"dev": true
},
"readdirp": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz",
@ -17941,6 +18009,15 @@
"integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==",
"dev": true
},
"rimraf": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz",
"integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
"dev": true,
"requires": {
"glob": "^7.1.3"
}
},
"schema-utils": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz",

View File

@ -12,13 +12,7 @@
"prettier:fix": "npm run prettier-preset -- --write",
"fix": "npm run lint:fix; npm run prettier:fix",
"e2e": "ng e2e",
"damsel-model": "thrift-ts node_modules/damsel/proto -o src/app/thrift-services/damsel/gen-model -d false",
"damsel-meta": "thrift-ts node_modules/damsel/proto -o src/assets/meta-damsel.json --json --pack --prettify",
"machinegun-model": "thrift-ts node_modules/machinegun_proto/proto -o src/app/thrift-services/machinegun/gen-model -d false",
"fistful-model": "thrift-ts node_modules/fistful-proto/proto -o src/app/thrift-services/fistful/gen-model -d false",
"messages-model": "thrift-ts node_modules/messages-proto/proto -o src/app/thrift-services/messages/gen-model -d false",
"file-storage-model": "thrift-ts node_modules/file-storage-proto/proto -o src/app/thrift-services/file-storage/gen-model -d false",
"ank-model": "thrift-ts node_modules/ank-proto/proto -o src/app/thrift-services/ank/gen-model -d false",
"compile-thrift": "ts-node --project tools/tsconfig.json tools/compile-thrift",
"postinstall": "ngcc"
},
"private": true,
@ -54,6 +48,7 @@
"monaco-editor": "~0.15.6",
"pdfmake": "^0.1.64",
"rxjs": "^6.5.5",
"skipper-proto": "github:rbkmoney/skipper-proto#d33d87cd9080925861f755b11ee1f16378076f74",
"thrift-ts": "git+ssh://git@github.com/rbkmoney/thrift-ts.git#a5e3830ad30d5717e5e627ddcefa8f4d8918b174",
"transliteration": "^2.1.8",
"tslib": "^2.0.0",
@ -66,6 +61,8 @@
"@angular-devkit/build-angular": "^0.1000.6",
"@angular/cli": "^10.0.6",
"@angular/compiler-cli": "^10.0.10",
"@types/del": "^4.0.0",
"@types/glob": "^7.1.3",
"@types/humanize-duration": "~3.18.0",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
@ -75,6 +72,8 @@
"@types/pdfmake": "^0.1.9",
"@types/uuid": "~3.4.3",
"codelyzer": "^6.0.0",
"del": "^5.1.0",
"glob": "^7.1.6",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~5.0.0",
"jwt-decode": "~2.2.0",

View File

11
thrift-config.json Normal file
View File

@ -0,0 +1,11 @@
{
"proto": {
"damsel": { "path": "./node_modules/damsel/proto", "meta": true },
"machinegun": "./node_modules/machinegun_proto/proto",
"fistful": "./node_modules/fistful-proto/proto",
"messages": "./node_modules/messages-proto/proto",
"file-storage": "./node_modules/file-storage-proto/proto",
"ank": "./node_modules/ank-proto/proto",
"skipper": "./node_modules/skipper-proto/proto"
}
}

103
tools/compile-thrift.ts Normal file
View File

@ -0,0 +1,103 @@
import { exec } from 'child_process';
import * as del from 'del';
import { glob } from 'glob';
import * as path from 'path';
import * as config from '../thrift-config.json';
const ROOT_DIR = path.join(__dirname, '..');
const THRIFT_PATH = 'woody_js/dist/thrift';
const OUTPUT_PATH = './src/app/thrift-services';
const GEN_MODEL_DIR = 'gen-model';
const GEN_CLIENT_DIR = 'gen-nodejs';
const META_PATH = 'src/assets';
async function execWithLog(cmd: string) {
console.log(`> ${cmd}`);
return await new Promise<string>((res, rej) =>
exec(
cmd,
{
cwd: ROOT_DIR,
},
(error, stdout, stderr) => {
if (error === null) {
console.log(stderr);
res(stdout);
} else {
console.error(error);
console.error(stderr);
rej(error);
}
}
)
);
}
async function genClient(name: string, thriftPath: string) {
const out = path.join(OUTPUT_PATH, name);
await del([path.join(OUTPUT_PATH, GEN_CLIENT_DIR)]);
return await execWithLog(
`thrift -r -gen js:node,runtime_package=${THRIFT_PATH} -o ${out} ${thriftPath};`
);
}
async function genModel(name: string, protoPath: string) {
const out = path.join(OUTPUT_PATH, name, GEN_MODEL_DIR);
await del([path.join(OUTPUT_PATH, GEN_MODEL_DIR)]);
return await execWithLog(`thrift-ts ${protoPath} -o ${out} -d false`);
}
async function genMeta(name: string, protoPath: string) {
const out = path.join(META_PATH, `meta-${name}.json`);
await del([out]);
return await execWithLog(`thrift-ts ${protoPath} -o ${out} --json --pack --prettify`);
}
async function compileProto(protoName: string, proto: string | { path: string; meta: boolean }) {
let protoPath: string;
let withMeta = false;
if (typeof proto === 'object') {
protoPath = proto.path;
withMeta = proto.meta;
} else {
protoPath = proto;
}
const globPattern = path.join(`${protoPath}/**/*.thrift`);
const thriftFiles = await new Promise<string[]>((res, rej) =>
glob(globPattern, {}, (err, files) => {
if (err) {
rej(err);
}
res(files);
})
);
console.log(`Compile ${protoName}: ${protoPath}`);
const genList: Promise<any>[] = [];
genList.push(genModel(protoName, protoPath));
if (withMeta) {
genList.push(genMeta(protoName, protoPath));
}
for (const f of thriftFiles) {
genList.push(genClient(protoName, f));
}
await Promise.all(genList);
}
async function compileProtos() {
try {
await Promise.all(
Object.entries(config.proto).map(([protoName, proto]) => compileProto(protoName, proto))
);
console.log('Generated');
} catch (e) {
console.error(e);
console.error('Not generated');
throw e;
}
}
compileProtos();

10
tools/tsconfig.json Normal file
View File

@ -0,0 +1,10 @@
{
"compilerOptions": {
"target": "es2015",
"moduleResolution": "node",
"lib": ["esnext"],
"module": "commonjs",
"resolveJsonModule": true,
"allowJs": true
}
}