-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathtaskfile.yml
More file actions
118 lines (106 loc) · 3.52 KB
/
taskfile.yml
File metadata and controls
118 lines (106 loc) · 3.52 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
version: '3'
dotenv: ['core-api/.env', 'worker/.env', 'console/.env']
includes:
api:
taskfile: ./core-api/taskfile.yml
dir: ./core-api
console:
taskfile: ./console/taskfile.yml
dir: ./console
worker:
taskfile: ./worker/taskfile.yml
dir: ./worker
tasks:
# Development environment setup and start
# Starts both API and console development servers with hot-reload enabled
# Environment: development mode
dev:
deps:
- api:dev
- console:dev
# Production build
# Creates optimized production builds for both API and console applications
# Includes minification and bundling for both services
build:
deps:
- api:build
- console:build
- worker:build
# Production deployment
# Starts the production server for the API service
# Environment: production mode
prod:
deps:
- api:prod
# Run tests
# Executes unit and integration tests for both API and console applications
# Runs tests in parallel for both services
test:
deps:
- api:test
# - console:test
# Install dependencies
# Installs all project dependencies from package.json files
# Sets up husky for git hooks and installs dependencies for all services
install:
cmds:
- npm install -D husky
- task: api:install
- task: console:install
- task: worker:install
# API documentation generation
# Generates API documentation after ensuring API server is ready
# Waits for API server health check before generating docs
gen-api:
cmds:
- npx swagger-typescript-api generate -n api.ts -p ./.open-api/open-api.json -o ./worker/services/core-api --route-types --axios --extract-enums --unwrap-response-data --default-response any --module-name-index 1000
- cd console && task gen-api
# Docker Compose orchestration
# Starts all services using docker compose with environment variables
# Builds and recreates containers with 3 worker instances
docker-compose:
cmds:
- |
docker compose --env-file ./core-api/.env up -d --build --force-recreate --scale worker=3
# Project initialization
# Sets up environment files and initializes the development environment
# Copies example env files and starts required infrastructure services
init:
cmds:
- node -e "require('fs').copyFileSync('core-api/example.env', 'core-api/.env')"
- node -e "require('fs').copyFileSync('worker/example.env', 'worker/.env')"
- node -e "require('fs').copyFileSync('console/example.env', 'console/.env')"
- docker compose up -d postgres redis --force-recreate
deps:
- install
- worker:tools
# Protocol buffer generation
# Generates TypeScript code from protocol buffer definitions
# Updates API client和服务 definitions based on proto files
proto:
cmds:
- task: api:proto
# Clean build artifacts
# Removes all node_modules and build artifacts from all services
# Cleans up generated files and temporary build outputs
clean:
cmds:
- rm -rf ./node_modules
- task: api:clean
- task: console:clean
- task: worker:clean
# Generate migration with custom name
# Usage: task migration:generate MIGRATION_NAME=AddUserType
migration:generate:
cmds:
- task: api:migration:generate
# Run all pending migrations
# Executes all pending database migrations
migration:run:
cmds:
- task: api:migration:run
# Revert the last migration
# Rolls back the most recently executed migration
migration:revert:
cmds:
- task: api:migration:revert