-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy pathdeployctl.ts
99 lines (97 loc) · 2.45 KB
/
deployctl.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
import { filepaths } from "@fig/autocomplete-generators";
type VersionsJSON = {
latest: string;
versions: string[];
};
const completionSpec: Fig.Spec = {
name: "deployctl",
description: "Command line tool for Deno Deploy",
subcommands: [
{
name: "deploy",
description: "Deploy a script with static files to Deno Deploy",
args: {
name: "entrypoint",
generators: filepaths({
extensions: ["js", "mjs", "jsx", "mjsx", "ts", "mts", "tsx", "mtsx"],
}),
},
options: [
{
name: "--exclude",
insertValue: "--exclude '{cursor}'",
description: "Exclude files that match this pattern",
args: {
name: "pattern",
},
},
{
name: "--include",
insertValue: "--include '{cursor}'",
description: "Only upload files that match this pattern",
args: {
name: "pattern",
},
},
{
name: "--no-static",
description: "Don't include the files in the CWD as static files",
},
{
name: "--prod",
description:
"Create a production deployment (default is preview deployment)",
},
{
name: ["-p", "--project"],
description: "The project to deploy to",
args: {
name: "name",
},
},
{
name: "--token",
description: "The API token to use",
args: {
name: "token",
},
},
],
},
{
name: "upgrade",
description: "Upgrade deployctl",
args: {
name: "version",
isOptional: true,
generators: {
script: [
"curl",
"-sL",
"https://cdn.deno.land/deploy/meta/versions.json",
],
cache: { ttl: 1000 * 60 * 60 * 24 }, // 24 hours, in milliseconds
postProcess: (out) => {
const data = JSON.parse(out) as VersionsJSON;
return data.versions.map((version) => ({
name: version,
icon: version === data.latest ? "⭐️" : "🦕",
}));
},
},
},
},
],
options: [
{
name: ["--help", "-h"],
description: "Show help",
isPersistent: true,
},
{
name: ["-V", "--version"],
description: "Show the version",
},
],
};
export default completionSpec;