-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathturbo.config.ts
More file actions
133 lines (129 loc) · 3.13 KB
/
turbo.config.ts
File metadata and controls
133 lines (129 loc) · 3.13 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
import { defineConfig, pMap } from 'turbo-config'
import { PackageJson } from '@repo/tools/package'
import { getWorkspacePackages } from '@repo/tools/workspace'
export default defineConfig(async () => {
const packages = await getWorkspacePackages()
// we need to build all packages before tasks
// like linting/tests from the root
const buildPackages = await pMap(packages, async (pkg) =>
PackageJson.parse(JSON.parse((await fs.readFile(pkg.pkgJsonPath)).toString()))
).then((pkgs) =>
pkgs.filter((pkg) => Boolean(pkg.scripts?.build)).map((pkg) => `${pkg.name}#build`)
)
return {
$schema: 'https://turbo.build/schema.json',
globalDependencies: ['**/.dev.vars'],
globalEnv: ['CI', 'GITHUB_ACTIONS', 'VITEST'],
globalPassThroughEnv: [
'WRANGLER_LOG',
'FORCE_COLOR',
'TURBO_TOKEN',
'TURBO_REMOTE_CACHE_SIGNATURE_KEY',
],
remoteCache: {
enabled: true,
signature: true,
},
ui: 'stream',
tasks: {
topo: {
dependsOn: ['^topo'],
},
build: {
dependsOn: ['^build', 'topo'],
outputs: ['dist/**', '.wrangler/deploy/config.json'],
outputLogs: 'new-only',
},
dev: {
cache: false,
dependsOn: ['build', 'topo'],
interactive: true,
persistent: true,
outputLogs: 'new-only',
},
// preview is used in Vite applications
preview: {
cache: false,
dependsOn: ['build', 'topo'],
interactive: true,
persistent: true,
outputLogs: 'new-only',
},
deploy: {
cache: false,
dependsOn: ['build', 'topo'],
env: ['CLOUDFLARE_ACCOUNT_ID', 'CLOUDFLARE_API_TOKEN'],
outputLogs: 'new-only',
},
// build:wrangler isn't used much, but can be useful for debugging
'build:wrangler': {
dependsOn: ['build', 'topo'],
outputLogs: 'new-only',
},
check: {
dependsOn: ['check:types', 'check:lint', 'topo'],
outputLogs: 'new-only',
},
'//#test:ci': {
dependsOn: buildPackages,
outputLogs: 'new-only',
},
'test:ci': {
dependsOn: ['build', 'topo'],
outputLogs: 'new-only',
},
'//#check:turbo-config': {
outputLogs: 'new-only',
},
'check:ci': {
dependsOn: [
'//#check:format',
'//#check:deps',
'check:types',
'check:exports',
'//#check:turbo-config',
'//#check:lint:all',
'//#test:ci',
'test:ci',
'topo',
],
outputLogs: 'new-only',
},
'//#check:deps': {
outputLogs: 'new-only',
},
'check:types': {
dependsOn: ['build', 'topo'],
outputLogs: 'new-only',
},
'check:exports': {
dependsOn: ['^check:exports', 'check:types', 'topo'],
outputLogs: 'new-only',
},
'check:lint': {
dependsOn: ['build', 'topo'],
outputLogs: 'new-only',
env: ['FIX_ESLINT'],
},
'//#check:lint:all': {
dependsOn: buildPackages,
outputLogs: 'new-only',
outputs: ['node_modules/.cache/.eslintcache'],
env: ['FIX_ESLINT'],
},
'//#check:format': {
dependsOn: [],
outputLogs: 'new-only',
},
'fix:workers-types': {
dependsOn: ['topo'],
outputs: ['worker-configuration.d.ts'],
outputLogs: 'new-only',
},
'//#build': {
dependsOn: ['^build'],
outputLogs: 'new-only',
},
},
}
})