mirror of
https://github.com/valitydev/frontend-thrift-codegen.git
synced 2024-11-06 02:15:17 +00:00
IMP-23: Create TS defs (#10)
This commit is contained in:
parent
8044689f3b
commit
e63646409d
@ -3,6 +3,6 @@
|
||||
<component name="PrettierConfiguration">
|
||||
<option name="myRunOnSave" value="true" />
|
||||
<option name="myRunOnReformat" value="true" />
|
||||
<option name="myFilesPattern" value="{**/*,*}.{js,ts,jsx,tsx,yml,yaml,md}" />
|
||||
<option name="myFilesPattern" value="{**/*,*}.{js,ts,jsx,tsx,yml,yaml,md,json}" />
|
||||
</component>
|
||||
</project>
|
13
lib/cli.js
13
lib/cli.js
@ -16,7 +16,7 @@ async function execWithLog(cmd, cwd = process.cwd()) {
|
||||
console.log(stdout);
|
||||
res(stdout);
|
||||
} else {
|
||||
// console.error(error);
|
||||
console.error(error);
|
||||
console.error(stderr);
|
||||
rej(error);
|
||||
}
|
||||
@ -53,10 +53,7 @@ async function genModel(paths, outputPath) {
|
||||
|
||||
async function genMetadata(paths, outputPath) {
|
||||
await execWithLog(
|
||||
`thrift-ts ${paths.join(' ')} -o ${path.join(
|
||||
outputPath,
|
||||
'metadata.json'
|
||||
)} --json --pack --prettify`
|
||||
`thrift-ts ${paths.join(' ')} -o ${path.join(outputPath, 'metadata.json')} --json`
|
||||
);
|
||||
}
|
||||
|
||||
@ -108,6 +105,12 @@ async function codegenAll() {
|
||||
genModel([PROTO_PATH, ...depsPaths], DIST_PATH),
|
||||
genMetadata([PROTO_PATH, ...depsPaths], DIST_PATH),
|
||||
]);
|
||||
await execWithLog(
|
||||
`tsc ${path.join(
|
||||
DIST_PATH,
|
||||
'*.ts'
|
||||
)} --skipLibCheck --target es2015 --lib es2021 --moduleResolution node --declaration`
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = codegenAll;
|
||||
|
18
package-lock.json
generated
18
package-lock.json
generated
@ -10,6 +10,7 @@
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@vality/thrift-ts": "^2.2.2-e258b9a.0",
|
||||
"typescript": "^4.6.2",
|
||||
"yargs": "^17.3.1"
|
||||
},
|
||||
"bin": {
|
||||
@ -795,6 +796,18 @@
|
||||
"resolved": "https://registry.npmjs.org/thrift-parser/-/thrift-parser-0.4.2.tgz",
|
||||
"integrity": "sha1-lHKac3nOA+AL6+Odocvze70zhjs="
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "4.6.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz",
|
||||
"integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==",
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/which": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
|
||||
@ -1431,6 +1444,11 @@
|
||||
"resolved": "https://registry.npmjs.org/thrift-parser/-/thrift-parser-0.4.2.tgz",
|
||||
"integrity": "sha1-lHKac3nOA+AL6+Odocvze70zhjs="
|
||||
},
|
||||
"typescript": {
|
||||
"version": "4.6.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz",
|
||||
"integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg=="
|
||||
},
|
||||
"which": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
|
||||
|
@ -17,6 +17,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@vality/thrift-ts": "^2.2.2-e258b9a.0",
|
||||
"typescript": "^4.6.2",
|
||||
"yargs": "^17.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -1,6 +1,4 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": [
|
||||
"local>valitydev/.github:renovate-config"
|
||||
]
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": ["local>valitydev/.github:renovate-config"]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user