mirror of
https://github.com/valitydev/thrift-ts.git
synced 2024-11-06 00:35:23 +00:00
TD-332: Protos merging order (#7)
This commit is contained in:
parent
1629bface0
commit
f0c895b98d
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vality/thrift-ts",
|
||||
"version": "2.3.0",
|
||||
"version": "2.3.1",
|
||||
"description": "parse .thrift file to .d.ts",
|
||||
"main": "./lib/index.js",
|
||||
"scripts": {
|
||||
|
@ -9,16 +9,14 @@ export default class ServiceCompiler extends BaseCompiler {
|
||||
public name: string,
|
||||
public service: Service,
|
||||
public includes: Includes,
|
||||
options: CompileOptions
|
||||
options: CompileOptions,
|
||||
private filePath: string
|
||||
) {
|
||||
super(options);
|
||||
}
|
||||
|
||||
getFileName(): string {
|
||||
const { dir, name } = path.parse(
|
||||
path.relative(this.options.dirPath, this.basename)
|
||||
);
|
||||
return `${path.join(dir, name)}-${path.basename(this.name, ".thrift")}`;
|
||||
return `${this.filePath}-${path.basename(this.name, ".thrift")}`;
|
||||
}
|
||||
|
||||
flush(): File {
|
||||
|
@ -103,7 +103,9 @@ export default () => {
|
||||
}
|
||||
|
||||
let compiledFiles: File[] = [];
|
||||
for (const fileDirOrPath of argv._) {
|
||||
// argv._.reverse() affects the protocol merge order
|
||||
// the first one on the list is more important
|
||||
for (const fileDirOrPath of argv._.reverse()) {
|
||||
const files = glob.sync(getFolderPath(fileDirOrPath));
|
||||
console.log("Source:", fileDirOrPath);
|
||||
const options: CompileOptions = {
|
||||
|
@ -35,7 +35,8 @@ class Compile extends BaseCompiler {
|
||||
String(k),
|
||||
services[k],
|
||||
include,
|
||||
options
|
||||
options,
|
||||
this.getFileName()
|
||||
);
|
||||
});
|
||||
}
|
||||
@ -98,8 +99,9 @@ class Compile extends BaseCompiler {
|
||||
this.definition ? "_types.d.ts" : ".ts"
|
||||
}`;
|
||||
|
||||
// TODO: ts-nocheck temporary solution for building projects with importing dependencies from the wrong protocol (may happen when merging protocols)
|
||||
const content = prettier.format(
|
||||
"// tslint:disable\n" + this.buffer.join(""),
|
||||
"// @ts-nocheck\n" + "// tslint:disable\n" + this.buffer.join(""),
|
||||
{ parser: "typescript" }
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user