TSRPC_Badminton-Scoreboard/backend/tsrpc.config.ts

39 lines
1.4 KiB
TypeScript
Raw Normal View History

2022-05-04 03:13:09 +00:00
import { CodeTemplate, TsrpcConfig } from "tsrpc-cli";
2022-04-29 06:54:55 +00:00
const tsrpcConf: TsrpcConfig = {
// Generate ServiceProto
proto: [
{
2022-05-04 03:13:09 +00:00
ptlDir: "src/shared/protocols", // Protocol dir
output: "src/shared/protocols/serviceProto.ts", // Path for generated ServiceProto
apiDir: "src/api", // API dir
docDir: "docs", // API documents dir
ptlTemplate: CodeTemplate.getExtendedPtl(),
2022-04-29 06:54:55 +00:00
// msgTemplate: CodeTemplate.getExtendedMsg(),
}
],
// Sync shared code
sync: [
{
2022-05-04 03:13:09 +00:00
from: "src/shared",
to: "../frontend/src/shared",
type: "symlink" // Change this to 'copy' if your environment not support symlink
2022-04-29 06:54:55 +00:00
}
],
// Dev server
dev: {
autoProto: true, // Auto regenerate proto
autoSync: true, // Auto sync when file changed
autoApi: true, // Auto create API when ServiceProto updated
2022-05-04 03:13:09 +00:00
watch: "src", // Restart dev server when these files changed
entry: "src/index.ts", // Dev server command: node -r ts-node/register {entry}
2022-04-29 06:54:55 +00:00
},
// Build config
build: {
autoProto: true, // Auto generate proto before build
autoSync: true, // Auto sync before build
autoApi: true, // Auto generate API before build
2022-05-04 03:13:09 +00:00
outDir: "dist", // Clean this dir before build
2022-04-29 06:54:55 +00:00
}
2022-05-04 03:13:09 +00:00
};
2022-04-29 06:54:55 +00:00
export default tsrpcConf;