-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtsrpc.config.ts
38 lines (37 loc) · 1.36 KB
/
tsrpc.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import type { TsrpcConfig } from 'tsrpc-cli'
export default <TsrpcConfig>{
// Generate ServiceProto
proto: [
{
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: { baseFile: 'src/shared/protocols/base.ts' },
msgTemplate: { baseFile: 'src/shared/protocols/base.ts' },
},
],
// Sync shared code
sync: [
{
from: 'src/shared',
to: '../site/shared',
type: 'symlink', // Change this to 'copy' if your environment not support symlink
},
],
// Dev server
dev: {
autoProto: true, // Auto regenerate proto
autoSync: true, // Auto sync when file changed
autoApi: true, // Auto create API when ServiceProto updated
watch: 'src', // Restart dev server when these files changed
entry: 'src/index.ts', // Dev server command: node -r ts-node/register {entry}
},
// Build config
build: {
autoProto: true, // Auto generate proto before build
autoSync: true, // Auto sync before build
autoApi: true, // Auto generate API before build
outDir: 'dist', // Clean this dir before build
},
}