@swipt/cli 0.1.0-nightly.83 → 0.1.0-nightly.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/swipt.js +9 -0
- package/dist/bin/swipt.js.map +1 -0
- package/dist/cli/cli.js +184 -0
- package/dist/cli/cli.js.map +1 -0
- package/dist/cli/command.js +5 -0
- package/dist/cli/command.js.map +1 -0
- package/dist/cli/commands/data/clear.js +27 -0
- package/dist/cli/commands/data/clear.js.map +1 -0
- package/dist/cli/commands/data/data.js +22 -0
- package/dist/cli/commands/data/data.js.map +1 -0
- package/dist/cli/commands/data/index.js +1 -0
- package/dist/cli/commands/data/list.js +37 -0
- package/dist/cli/commands/data/list.js.map +1 -0
- package/dist/cli/commands/data/operand.js +5 -0
- package/dist/cli/commands/data/operand.js.map +1 -0
- package/dist/cli/commands/data/read.js +122 -0
- package/dist/cli/commands/data/read.js.map +1 -0
- package/dist/cli/commands/data/remove.js +30 -0
- package/dist/cli/commands/data/remove.js.map +1 -0
- package/dist/cli/commands/data/write.js +37 -0
- package/dist/cli/commands/data/write.js.map +1 -0
- package/dist/cli/commands/device/add.js +14 -0
- package/dist/cli/commands/device/add.js.map +1 -0
- package/dist/cli/commands/device/device.js +22 -0
- package/dist/cli/commands/device/device.js.map +1 -0
- package/dist/cli/commands/device/index.js +1 -0
- package/dist/cli/commands/device/list.js +13 -0
- package/dist/cli/commands/device/list.js.map +1 -0
- package/dist/cli/commands/device/logs.js +104 -0
- package/dist/cli/commands/device/logs.js.map +1 -0
- package/dist/cli/commands/device/remove.js +14 -0
- package/dist/cli/commands/device/remove.js.map +1 -0
- package/dist/cli/commands/device/stop.js +19 -0
- package/dist/cli/commands/device/stop.js.map +1 -0
- package/dist/cli/commands/flags.js +57 -0
- package/dist/cli/commands/flags.js.map +1 -0
- package/dist/cli/commands/index.js +30 -0
- package/dist/cli/commands/index.js.map +1 -0
- package/dist/cli/commands/project/build.js +18 -0
- package/dist/cli/commands/project/build.js.map +1 -0
- package/dist/cli/commands/project/create.js +109 -0
- package/dist/cli/commands/project/create.js.map +1 -0
- package/dist/cli/commands/project/deploy.js +23 -0
- package/dist/cli/commands/project/deploy.js.map +1 -0
- package/dist/cli/commands/project/develop.js +146 -0
- package/dist/cli/commands/project/develop.js.map +1 -0
- package/dist/cli/commands/project/index.js +1 -0
- package/dist/cli/commands/project/project.js +22 -0
- package/dist/cli/commands/project/project.js.map +1 -0
- package/dist/cli/commands/project/source.js +126 -0
- package/dist/cli/commands/project/source.js.map +1 -0
- package/dist/cli/commands/repl/api.js +16 -0
- package/dist/cli/commands/repl/api.js.map +1 -0
- package/dist/cli/commands/repl/index.js +1 -0
- package/dist/cli/commands/repl/repl.js +29 -0
- package/dist/cli/commands/repl/repl.js.map +1 -0
- package/dist/cli/commands/repl/reset.js +14 -0
- package/dist/cli/commands/repl/reset.js.map +1 -0
- package/dist/cli/commands/repl/run.js +108 -0
- package/dist/cli/commands/repl/run.js.map +1 -0
- package/dist/cli/commands/sideload/index.js +1 -0
- package/dist/cli/commands/sideload/install.js +19 -0
- package/dist/cli/commands/sideload/install.js.map +1 -0
- package/dist/cli/commands/sideload/setup.js +18 -0
- package/dist/cli/commands/sideload/setup.js.map +1 -0
- package/dist/cli/commands/sideload/sideload.js +22 -0
- package/dist/cli/commands/sideload/sideload.js.map +1 -0
- package/dist/cli/commands/sideload/uninstall.js +13 -0
- package/dist/cli/commands/sideload/uninstall.js.map +1 -0
- package/dist/cli/commands/sideload/update.js +19 -0
- package/dist/cli/commands/sideload/update.js.map +1 -0
- package/dist/cli/commands/swiplet/call.js +57 -0
- package/dist/cli/commands/swiplet/call.js.map +1 -0
- package/dist/cli/commands/swiplet/index.js +1 -0
- package/dist/cli/commands/swiplet/install.js +21 -0
- package/dist/cli/commands/swiplet/install.js.map +1 -0
- package/dist/cli/commands/swiplet/list.js +42 -0
- package/dist/cli/commands/swiplet/list.js.map +1 -0
- package/dist/cli/commands/swiplet/remove.js +18 -0
- package/dist/cli/commands/swiplet/remove.js.map +1 -0
- package/dist/cli/commands/swiplet/service/disable.js +18 -0
- package/dist/cli/commands/swiplet/service/disable.js.map +1 -0
- package/dist/cli/commands/swiplet/service/enable.js +18 -0
- package/dist/cli/commands/swiplet/service/enable.js.map +1 -0
- package/dist/cli/commands/swiplet/service/index.js +1 -0
- package/dist/cli/commands/swiplet/service/service.js +18 -0
- package/dist/cli/commands/swiplet/service/service.js.map +1 -0
- package/dist/cli/commands/swiplet/service/services.js +21 -0
- package/dist/cli/commands/swiplet/service/services.js.map +1 -0
- package/dist/cli/commands/swiplet/service/watch.js +16 -0
- package/dist/cli/commands/swiplet/service/watch.js.map +1 -0
- package/dist/cli/commands/swiplet/show.js +38 -0
- package/dist/cli/commands/swiplet/show.js.map +1 -0
- package/dist/cli/commands/swiplet/swiplet.js +42 -0
- package/dist/cli/commands/swiplet/swiplet.js.map +1 -0
- package/dist/cli/commands/version/index.js +1 -0
- package/dist/cli/commands/version/version.js +17 -0
- package/dist/cli/commands/version/version.js.map +1 -0
- package/dist/cli/deploy.js +20 -0
- package/dist/cli/deploy.js.map +1 -0
- package/dist/cli/io.js +7 -0
- package/dist/cli/io.js.map +1 -0
- package/dist/cli/session.js +6 -0
- package/dist/cli/session.js.map +1 -0
- package/dist/metro.js +1 -1
- package/dist/project.d.ts +2 -3
- package/dist/project.js +2 -203
- package/dist/project.js.map +1 -1
- package/package.json +5 -5
- package/dist/device.d.ts +0 -130
- package/dist/device.js +0 -539
- package/dist/device.js.map +0 -1
- package/dist/swipt.js +0 -631
- package/dist/swipt.js.map +0 -1
- /package/dist/{swipt.d.ts → bin/swipt.d.ts} +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { list as list$1 } from "../../../connection.js";
|
|
2
|
+
import { tr } from "../../../i18n.js";
|
|
3
|
+
import { defineCommand } from "../../command.js";
|
|
4
|
+
// src/cli/commands/device/list.ts
|
|
5
|
+
const list = defineCommand({
|
|
6
|
+
name: "list",
|
|
7
|
+
short: tr("List the devices, adding the ones found on the local network"),
|
|
8
|
+
args: [0, 0],
|
|
9
|
+
run: list$1
|
|
10
|
+
});
|
|
11
|
+
export { list };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","names":["connection.list"],"sources":["../../../../src/cli/commands/device/list.ts"],"sourcesContent":["import * as connection from \"../../../connection\";\nimport { tr } from \"../../../i18n\";\nimport { defineCommand } from \"../../command\";\n\nexport const list = defineCommand({\n name: \"list\",\n short: tr(\"List the devices, adding the ones found on the local network\"),\n args: [0, 0],\n run: connection.list,\n});\n"],"mappings":";;;;AAIA,MAAa,OAAO,cAAc;CAChC,MAAM;CACN,OAAO,GAAG,8DAA8D;CACxE,MAAM,CAAC,GAAG,CAAC;CACX,KAAKA;AACP,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { UsageError } from "../../../client.js";
|
|
2
|
+
import { tr } from "../../../i18n.js";
|
|
3
|
+
import { printLog } from "../../../output.js";
|
|
4
|
+
import { defineCommand } from "../../command.js";
|
|
5
|
+
import { session } from "../../session.js";
|
|
6
|
+
import { deviceOption } from "../flags.js";
|
|
7
|
+
import { timestampFromMs } from "@bufbuild/protobuf/wkt";
|
|
8
|
+
// src/cli/commands/device/logs.ts
|
|
9
|
+
const durationUnits = {
|
|
10
|
+
ns: 1e-6,
|
|
11
|
+
us: .001,
|
|
12
|
+
µs: .001,
|
|
13
|
+
ms: 1,
|
|
14
|
+
s: 1e3,
|
|
15
|
+
m: 6e4,
|
|
16
|
+
h: 36e5
|
|
17
|
+
};
|
|
18
|
+
function parseDuration(text, option) {
|
|
19
|
+
if (text === void 0) return 0;
|
|
20
|
+
if (/^-?\d+$/.test(text) && Number(text) === 0) return 0;
|
|
21
|
+
let total = 0;
|
|
22
|
+
let rest = text;
|
|
23
|
+
while (rest !== "") {
|
|
24
|
+
const match = /^(\d+(?:\.\d*)?|\.\d+)(ns|us|µs|ms|s|m|h)/.exec(rest);
|
|
25
|
+
if (!match) throw new UsageError(tr("invalid argument {value} for {option}: it is a duration such as 30s or 1m30s", {
|
|
26
|
+
value: JSON.stringify(text),
|
|
27
|
+
option
|
|
28
|
+
}));
|
|
29
|
+
total += Number(match[1]) * durationUnits[match[2]];
|
|
30
|
+
rest = rest.slice(match[0].length);
|
|
31
|
+
}
|
|
32
|
+
return total;
|
|
33
|
+
}
|
|
34
|
+
function parseCount(text, option) {
|
|
35
|
+
if (text === void 0) return;
|
|
36
|
+
if (!/^\d+$/.test(text) || Number(text) > 4294967295) throw new UsageError(tr("invalid argument {value} for {option}: it is a number", {
|
|
37
|
+
value: JSON.stringify(text),
|
|
38
|
+
option
|
|
39
|
+
}));
|
|
40
|
+
return Number(text);
|
|
41
|
+
}
|
|
42
|
+
const readLogs = (context) => session(context, async (client) => {
|
|
43
|
+
const { options } = context;
|
|
44
|
+
const index = [
|
|
45
|
+
"error",
|
|
46
|
+
"warn",
|
|
47
|
+
"info",
|
|
48
|
+
"debug"
|
|
49
|
+
].indexOf(options.level);
|
|
50
|
+
if (index < 0) throw new UsageError(tr("--level is error, warn, info or debug"));
|
|
51
|
+
const request = {
|
|
52
|
+
follow: options.follow,
|
|
53
|
+
tail: options.tail ?? 100,
|
|
54
|
+
swipletId: options.swiplet ?? "",
|
|
55
|
+
level: index + 1
|
|
56
|
+
};
|
|
57
|
+
if (options.since > 0) {
|
|
58
|
+
request.since = timestampFromMs(Date.now() - options.since);
|
|
59
|
+
if (options.tail === void 0) request.tail = 4294967295;
|
|
60
|
+
}
|
|
61
|
+
for await (const response of client.logs.readLogs(request, { signal: context.signal })) printLog(response.entry, true);
|
|
62
|
+
});
|
|
63
|
+
const logs = defineCommand({
|
|
64
|
+
name: "logs",
|
|
65
|
+
short: tr("Print the logs"),
|
|
66
|
+
args: [0, 0],
|
|
67
|
+
options: {
|
|
68
|
+
...deviceOption,
|
|
69
|
+
follow: {
|
|
70
|
+
type: "boolean",
|
|
71
|
+
help: tr("follow new entries")
|
|
72
|
+
},
|
|
73
|
+
tail: {
|
|
74
|
+
type: "string",
|
|
75
|
+
value: "COUNT",
|
|
76
|
+
help: tr("number of past entries (default 100)")
|
|
77
|
+
},
|
|
78
|
+
since: {
|
|
79
|
+
type: "string",
|
|
80
|
+
value: "DURATION",
|
|
81
|
+
help: tr("maximum age")
|
|
82
|
+
},
|
|
83
|
+
level: {
|
|
84
|
+
type: "string",
|
|
85
|
+
value: "LEVEL",
|
|
86
|
+
help: tr("minimum level (default info)")
|
|
87
|
+
},
|
|
88
|
+
swiplet: {
|
|
89
|
+
type: "string",
|
|
90
|
+
value: "ID",
|
|
91
|
+
help: tr("swiplet ID")
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
parse: (options) => ({
|
|
95
|
+
...options,
|
|
96
|
+
tail: parseCount(options.tail, "--tail"),
|
|
97
|
+
since: parseDuration(options.since, "--since"),
|
|
98
|
+
level: options.level ?? "info"
|
|
99
|
+
}),
|
|
100
|
+
run: readLogs
|
|
101
|
+
});
|
|
102
|
+
export { logs };
|
|
103
|
+
|
|
104
|
+
//# sourceMappingURL=logs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logs.js","names":[],"sources":["../../../../src/cli/commands/device/logs.ts"],"sourcesContent":["import { timestampFromMs } from \"@bufbuild/protobuf/wkt\";\n\nimport { UsageError } from \"../../../client\";\nimport { tr } from \"../../../i18n\";\nimport { printLog } from \"../../../output\";\nimport { defineCommand } from \"../../command\";\nimport { session } from \"../../session\";\nimport { deviceOption } from \"../flags\";\n\nconst durationUnits = {\n ns: 1e-6,\n us: 1e-3,\n µs: 1e-3,\n ms: 1,\n s: 1000,\n m: 60_000,\n h: 3_600_000,\n};\n\nfunction parseDuration(text, option) {\n if (text === undefined) {\n return 0;\n }\n if (/^-?\\d+$/.test(text) && Number(text) === 0) {\n return 0;\n }\n let total = 0;\n let rest = text;\n while (rest !== \"\") {\n const match = /^(\\d+(?:\\.\\d*)?|\\.\\d+)(ns|us|µs|ms|s|m|h)/.exec(rest);\n if (!match) {\n throw new UsageError(\n tr(\n \"invalid argument {value} for {option}: it is a duration such as 30s or 1m30s\",\n { value: JSON.stringify(text), option },\n ),\n );\n }\n total += Number(match[1]) * durationUnits[match[2]];\n rest = rest.slice(match[0].length);\n }\n return total;\n}\n\nfunction parseCount(text, option) {\n if (text === undefined) {\n return undefined;\n }\n if (!/^\\d+$/.test(text) || Number(text) > 0xffffffff) {\n throw new UsageError(\n tr(\"invalid argument {value} for {option}: it is a number\", {\n value: JSON.stringify(text),\n option,\n }),\n );\n }\n return Number(text);\n}\n\nconst readLogs = (context) =>\n session(context, async (client) => {\n const { options } = context;\n const levels = [\"error\", \"warn\", \"info\", \"debug\"];\n const index = levels.indexOf(options.level);\n if (index < 0) {\n throw new UsageError(tr(\"--level is error, warn, info or debug\"));\n }\n const request: Record<string, any> = {\n follow: options.follow,\n tail: options.tail ?? 100,\n swipletId: options.swiplet ?? \"\",\n level: index + 1,\n };\n if (options.since > 0) {\n request.since = timestampFromMs(Date.now() - options.since);\n if (options.tail === undefined) {\n request.tail = 0xffffffff;\n }\n }\n for await (const response of client.logs.readLogs(request, {\n signal: context.signal,\n })) {\n printLog(response.entry, true);\n }\n });\n\nexport const logs = defineCommand({\n name: \"logs\",\n short: tr(\"Print the logs\"),\n args: [0, 0],\n options: {\n ...deviceOption,\n follow: { type: \"boolean\", help: tr(\"follow new entries\") },\n tail: {\n type: \"string\",\n value: \"COUNT\",\n help: tr(\"number of past entries (default 100)\"),\n },\n since: { type: \"string\", value: \"DURATION\", help: tr(\"maximum age\") },\n level: {\n type: \"string\",\n value: \"LEVEL\",\n help: tr(\"minimum level (default info)\"),\n },\n swiplet: { type: \"string\", value: \"ID\", help: tr(\"swiplet ID\") },\n },\n parse: (options) => ({\n ...options,\n tail: parseCount(options.tail, \"--tail\"),\n since: parseDuration(options.since, \"--since\"),\n level: options.level ?? \"info\",\n }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AgB,KAAK,IAAI,IAAI,QAAQ,KAAK;EAC1D,IAAI,QAAQ,SAAS,KAAA,GACnB,QAAQ,OAAO;CAEnB;CACA,WAAW,MAAM,YAAY,OAAO,KAAK,SAAS,SAAS,EACzD,QAAQ,QAAQ,OAClB,CAAC,GACC,SAAS,SAAS,OAAO,IAAI;AAEjC,CAAC;AAEH,MAAa,OAAO,cAAc;CAChC,MAAM;CACN,OAAO,GAAG,gBAAgB;CAC1B,MAAM,CAAC,GAAG,CAAC;CACX,SAAS;EACP,GAAG;EACH,QAAQ;GAAE,MAAM;GAAW,MAAM,GAAG,oBAAoB;EAAE;EAC1D,MAAM;GACJ,MAAM;GACN,OAAO;GACP,MAAM,GAAG,sCAAsC;EACjD;EACA,OAAO;GAAE,MAAM;GAAU,OAAO;GAAY,MAAM,GAAG,aAAa;EAAE;EACpE,OAAO;GACL,MAAM;GACN,OAAO;GACP,MAAM,GAAG,8BAA8B;EACzC;EACA,SAAS;GAAE,MAAM;GAAU,OAAO;GAAM,MAAM,GAAG,YAAY;EAAE;CACjE;CACA,QAAQ,aAAa;EACnB,GAAG;EACH,MAAM,WAAW,QAAQ,MAAM,QAAQ;EACvC,OAAO,cAAc,QAAQ,OAAO,SAAS;EAC7C,OAAO,QAAQ,SAAS;CAC1B;CACA,KAAK;AACP,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { remove as remove$1 } from "../../../connection.js";
|
|
2
|
+
import { tr } from "../../../i18n.js";
|
|
3
|
+
import { defineCommand } from "../../command.js";
|
|
4
|
+
// src/cli/commands/device/remove.ts
|
|
5
|
+
const remove = defineCommand({
|
|
6
|
+
name: "remove",
|
|
7
|
+
use: "remove NAME",
|
|
8
|
+
short: tr("Forget a device"),
|
|
9
|
+
args: [1, 1],
|
|
10
|
+
run: remove$1
|
|
11
|
+
});
|
|
12
|
+
export { remove };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=remove.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.js","names":["connection.remove"],"sources":["../../../../src/cli/commands/device/remove.ts"],"sourcesContent":["import * as connection from \"../../../connection\";\nimport { tr } from \"../../../i18n\";\nimport { defineCommand } from \"../../command\";\n\nexport const remove = defineCommand({\n name: \"remove\",\n use: \"remove NAME\",\n short: tr(\"Forget a device\"),\n args: [1, 1],\n run: connection.remove,\n});\n"],"mappings":";;;;AAIA,MAAa,SAAS,cAAc;CAClC,MAAM;CACN,KAAK;CACL,OAAO,GAAG,iBAAiB;CAC3B,MAAM,CAAC,GAAG,CAAC;CACX,KAAKA;AACP,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { tr } from "../../../i18n.js";
|
|
2
|
+
import { defineCommand } from "../../command.js";
|
|
3
|
+
import { session } from "../../session.js";
|
|
4
|
+
import { deviceOption } from "../flags.js";
|
|
5
|
+
// src/cli/commands/device/stop.ts
|
|
6
|
+
const stopServer = (context) => session(context, async (client) => {
|
|
7
|
+
await client.system.shutdown({}, { signal: context.signal });
|
|
8
|
+
console.log(tr("stopped"));
|
|
9
|
+
});
|
|
10
|
+
const stop = defineCommand({
|
|
11
|
+
name: "stop",
|
|
12
|
+
short: tr("Stop the Swipt server"),
|
|
13
|
+
args: [0, 0],
|
|
14
|
+
options: deviceOption,
|
|
15
|
+
run: stopServer
|
|
16
|
+
});
|
|
17
|
+
export { stop };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=stop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stop.js","names":[],"sources":["../../../../src/cli/commands/device/stop.ts"],"sourcesContent":["import { tr } from \"../../../i18n\";\nimport { defineCommand } from \"../../command\";\nimport { session } from \"../../session\";\nimport { deviceOption } from \"../flags\";\n\nconst stopServer = (context) =>\n session(context, async (client) => {\n await client.system.shutdown({}, { signal: context.signal });\n console.log(tr(\"stopped\"));\n });\n\nexport const stop = defineCommand({\n name: \"stop\",\n short: tr(\"Stop the Swipt server\"),\n args: [0, 0],\n options: deviceOption,\n run: stopServer,\n});\n"],"mappings":";;;;;AAKA,MAAM,cAAc,YAClB,QAAQ,SAAS,OAAO,WAAW;CACjC,MAAM,OAAO,OAAO,SAAS,CAAC,GAAG,EAAE,QAAQ,QAAQ,OAAO,CAAC;CAC3D,QAAQ,IAAI,GAAG,SAAS,CAAC;AAC3B,CAAC;AAEH,MAAa,OAAO,cAAc;CAChC,MAAM;CACN,OAAO,GAAG,uBAAuB;CACjC,MAAM,CAAC,GAAG,CAAC;CACX,SAAS;CACT,KAAK;AACP,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { tr } from "../../i18n.js";
|
|
2
|
+
// src/cli/commands/flags.ts
|
|
3
|
+
const deviceOption = { device: {
|
|
4
|
+
type: "string",
|
|
5
|
+
short: "d",
|
|
6
|
+
value: "NAME|URL",
|
|
7
|
+
help: tr("the device to use")
|
|
8
|
+
} };
|
|
9
|
+
const sideloadOptions = {
|
|
10
|
+
device: {
|
|
11
|
+
type: "string",
|
|
12
|
+
short: "d",
|
|
13
|
+
value: "NAME|UDID",
|
|
14
|
+
help: tr("the device to use")
|
|
15
|
+
},
|
|
16
|
+
team: {
|
|
17
|
+
type: "string",
|
|
18
|
+
value: "ID",
|
|
19
|
+
help: tr("team ID, required if more than one")
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const passcodeOptions = (help) => ({
|
|
23
|
+
passcode: {
|
|
24
|
+
type: "string",
|
|
25
|
+
value: "CODE",
|
|
26
|
+
help
|
|
27
|
+
},
|
|
28
|
+
"passcode-type": {
|
|
29
|
+
type: "string",
|
|
30
|
+
value: "TYPE",
|
|
31
|
+
help: tr("pin (4 or 6 digits, default), numeric or alphanumeric")
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const nightlyOption = { nightly: {
|
|
35
|
+
type: "boolean",
|
|
36
|
+
help: tr("use nightly build")
|
|
37
|
+
} };
|
|
38
|
+
const setupStepOptions = {
|
|
39
|
+
"no-setup-pair": {
|
|
40
|
+
type: "boolean",
|
|
41
|
+
help: tr("do not pair Swipt")
|
|
42
|
+
},
|
|
43
|
+
"no-setup-api": {
|
|
44
|
+
type: "boolean",
|
|
45
|
+
help: tr("do not publish the API to the local network")
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const setupOptions = {
|
|
49
|
+
"no-setup": {
|
|
50
|
+
type: "boolean",
|
|
51
|
+
help: tr("do not pair Swipt, trust its developer or publish its API")
|
|
52
|
+
},
|
|
53
|
+
...setupStepOptions
|
|
54
|
+
};
|
|
55
|
+
export { deviceOption, nightlyOption, passcodeOptions, setupOptions, setupStepOptions, sideloadOptions };
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=flags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flags.js","names":[],"sources":["../../../src/cli/commands/flags.ts"],"sourcesContent":["import { tr } from \"../../i18n\";\nimport type { Options } from \"../command\";\n\nexport const deviceOption: Options = {\n device: {\n type: \"string\",\n short: \"d\",\n value: \"NAME|URL\",\n help: tr(\"the device to use\"),\n },\n};\n\nexport const sideloadOptions: Options = {\n device: {\n type: \"string\",\n short: \"d\",\n value: \"NAME|UDID\",\n help: tr(\"the device to use\"),\n },\n team: {\n type: \"string\",\n value: \"ID\",\n help: tr(\"team ID, required if more than one\"),\n },\n};\n\nexport const passcodeOptions = (help): Options => ({\n passcode: { type: \"string\", value: \"CODE\", help },\n \"passcode-type\": {\n type: \"string\",\n value: \"TYPE\",\n help: tr(\"pin (4 or 6 digits, default), numeric or alphanumeric\"),\n },\n});\n\nexport const nightlyOption: Options = {\n nightly: { type: \"boolean\", help: tr(\"use nightly build\") },\n};\n\nexport const setupStepOptions: Options = {\n \"no-setup-pair\": { type: \"boolean\", help: tr(\"do not pair Swipt\") },\n \"no-setup-api\": {\n type: \"boolean\",\n help: tr(\"do not publish the API to the local network\"),\n },\n};\n\nexport const setupOptions: Options = {\n \"no-setup\": {\n type: \"boolean\",\n help: tr(\"do not pair Swipt, trust its developer or publish its API\"),\n },\n ...setupStepOptions,\n};\n"],"mappings":";;AAGA,MAAa,eAAwB,EACnC,QAAQ;CACN,MAAM;CACN,OAAO;CACP,OAAO;CACP,MAAM,GAAG,mBAAmB;AAC9B,EACF;AAEA,MAAa,kBAA2B;CACtC,QAAQ;EACN,MAAM;EACN,OAAO;EACP,OAAO;EACP,MAAM,GAAG,mBAAmB;CAC9B;CACA,MAAM;EACJ,MAAM;EACN,OAAO;EACP,MAAM,GAAG,oCAAoC;CAC/C;AACF;AAEA,MAAa,mBAAmB,UAAmB;CACjD,UAAU;EAAE,MAAM;EAAU,OAAO;EAAQ;CAAK;CAChD,iBAAiB;EACf,MAAM;EACN,OAAO;EACP,MAAM,GAAG,uDAAuD;CAClE;AACF;AAEA,MAAa,gBAAyB,EACpC,SAAS;CAAE,MAAM;CAAW,MAAM,GAAG,mBAAmB;AAAE,EAC5D;AAEA,MAAa,mBAA4B;CACvC,iBAAiB;EAAE,MAAM;EAAW,MAAM,GAAG,mBAAmB;CAAE;CAClE,gBAAgB;EACd,MAAM;EACN,MAAM,GAAG,6CAA6C;CACxD;AACF;AAEA,MAAa,eAAwB;CACnC,YAAY;EACV,MAAM;EACN,MAAM,GAAG,2DAA2D;CACtE;CACA,GAAG;AACL"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { tr } from "../../i18n.js";
|
|
2
|
+
import { defineCommand } from "../command.js";
|
|
3
|
+
import { device } from "./device/device.js";
|
|
4
|
+
import "./device/index.js";
|
|
5
|
+
import { project } from "./project/project.js";
|
|
6
|
+
import "./project/index.js";
|
|
7
|
+
import { repl } from "./repl/repl.js";
|
|
8
|
+
import "./repl/index.js";
|
|
9
|
+
import { sideload } from "./sideload/sideload.js";
|
|
10
|
+
import "./sideload/index.js";
|
|
11
|
+
import { swiplet } from "./swiplet/swiplet.js";
|
|
12
|
+
import "./swiplet/index.js";
|
|
13
|
+
import { version } from "./version/version.js";
|
|
14
|
+
import "./version/index.js";
|
|
15
|
+
// src/cli/commands/index.ts
|
|
16
|
+
const root = defineCommand({
|
|
17
|
+
name: "swipt",
|
|
18
|
+
short: tr("Swipt CLI"),
|
|
19
|
+
commands: [
|
|
20
|
+
project,
|
|
21
|
+
device,
|
|
22
|
+
swiplet,
|
|
23
|
+
repl,
|
|
24
|
+
sideload,
|
|
25
|
+
version
|
|
26
|
+
]
|
|
27
|
+
});
|
|
28
|
+
export { root };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/cli/commands/index.ts"],"sourcesContent":["import { tr } from \"../../i18n\";\nimport { defineCommand } from \"../command\";\nimport { device } from \"./device\";\nimport { project } from \"./project\";\nimport { repl } from \"./repl\";\nimport { sideload } from \"./sideload\";\nimport { swiplet } from \"./swiplet\";\nimport { version } from \"./version\";\n\nexport const root = defineCommand({\n name: \"swipt\",\n short: tr(\"Swipt CLI\"),\n commands: [project, device, swiplet, repl, sideload, version],\n});\n"],"mappings":";;;;;;;;;;;;;;;AASA,MAAa,OAAO,cAAc;CAChC,MAAM;CACN,OAAO,GAAG,WAAW;CACrB,UAAU;EAAC;EAAS;EAAQ;EAAS;EAAM;EAAU;CAAO;AAC9D,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { tr } from "../../../i18n.js";
|
|
2
|
+
import { buildProject } from "../../../project.js";
|
|
3
|
+
import { defineCommand } from "../../command.js";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
// src/cli/commands/project/build.ts
|
|
6
|
+
const build = defineCommand({
|
|
7
|
+
name: "build",
|
|
8
|
+
use: "build [PROJECT]",
|
|
9
|
+
short: tr("Bundle the project into dist/<swiplet.id>.swiplet"),
|
|
10
|
+
args: [0, 1],
|
|
11
|
+
run: async ({ args }) => {
|
|
12
|
+
const { archive } = await buildProject(path.resolve(args[0] ?? "."));
|
|
13
|
+
console.log(path.relative(process.cwd(), archive));
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
export { build };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","names":[],"sources":["../../../../src/cli/commands/project/build.ts"],"sourcesContent":["import path from \"node:path\";\n\nimport { tr } from \"../../../i18n\";\nimport { buildProject } from \"../../../project\";\nimport { defineCommand } from \"../../command\";\n\nexport const build = defineCommand({\n name: \"build\",\n use: \"build [PROJECT]\",\n short: tr(\"Bundle the project into dist/<swiplet.id>.swiplet\"),\n args: [0, 1],\n run: async ({ args }) => {\n const { archive } = await buildProject(path.resolve(args[0] ?? \".\"));\n console.log(path.relative(process.cwd(), archive));\n },\n});\n"],"mappings":";;;;;AAMA,MAAa,QAAQ,cAAc;CACjC,MAAM;CACN,KAAK;CACL,OAAO,GAAG,mDAAmD;CAC7D,MAAM,CAAC,GAAG,CAAC;CACX,KAAK,OAAO,EAAE,WAAW;EACvB,MAAM,EAAE,YAAY,MAAM,aAAa,KAAK,QAAQ,KAAK,MAAM,GAAG,CAAC;EACnE,QAAQ,IAAI,KAAK,SAAS,QAAQ,IAAI,GAAG,OAAO,CAAC;CACnD;AACF,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { tr } from "../../../i18n.js";
|
|
2
|
+
import { defineCommand } from "../../command.js";
|
|
3
|
+
import { createRequire } from "node:module";
|
|
4
|
+
import fs from "node:fs";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
// src/cli/commands/project/create.ts
|
|
7
|
+
const { version } = JSON.parse(fs.readFileSync(new URL("../../../../package.json", import.meta.url), "utf8"));
|
|
8
|
+
const { peerDependencies } = createRequire(import.meta.url)("@swipt/api/package.json");
|
|
9
|
+
const swiptRange = version.includes("-") ? version : `>=${version}-0 <=${version}`;
|
|
10
|
+
const idOf = (name) => name.toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^[._-]+/, "").slice(0, 128).replace(/[._-]+$/, "") || "swiplet";
|
|
11
|
+
const templates = {
|
|
12
|
+
"package.json": (name) => `${JSON.stringify({
|
|
13
|
+
name: idOf(name),
|
|
14
|
+
version: "0.1.0",
|
|
15
|
+
private: true,
|
|
16
|
+
swiplet: {
|
|
17
|
+
id: idOf(name),
|
|
18
|
+
name,
|
|
19
|
+
versionCode: 1,
|
|
20
|
+
icon: {
|
|
21
|
+
color: "blue",
|
|
22
|
+
symbol: "sparkles"
|
|
23
|
+
},
|
|
24
|
+
app: "./src/App.tsx",
|
|
25
|
+
extension: "./src/extension.ts"
|
|
26
|
+
},
|
|
27
|
+
scripts: {
|
|
28
|
+
build: "swipt project build",
|
|
29
|
+
check: "tsc"
|
|
30
|
+
},
|
|
31
|
+
dependencies: { zod: "^4.6.7" },
|
|
32
|
+
devDependencies: {
|
|
33
|
+
"@swipt/api": swiptRange,
|
|
34
|
+
"@swipt/cli": swiptRange,
|
|
35
|
+
typescript: "^7.0.2",
|
|
36
|
+
...Object.fromEntries([
|
|
37
|
+
"@expo/ui",
|
|
38
|
+
"@types/react",
|
|
39
|
+
"react"
|
|
40
|
+
].map((name) => [name, peerDependencies[name]]))
|
|
41
|
+
}
|
|
42
|
+
}, null, 2)}\n`,
|
|
43
|
+
"tsconfig.json": () => `${JSON.stringify({ compilerOptions: {
|
|
44
|
+
target: "ES2022",
|
|
45
|
+
module: "ESNext",
|
|
46
|
+
moduleResolution: "Bundler",
|
|
47
|
+
jsx: "react-jsx",
|
|
48
|
+
lib: ["ES2023", "DOM"],
|
|
49
|
+
strict: true,
|
|
50
|
+
noEmit: true,
|
|
51
|
+
skipLibCheck: true
|
|
52
|
+
} }, null, 2)}\n`,
|
|
53
|
+
".gitignore": () => "node_modules/\ndist/\n",
|
|
54
|
+
"src/extension.ts": () => `import * as device from "@swipt/api/device";
|
|
55
|
+
import { defineAction, defineExtension } from "@swipt/api/swiplet";
|
|
56
|
+
|
|
57
|
+
export default defineExtension({
|
|
58
|
+
actions: {
|
|
59
|
+
frontApp: defineAction({
|
|
60
|
+
title: "Find the App in Front",
|
|
61
|
+
run: (_, { signal }) => device.foregroundApplication.get({ signal }),
|
|
62
|
+
}),
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
`,
|
|
66
|
+
"src/App.tsx": () => `import { Button, Form, Host, Section, Text } from "@expo/ui/swift-ui";
|
|
67
|
+
import { useState } from "react";
|
|
68
|
+
import { actions } from "@swipt/api/swiplet";
|
|
69
|
+
|
|
70
|
+
import type extension from "./extension";
|
|
71
|
+
|
|
72
|
+
const { frontApp } = actions<typeof extension>();
|
|
73
|
+
|
|
74
|
+
export default function App() {
|
|
75
|
+
const [app, setApp] = useState("");
|
|
76
|
+
return (
|
|
77
|
+
<Host style={{ flex: 1 }}>
|
|
78
|
+
<Form>
|
|
79
|
+
<Section>
|
|
80
|
+
<Button label="Find the App in Front" onPress={async () => setApp(await frontApp())} />
|
|
81
|
+
{app === "" ? null : <Text>{app}</Text>}
|
|
82
|
+
</Section>
|
|
83
|
+
</Form>
|
|
84
|
+
</Host>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
`
|
|
88
|
+
};
|
|
89
|
+
const quote = (value) => /^[\w@%+=:,./-]+$/.test(value) ? value : `'${value.replaceAll("'", "'\\''")}'`;
|
|
90
|
+
function createCommand(directory) {
|
|
91
|
+
const root = path.resolve(directory);
|
|
92
|
+
if (fs.existsSync(root) && fs.readdirSync(root).length > 0) throw new Error(tr("{directory} is not empty", { directory }));
|
|
93
|
+
for (const [file, template] of Object.entries(templates)) {
|
|
94
|
+
fs.mkdirSync(path.dirname(path.join(root, file)), { recursive: true });
|
|
95
|
+
fs.writeFileSync(path.join(root, file), template(path.basename(root)));
|
|
96
|
+
}
|
|
97
|
+
const manager = process.env.npm_config_user_agent?.split("/")[0] ?? "npm";
|
|
98
|
+
console.log(`cd ${quote(directory)} && ${manager} install && ${manager} run build`);
|
|
99
|
+
}
|
|
100
|
+
const create = defineCommand({
|
|
101
|
+
name: "create",
|
|
102
|
+
use: "create DIRECTORY",
|
|
103
|
+
short: tr("Make a swiplet project in a new or empty directory"),
|
|
104
|
+
args: [1, 1],
|
|
105
|
+
run: ({ args }) => createCommand(args[0])
|
|
106
|
+
});
|
|
107
|
+
export { create };
|
|
108
|
+
|
|
109
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","names":[],"sources":["../../../../src/cli/commands/project/create.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\n\nimport { tr } from \"../../../i18n\";\nimport { defineCommand } from \"../../command\";\n\nconst { version } = JSON.parse(\n fs.readFileSync(new URL(\"../../../../package.json\", import.meta.url), \"utf8\"),\n);\nconst require = createRequire(import.meta.url);\nconst { peerDependencies } = require(\"@swipt/api/package.json\");\n\nconst swiptRange = version.includes(\"-\")\n ? version\n : `>=${version}-0 <=${version}`;\n\nconst idOf = (name) =>\n name\n .toLowerCase()\n .replace(/[^a-z0-9._-]+/g, \"-\")\n .replace(/^[._-]+/, \"\")\n .slice(0, 128)\n .replace(/[._-]+$/, \"\") || \"swiplet\";\n\nconst templates = {\n \"package.json\": (name) =>\n `${JSON.stringify(\n {\n name: idOf(name),\n version: \"0.1.0\",\n private: true,\n swiplet: {\n id: idOf(name),\n name,\n versionCode: 1,\n icon: { color: \"blue\", symbol: \"sparkles\" },\n app: \"./src/App.tsx\",\n extension: \"./src/extension.ts\",\n },\n scripts: { build: \"swipt project build\", check: \"tsc\" },\n dependencies: { zod: \"^4.6.7\" },\n devDependencies: {\n \"@swipt/api\": swiptRange,\n \"@swipt/cli\": swiptRange,\n typescript: \"^7.0.2\",\n ...Object.fromEntries(\n [\"@expo/ui\", \"@types/react\", \"react\"].map((name) => [\n name,\n peerDependencies[name],\n ]),\n ),\n },\n },\n null,\n 2,\n )}\\n`,\n \"tsconfig.json\": () =>\n `${JSON.stringify(\n {\n compilerOptions: {\n target: \"ES2022\",\n module: \"ESNext\",\n moduleResolution: \"Bundler\",\n jsx: \"react-jsx\",\n lib: [\"ES2023\", \"DOM\"],\n strict: true,\n noEmit: true,\n skipLibCheck: true,\n },\n },\n null,\n 2,\n )}\\n`,\n \".gitignore\": () => \"node_modules/\\ndist/\\n\",\n \"src/extension.ts\": () => `import * as device from \"@swipt/api/device\";\nimport { defineAction, defineExtension } from \"@swipt/api/swiplet\";\n\nexport default defineExtension({\n actions: {\n frontApp: defineAction({\n title: \"Find the App in Front\",\n run: (_, { signal }) => device.foregroundApplication.get({ signal }),\n }),\n },\n});\n`,\n \"src/App.tsx\":\n () => `import { Button, Form, Host, Section, Text } from \"@expo/ui/swift-ui\";\nimport { useState } from \"react\";\nimport { actions } from \"@swipt/api/swiplet\";\n\nimport type extension from \"./extension\";\n\nconst { frontApp } = actions<typeof extension>();\n\nexport default function App() {\n const [app, setApp] = useState(\"\");\n return (\n <Host style={{ flex: 1 }}>\n <Form>\n <Section>\n <Button label=\"Find the App in Front\" onPress={async () => setApp(await frontApp())} />\n {app === \"\" ? null : <Text>{app}</Text>}\n </Section>\n </Form>\n </Host>\n );\n}\n`,\n};\n\nconst quote = (value) =>\n /^[\\w@%+=:,./-]+$/.test(value)\n ? value\n : `'${value.replaceAll(\"'\", \"'\\\\''\")}'`;\n\nfunction createCommand(directory) {\n const root = path.resolve(directory);\n if (fs.existsSync(root) && fs.readdirSync(root).length > 0) {\n throw new Error(tr(\"{directory} is not empty\", { directory }));\n }\n for (const [file, template] of Object.entries(templates)) {\n fs.mkdirSync(path.dirname(path.join(root, file)), { recursive: true });\n fs.writeFileSync(path.join(root, file), template(path.basename(root)));\n }\n const manager = process.env.npm_config_user_agent?.split(\"/\")[0] ?? \"npm\";\n console.log(\n `cd ${quote(directory)} && ${manager} install && ${manager} run build`,\n );\n}\n\nexport const create = defineCommand({\n name: \"create\",\n use: \"create DIRECTORY\",\n short: tr(\"Make a swiplet project in a new or empty directory\"),\n args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,mBAAmB,KAAK,KAAK,IACzB,QACA,IAAI,MAAM,WAAW,KAAK,OAAO,EAAE;AAEzC,SAAS,cAAc,WAAW;CAChC,MAAM,OAAO,KAAK,QAAQ,SAAS;CACnC,IAAI,GAAG,WAAW,IAAI,KAAK,GAAG,YAAY,IAAI,CAAC,CAAC,SAAS,GACvD,MAAM,IAAI,MAAM,GAAG,4BAA4B,EAAE,UAAU,CAAC,CAAC;CAE/D,KAAK,MAAM,CAAC,MAAM,aAAa,OAAO,QAAQ,SAAS,GAAG;EACxD,GAAG,UAAU,KAAK,QAAQ,KAAK,KAAK,MAAM,IAAI,CAAC,GAAG,EAAE,WAAW,KAAK,CAAC;EACrE,GAAG,cAAc,KAAK,KAAK,MAAM,IAAI,GAAG,SAAS,KAAK,SAAS,IAAI,CAAC,CAAC;CACvE;CACA,MAAM,UAAU,QAAQ,IAAI,uBAAuB,MAAM,GAAG,CAAC,CAAC,MAAM;CACpE,QAAQ,IACN,MAAM,MAAM,SAAS,EAAE,MAAM,QAAQ,cAAc,QAAQ,WAC7D;AACF;AAEA,MAAa,SAAS,cAAc;CAClC,MAAM;CACN,KAAK;CACL,OAAO,GAAG,oDAAoD;CAC9D,MAAM,CAAC,GAAG,CAAC;CACX,MAAM,EAAE,WAAW,cAAc,KAAK,EAAE;AAC1C,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { tr } from "../../../i18n.js";
|
|
2
|
+
import { buildProject } from "../../../project.js";
|
|
3
|
+
import { defineCommand } from "../../command.js";
|
|
4
|
+
import { deploy as deploy$1, printDeployed } from "../../deploy.js";
|
|
5
|
+
import { session } from "../../session.js";
|
|
6
|
+
import { deviceOption } from "../flags.js";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
// src/cli/commands/project/deploy.ts
|
|
9
|
+
async function deployProject(context) {
|
|
10
|
+
const { archive } = await buildProject(path.resolve(context.args[0] ?? "."));
|
|
11
|
+
await session(context, async (client) => printDeployed(await deploy$1(client, archive, context.signal), true));
|
|
12
|
+
}
|
|
13
|
+
const deploy = defineCommand({
|
|
14
|
+
name: "deploy",
|
|
15
|
+
use: "deploy [PROJECT]",
|
|
16
|
+
short: tr("Build the project and install it on the device"),
|
|
17
|
+
args: [0, 1],
|
|
18
|
+
options: deviceOption,
|
|
19
|
+
run: deployProject
|
|
20
|
+
});
|
|
21
|
+
export { deploy };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=deploy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy.js","names":["deploySwiplet"],"sources":["../../../../src/cli/commands/project/deploy.ts"],"sourcesContent":["import path from \"node:path\";\n\nimport { tr } from \"../../../i18n\";\nimport { buildProject } from \"../../../project\";\nimport { defineCommand } from \"../../command\";\nimport { deploy as deploySwiplet, printDeployed } from \"../../deploy\";\nimport { session } from \"../../session\";\nimport { deviceOption } from \"../flags\";\n\nasync function deployProject(context) {\n const { archive } = await buildProject(path.resolve(context.args[0] ?? \".\"));\n await session(context, async (client) =>\n printDeployed(await deploySwiplet(client, archive, context.signal), true),\n );\n}\n\nexport const deploy = defineCommand({\n name: \"deploy\",\n use: \"deploy [PROJECT]\",\n short: tr(\"Build the project and install it on the device\"),\n args: [0, 1],\n options: deviceOption,\n run: deployProject,\n});\n"],"mappings":";;;;;;;;AASA,eAAe,cAAc,SAAS;CACpC,MAAM,EAAE,YAAY,MAAM,aAAa,KAAK,QAAQ,QAAQ,KAAK,MAAM,GAAG,CAAC;CAC3E,MAAM,QAAQ,SAAS,OAAO,WAC5B,cAAc,MAAMA,SAAc,QAAQ,SAAS,QAAQ,MAAM,GAAG,IAAI,CAC1E;AACF;AAEA,MAAa,SAAS,cAAc;CAClC,MAAM;CACN,KAAK;CACL,OAAO,GAAG,gDAAgD;CAC1D,MAAM,CAAC,GAAG,CAAC;CACX,SAAS;CACT,KAAK;AACP,CAAC"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { AvailabilityChecker } from "../../../availability.js";
|
|
2
|
+
import { unauthenticated } from "../../../client.js";
|
|
3
|
+
import { attach } from "../../../connection.js";
|
|
4
|
+
import { tr } from "../../../i18n.js";
|
|
5
|
+
import { Ignorer, relativePath } from "../../../ignore.js";
|
|
6
|
+
import { printLog, serviceText } from "../../../output.js";
|
|
7
|
+
import { buildProject, loadProject } from "../../../project.js";
|
|
8
|
+
import "../../../proto/swiplets_pb.js";
|
|
9
|
+
import { defineCommand } from "../../command.js";
|
|
10
|
+
import { deploy, printDeployed } from "../../deploy.js";
|
|
11
|
+
import { deviceOption } from "../flags.js";
|
|
12
|
+
import fs from "node:fs";
|
|
13
|
+
import path from "node:path";
|
|
14
|
+
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
15
|
+
// src/cli/commands/project/develop.ts
|
|
16
|
+
const rebuildDelay = 300;
|
|
17
|
+
const logReconnect = 2e3;
|
|
18
|
+
function elapsed(since) {
|
|
19
|
+
const ms = Date.now() - since;
|
|
20
|
+
if (ms < 1e3) return `${ms}ms`;
|
|
21
|
+
const seconds = ms / 1e3;
|
|
22
|
+
if (seconds < 60) return `${Number(seconds.toFixed(3))}s`;
|
|
23
|
+
return `${Math.floor(seconds / 60)}m${Number((seconds % 60).toFixed(3))}s`;
|
|
24
|
+
}
|
|
25
|
+
async function follow(signal, fatal, run) {
|
|
26
|
+
let reported;
|
|
27
|
+
while (!signal.aborted) {
|
|
28
|
+
try {
|
|
29
|
+
await run();
|
|
30
|
+
} catch (error) {
|
|
31
|
+
if (unauthenticated(error)) {
|
|
32
|
+
fatal(error);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (!signal.aborted && error.message !== reported) {
|
|
36
|
+
reported = error.message;
|
|
37
|
+
console.error(tr("error: {message}", { message: error.message }));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
await setTimeout$1(logReconnect, void 0, { signal });
|
|
42
|
+
} catch {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async function developProject(context) {
|
|
48
|
+
const { signal, printError } = context;
|
|
49
|
+
const project = loadProject(path.resolve(context.args[0] ?? "."));
|
|
50
|
+
const root = project.root;
|
|
51
|
+
const client = await attach(context);
|
|
52
|
+
const controller = new AbortController();
|
|
53
|
+
const inner = AbortSignal.any([signal, controller.signal]);
|
|
54
|
+
let fatalReject;
|
|
55
|
+
const fatal = new Promise((_, reject) => {
|
|
56
|
+
fatalReject = reject;
|
|
57
|
+
});
|
|
58
|
+
follow(inner, fatalReject, async () => {
|
|
59
|
+
for await (const response of client.swiplets.watchServices({}, { signal: inner })) if (response.swipletId === project.config.id && response.service?.status === 4) console.error(`${response.swipletId}: ${serviceText(response.swipletId, response.service)}`);
|
|
60
|
+
});
|
|
61
|
+
if (!context.options["no-logs"]) follow(inner, fatalReject, async () => {
|
|
62
|
+
for await (const response of client.logs.readLogs({
|
|
63
|
+
swipletId: project.config.id,
|
|
64
|
+
follow: true
|
|
65
|
+
}, { signal: inner })) printLog(response.entry, false);
|
|
66
|
+
});
|
|
67
|
+
let deployed = "";
|
|
68
|
+
const checker = new AvailabilityChecker();
|
|
69
|
+
const cycle = async () => {
|
|
70
|
+
const started = Date.now();
|
|
71
|
+
let built;
|
|
72
|
+
try {
|
|
73
|
+
built = await buildProject(root, checker);
|
|
74
|
+
} catch (error) {
|
|
75
|
+
if (!inner.aborted) console.error(tr("error: {message}", { message: error.message }));
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (built.digest === deployed) {
|
|
79
|
+
console.error(tr("built in {elapsed}; it came out as deployed, so nothing was deployed", { elapsed: elapsed(started) }));
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
let result;
|
|
83
|
+
try {
|
|
84
|
+
result = await deploy(client, built.archive, inner);
|
|
85
|
+
} catch (error) {
|
|
86
|
+
if (unauthenticated(error)) throw error;
|
|
87
|
+
if (!inner.aborted) printError(error, "deploy");
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
deployed = built.digest;
|
|
91
|
+
printDeployed(result, false);
|
|
92
|
+
console.error(tr("built and deployed in {elapsed}; watching {directory}", {
|
|
93
|
+
elapsed: elapsed(started),
|
|
94
|
+
directory: root
|
|
95
|
+
}));
|
|
96
|
+
};
|
|
97
|
+
const watch = () => new Promise((resolve, reject) => {
|
|
98
|
+
let ignore = new Ignorer(root);
|
|
99
|
+
let timer;
|
|
100
|
+
const watcher = fs.watch(root, { recursive: true }, (_, filename) => {
|
|
101
|
+
if (filename === null) return;
|
|
102
|
+
const name = path.join(root, filename);
|
|
103
|
+
if (path.basename(name) === ".gitignore") ignore = new Ignorer(root);
|
|
104
|
+
let isDirectory = false;
|
|
105
|
+
try {
|
|
106
|
+
isDirectory = fs.statSync(name).isDirectory();
|
|
107
|
+
} catch {
|
|
108
|
+
isDirectory = false;
|
|
109
|
+
}
|
|
110
|
+
const relative = relativePath(root, name);
|
|
111
|
+
if (relative === "" || ignore.ignored(relative, isDirectory)) return;
|
|
112
|
+
clearTimeout(timer);
|
|
113
|
+
timer = setTimeout(() => cycle().catch(reject), rebuildDelay);
|
|
114
|
+
});
|
|
115
|
+
watcher.on("error", (error) => printError(error, "watch the project"));
|
|
116
|
+
inner.addEventListener("abort", () => {
|
|
117
|
+
clearTimeout(timer);
|
|
118
|
+
watcher.close();
|
|
119
|
+
resolve();
|
|
120
|
+
}, { once: true });
|
|
121
|
+
});
|
|
122
|
+
try {
|
|
123
|
+
await cycle();
|
|
124
|
+
await Promise.race([watch(), fatal]);
|
|
125
|
+
} finally {
|
|
126
|
+
controller.abort();
|
|
127
|
+
checker.close();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
const develop = defineCommand({
|
|
131
|
+
name: "develop",
|
|
132
|
+
use: "develop [PROJECT]",
|
|
133
|
+
short: tr("Build, install and follow a swiplet project as it changes"),
|
|
134
|
+
args: [0, 1],
|
|
135
|
+
options: {
|
|
136
|
+
...deviceOption,
|
|
137
|
+
"no-logs": {
|
|
138
|
+
type: "boolean",
|
|
139
|
+
help: tr("without logs")
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
run: developProject
|
|
143
|
+
});
|
|
144
|
+
export { develop };
|
|
145
|
+
|
|
146
|
+
//# sourceMappingURL=develop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"develop.js","names":["sleep"],"sources":["../../../../src/cli/commands/project/develop.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { setTimeout as sleep } from \"node:timers/promises\";\n\nimport { AvailabilityChecker } from \"../../../availability\";\nimport { unauthenticated } from \"../../../client\";\nimport { attach } from \"../../../connection\";\nimport { tr } from \"../../../i18n\";\nimport { Ignorer, relativePath } from \"../../../ignore\";\nimport { printLog, serviceText } from \"../../../output\";\nimport { buildProject, loadProject } from \"../../../project\";\nimport { ServiceStatus } from \"../../../proto/swiplets_pb\";\nimport { defineCommand } from \"../../command\";\nimport { deploy, printDeployed } from \"../../deploy\";\nimport { deviceOption } from \"../flags\";\n\nconst rebuildDelay = 300;\nconst logReconnect = 2000;\n\nfunction elapsed(since) {\n const ms = Date.now() - since;\n if (ms < 1000) {\n return `${ms}ms`;\n }\n const seconds = ms / 1000;\n if (seconds < 60) {\n return `${Number(seconds.toFixed(3))}s`;\n }\n return `${Math.floor(seconds / 60)}m${Number((seconds % 60).toFixed(3))}s`;\n}\n\nasync function follow(signal, fatal, run) {\n let reported;\n while (!signal.aborted) {\n try {\n await run();\n } catch (error) {\n if (unauthenticated(error)) {\n fatal(error);\n return;\n }\n if (!signal.aborted && error.message !== reported) {\n reported = error.message;\n console.error(tr(\"error: {message}\", { message: error.message }));\n }\n }\n try {\n await sleep(logReconnect, undefined, { signal });\n } catch {\n return;\n }\n }\n}\n\nasync function developProject(context) {\n const { signal, printError } = context;\n const project = loadProject(path.resolve(context.args[0] ?? \".\"));\n const root = project.root;\n const client = await attach(context);\n const controller = new AbortController();\n const inner = AbortSignal.any([signal, controller.signal]);\n let fatalReject;\n const fatal = new Promise((_, reject) => {\n fatalReject = reject;\n });\n follow(inner, fatalReject, async () => {\n for await (const response of client.swiplets.watchServices(\n {},\n { signal: inner },\n )) {\n if (\n response.swipletId === project.config.id &&\n response.service?.status === ServiceStatus.FAILED\n ) {\n console.error(\n `${response.swipletId}: ${serviceText(response.swipletId, response.service)}`,\n );\n }\n }\n });\n if (!context.options[\"no-logs\"]) {\n follow(inner, fatalReject, async () => {\n for await (const response of client.logs.readLogs(\n { swipletId: project.config.id, follow: true },\n { signal: inner },\n )) {\n printLog(response.entry, false);\n }\n });\n }\n let deployed = \"\";\n const checker = new AvailabilityChecker();\n const cycle = async () => {\n const started = Date.now();\n let built;\n try {\n built = await buildProject(root, checker);\n } catch (error) {\n if (!inner.aborted) {\n console.error(tr(\"error: {message}\", { message: error.message }));\n }\n return;\n }\n if (built.digest === deployed) {\n console.error(\n tr(\n \"built in {elapsed}; it came out as deployed, so nothing was deployed\",\n { elapsed: elapsed(started) },\n ),\n );\n return;\n }\n let result;\n try {\n result = await deploy(client, built.archive, inner);\n } catch (error) {\n if (unauthenticated(error)) {\n throw error;\n }\n if (!inner.aborted) {\n printError(error, \"deploy\");\n }\n return;\n }\n deployed = built.digest;\n printDeployed(result, false);\n console.error(\n tr(\"built and deployed in {elapsed}; watching {directory}\", {\n elapsed: elapsed(started),\n directory: root,\n }),\n );\n };\n const watch = () =>\n new Promise<void>((resolve, reject) => {\n let ignore = new Ignorer(root);\n let timer;\n const watcher = fs.watch(root, { recursive: true }, (_, filename) => {\n if (filename === null) {\n return;\n }\n const name = path.join(root, filename);\n if (path.basename(name) === \".gitignore\") {\n ignore = new Ignorer(root);\n }\n let isDirectory = false;\n try {\n isDirectory = fs.statSync(name).isDirectory();\n } catch {\n isDirectory = false;\n }\n const relative = relativePath(root, name);\n if (relative === \"\" || ignore.ignored(relative, isDirectory)) {\n return;\n }\n clearTimeout(timer);\n timer = setTimeout(() => cycle().catch(reject), rebuildDelay);\n });\n watcher.on(\"error\", (error) => printError(error, \"watch the project\"));\n inner.addEventListener(\n \"abort\",\n () => {\n clearTimeout(timer);\n watcher.close();\n resolve();\n },\n { once: true },\n );\n });\n try {\n await cycle();\n await Promise.race([watch(), fatal]);\n } finally {\n controller.abort();\n checker.close();\n }\n}\n\nexport const develop = defineCommand({\n name: \"develop\",\n use: \"develop [PROJECT]\",\n short: tr(\"Build, install and follow a swiplet project as it changes\"),\n args: [0, 1],\n options: {\n ...deviceOption,\n \"no-logs\": { type: \"boolean\", help: tr(\"without logs\") },\n },\n run: developProject,\n});\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,MAAM,eAAe;AACrB,MAAM,eAAe;AAErB,SAAS,QAAQ,OAAO;CACtB,MAAM,KAAK,KAAK,IAAI,IAAI;CACxB,IAAI,KAAK,KACP,OAAO,GAAG,GAAG;CAEf,MAAM,UAAU,KAAK;CACrB,IAAI,UAAU,IACZ,OAAO,GAAG,OAAO,QAAQ,QAAQ,CAAC,CAAC,EAAE;CAEvC,OAAO,GAAG,KAAK,MAAM,UAAU,EAAE,EAAE,GAAG,QAAQ,UAAU,GAAA,CAAI,QAAQ,CAAC,CAAC,EAAE;AAC1E;AAEA,eAAe,OAAO,QAAQ,OAAO,KAAK;CACxC,IAAI;CACJ,OAAO,CAAC,OAAO,SAAS;EACtB,IAAI;GACF,MAAM,IAAI;EACZ,SAAS,OAAO;GACd,IAAI,gBAAgB,KAAK,GAAG;IAC1B,MAAM,KAAK;IACX;GACF;GACA,IAAI,CAAC,OAAO,WAAW,MAAM,YAAY,UAAU;IACjD,WAAW,MAAM;IACjB,QAAQ,MAAM,GAAG,oBAAoB,EAAE,SAAS,MAAM,QAAQ,CAAC,CAAC;GAClE;EACF;EACA,IAAI;GACF,MAAMA,aAAM,cAAc,KAAA,GAAW,EAAE,OAAO,CAAC;EACjD,QAAQ;GACN;EACF;CACF;AACF;AAEA,eAAe,eAAe,SAAS;CACrC,MAAM,EAAE,QAAQ,eAAe;CAC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AO,GAAG,2DAA2D;CACrE,MAAM,CAAC,GAAG,CAAC;CACX,SAAS;EACP,GAAG;EACH,WAAW;GAAE,MAAM;GAAW,MAAM,GAAG,cAAc;EAAE;CACzD;CACA,KAAK;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { project } from "./project.js";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { tr } from "../../../i18n.js";
|
|
2
|
+
import { defineCommand } from "../../command.js";
|
|
3
|
+
import { build } from "./build.js";
|
|
4
|
+
import { create } from "./create.js";
|
|
5
|
+
import { deploy } from "./deploy.js";
|
|
6
|
+
import { develop } from "./develop.js";
|
|
7
|
+
import { source } from "./source.js";
|
|
8
|
+
// src/cli/commands/project/project.ts
|
|
9
|
+
const project = defineCommand({
|
|
10
|
+
name: "project",
|
|
11
|
+
short: tr("Make, build and deploy swiplet projects"),
|
|
12
|
+
commands: [
|
|
13
|
+
create,
|
|
14
|
+
build,
|
|
15
|
+
source,
|
|
16
|
+
deploy,
|
|
17
|
+
develop
|
|
18
|
+
]
|
|
19
|
+
});
|
|
20
|
+
export { project };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=project.js.map
|