-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy pathturbo.ts
298 lines (289 loc) · 10.8 KB
/
turbo.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
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
import { gitGenerators } from "./git";
const turboIcon =
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAjlSURBVHgBdVd7cFTlFT/fvXffu8lCsoFASdKWx4xaCX1AlVJhLGMlyKNPSamN1SLEPvAPm2BhCLaFYOmobVF0psJggT+0DqIC/QMBsVXbmYKVqSgW8pDmHXaz79378He+u7vZG/ALd+/lnu+8fufxnSvoOutkx9lw0oi2jEXTt6UT2ca8aTToeYNM/FmgW/wjxu+CmeSzIEW+EuRSFVIUcS4Y8nX5Krwvr95++77r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obgzt4HA17yVbi7teBk76lwdWhldDghZ3+eeBX0RzePY3IiEuMfIWRPxJYwSxAXB/LiIGraOwofLMUGp8rpmJUjUBTQ3BSOBMkb9B3WtErfvqr68NZY31hYHzVI6NyWFUwtPB3B24KnFgNRmoy14vjJsFvFuY8kYsIGCobYMxRPxhjPFSjnEV11oZX7aXJdZdct2xfuU+Y9NC8amBa4d+rMCE0K+GWMgqjTAODy84X4+WC5D0p9LEDYdykMsHsRgOI7zP9FmvALzeIrAFoAycdy8G1Ak4IBqoWuymmhbeMIYr3d/vcnBt8b+EX/R8M0lkxT1rA/SozCB4n8K3wQ2bOfVYqBKHwXloeldMTL6lIkAhVBH02dWU1TvhDZtqBzUYfDAF7vtJ/uGP0wtnXofyMYLPibMC8HSKMwHdvRLfs6tCYIEGUfJtjM3RUJaHlcmghW+Kjm81UUmVP15Jc7F2505lDZOvvoWy3xj1NbYz2xhvhQgjLJHOmYlgyzpLhgSsmGwok5/iSzH4msuRAOn5tC1QEKN4SjwYjv3nm/ufXwBJuvv85ueaslO5ZdmU3pjWbeaDANy+n9dVZRmBxyNBw2mtLl9mvnPGHv6XClZ99nkW8TeT4B9zHkJ/LQsiMAAAAASUVORK5CYII=";
interface TurboJSON {
$schema?: "https://turborepo.org/schema.json";
baseBranch?: string;
globalDependencies?: string[];
pipeline: {
[name: string]: {
cache?: boolean;
dependsOn?: string[];
outputs?: string[];
};
};
}
const completionSpec: Fig.Spec = {
name: "turbo",
description:
"Turborepo is a high-performance build system for JavaScript and TypeScript codebases",
options: [
{
name: "--version",
description: "Print the version",
},
{
name: "--help",
description: "Print a help message",
isPersistent: true,
},
],
subcommands: [
{
name: "bin",
description: "Get the path to the turbo binary",
},
{
name: "link",
description:
"Link your local directory to a Vercel organization and enable remote caching",
options: [
{
name: "--no-gitignore",
description: "Do not create or modify .gitignore",
},
],
},
{
name: "login",
description: "Login to your Vercel account",
options: [
{
name: "--sso-team",
description:
"Attempt to authenticate to the specified team using SSO",
requiresSeparator: true,
},
],
},
{
name: "logout",
description: "Logout of your Vercel account",
},
{
name: "prune",
description: "Prepare a subset of your monorepo",
options: [
{
name: "--scope",
description:
"Specify package to act as entry point for pruned monorepo",
requiresSeparator: true,
isRequired: true,
args: {
name: "package",
},
},
{
name: "--docker",
description:
"Output pruned workspace into 'fill' and 'json' directories optimized for Docker layer caching",
},
],
},
{
name: "unlink",
description:
"Unlink the current directory from your Vercel organization and disable remote caching",
},
{
name: "run",
description: "Run tasks in your monorepo",
icon: turboIcon,
args: {
name: "tasks",
isVariadic: true,
generators: {
script: [
"bash",
"-c",
"until [[ ( -f turbo.json || $PWD = '/' ) ]]; do cd ..; done; cat turbo.json",
],
postProcess: (out) => {
let turbo: TurboJSON;
try {
turbo = JSON.parse(out);
} catch (err: unknown) {
console.error(err);
return [];
}
return Object.entries(turbo.pipeline).map(([key, value]) => {
const descriptionParts = [];
if ("dependsOn" in value) {
descriptionParts.push(
`depends on ${value.dependsOn
.map((item) => `'${item}'`)
.join(", ")}`
);
}
if ("outputs" in value) {
descriptionParts.push(
`outputs ${value.outputs
.map((item) => `'${item}'`)
.join(", ")}`
);
}
return {
name: key,
description:
descriptionParts.length > 0
? "Task: " + descriptionParts.join(", ")
: "Task",
icon: turboIcon,
};
});
},
},
},
options: [
{
name: "--scope",
description:
"Specify packages to act as entry points for task execution",
requiresSeparator: true,
args: {
name: "package",
},
},
{
name: "--cache-dir",
requiresSeparator: true,
description: "Specify local filesystem cache directory",
args: {
name: "dir",
template: "folders",
},
},
{
name: "--concurrency",
description:
"Limit the concurrency of task execution (use `1` for serial)",
requiresSeparator: true,
args: {
name: "limit",
},
},
{
name: "--continue",
description: "Continue execution even if a task exits with an error",
},
{
name: "--force",
description: "Ignore the existing cache",
},
{
name: "--graph",
description: "Generate a Dot graph of the task execution",
},
{
name: "--global-deps",
description:
"Specify glob of global filesystem dependencies to be hashed (useful for .env and files in the root directory)",
isRepeatable: true,
insertValue: "--global-deps='{cursor}'",
requiresSeparator: true,
args: {
name: "glob",
},
},
{
name: "--since",
description: "Limit/set scope to changed packages since a mergebase",
requiresSeparator: true,
args: {
name: "branch",
generators: gitGenerators.remoteLocalBranches,
},
},
{
name: "--team",
requiresSeparator: true,
description: "The slug of a turborepo.com team",
args: {
name: "slug",
},
},
{
name: "--token",
requiresSeparator: true,
description: "A turborepo.com access token",
args: {
name: "token",
},
},
{
name: "--ignore",
requiresSeparator: true,
description:
"Files to ignore when calculating changed files (supports globs)",
args: {
name: "files",
},
},
{
name: "--profile",
requiresSeparator: true,
description: "File to write turbo's performance profile into",
args: {
name: "file",
template: "filepaths",
},
},
{
name: "--parallel",
description: "Execute all tasks in parallel",
},
{
name: "--include-dependencies",
description: "Include the dependencies of tasks in execution",
},
{
name: "--no-deps",
description: "Exclude dependent task consumers from execution",
},
{
name: "--no-cache",
description:
"Avoid saving task results to the cache (useful for development/watch tasks)",
},
{
name: "--output-logs",
requiresSeparator: true,
args: {
name: "level",
suggestions: [
{
name: "new-only",
description: "Only new output with hashes for cached tasks",
},
{
name: "hash-only",
description: "Only turbo-computed task hashes",
},
{
name: "full",
description: "Show all output",
},
{
name: "none",
description: "Hide process output",
},
],
},
},
{
name: ["--dry", "--dry-run"],
requiresSeparator: true,
description:
"List the packages in scope and the tasks that would be run",
args: {
name: "format",
suggestions: ["json"],
isOptional: true,
},
},
],
},
],
};
export default completionSpec;