flypod 0.12.0 → 0.13.0
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/README.md +5 -18
- package/dist/bin/deploy.js +26 -205
- package/dist/{cli-6255rw94.js → cli-krr4ygaf.js} +0 -22
- package/dist/src/cli/commands.d.ts +2 -18
- package/dist/src/cli.js +1 -1
- package/package.json +1 -1
- package/dist/src/cli/watch.d.ts +0 -39
package/README.md
CHANGED
|
@@ -495,26 +495,14 @@ The way a static export expects, with nothing to configure:
|
|
|
495
495
|
- **Caching.** Files whose name carries a build hash (`app.3f9a2c1b.js`,
|
|
496
496
|
`assets/index-BjK3x9aZ.css`, anything under `_next/static/` or `_astro/`)
|
|
497
497
|
are served `immutable` for a year. Everything else revalidates after a
|
|
498
|
-
minute, so a `flypod update` shows up promptly.
|
|
499
|
-
(and on a site with the timeline on) it revalidates on every request
|
|
500
|
-
instead, which costs a `304` and keeps a reloaded page from pairing new
|
|
501
|
-
HTML with an old stylesheet.
|
|
502
|
-
- **Live update.** A page that is open when you deploy reloads itself, so a
|
|
503
|
-
tab on a second screen or a phone follows your work. It applies for a day
|
|
504
|
-
after each deploy: the page asks which version is live, every two seconds
|
|
505
|
-
at first and less often as the site settles, and not at all while the tab
|
|
506
|
-
is hidden. A site that has not been deployed for a day carries no script.
|
|
507
|
-
A page someone has typed into is never reloaded.
|
|
498
|
+
minute, so a `flypod update` shows up promptly.
|
|
508
499
|
- **Media.** Non-HTML files answer byte-range requests, which is what lets
|
|
509
500
|
video and audio play on Safari and iOS.
|
|
510
501
|
- **Link previews.** A page with no `og:title` or `og:description` gets them
|
|
511
|
-
from its own `<title>` and first paragraph,
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
time something asks for it, not at deploy time, and is not a screenshot.
|
|
516
|
-
Tags you wrote are never changed. `<meta name="flypod" content="none">`
|
|
517
|
-
turns this, live update and the attribution block off.
|
|
502
|
+
from its own `<title>` and first paragraph, so a pasted URL unfurls with the
|
|
503
|
+
page's title instead of a bare address. Tags you wrote are never changed.
|
|
504
|
+
`<meta name="flypod" content="none">` turns this and the attribution block
|
|
505
|
+
off.
|
|
518
506
|
- **Version timeline** (opt-in). `--timeline` puts a small slider on the
|
|
519
507
|
site's pages that steps through its versions, so a reviewer can compare
|
|
520
508
|
the third attempt with the fifth without anyone rolling back. It is off
|
|
@@ -583,7 +571,6 @@ Deploy flags:
|
|
|
583
571
|
| `--json` | Emit the result as JSON on stdout (replaces the pretty output) |
|
|
584
572
|
| `--verbose` | More of the same receipt. In a terminal: the rollback and history commands, plus the site id, version id and source folder. With `--json`: also tokens, counts, timing. Also on `flypod update` |
|
|
585
573
|
| `-q`, `--quiet` | Print only the URL on stdout, and nothing else |
|
|
586
|
-
| `--watch` | Keep running and deploy again each time the folder changes. With `--json`, one line per deploy. Ctrl+C to stop. Also on `flypod update` |
|
|
587
574
|
| `--timeline`, `--no-timeline` | Show or hide the version slider on the site's pages. Also on `flypod update` |
|
|
588
575
|
| `--comments` | Enable comments on the new site (requires being signed in) |
|
|
589
576
|
| `--mode <mode>` | With `--comments`: `anonymous` (default), `passcode`, or `approved` |
|
package/dist/bin/deploy.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
resolveCredentials,
|
|
13
13
|
resolveDeployDir,
|
|
14
14
|
saveSession
|
|
15
|
-
} from "../cli-
|
|
15
|
+
} from "../cli-krr4ygaf.js";
|
|
16
16
|
|
|
17
17
|
// bin/deploy.ts
|
|
18
18
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
@@ -471,82 +471,6 @@ function agentNext(opts) {
|
|
|
471
471
|
};
|
|
472
472
|
}
|
|
473
473
|
|
|
474
|
-
// src/cli/watch.ts
|
|
475
|
-
import { createHash } from "node:crypto";
|
|
476
|
-
import { readdir, stat } from "node:fs/promises";
|
|
477
|
-
import { join } from "node:path";
|
|
478
|
-
var POLL_MS = 400;
|
|
479
|
-
var RETRY_MS = 5000;
|
|
480
|
-
async function snapshot(path) {
|
|
481
|
-
const parts = [];
|
|
482
|
-
async function walk(current) {
|
|
483
|
-
for (const entry of await readdir(current, { withFileTypes: true })) {
|
|
484
|
-
const full = join(current, entry.name);
|
|
485
|
-
if (entry.isDirectory())
|
|
486
|
-
await walk(full);
|
|
487
|
-
else {
|
|
488
|
-
const info = await stat(full);
|
|
489
|
-
parts.push(`${full}\x00${info.size}\x00${info.mtimeMs}`);
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
try {
|
|
494
|
-
const info = await stat(path);
|
|
495
|
-
if (info.isFile())
|
|
496
|
-
return `${path}\x00${info.size}\x00${info.mtimeMs}`;
|
|
497
|
-
await walk(path);
|
|
498
|
-
} catch {
|
|
499
|
-
return null;
|
|
500
|
-
}
|
|
501
|
-
return parts.length === 0 ? null : parts.sort().join(`
|
|
502
|
-
`);
|
|
503
|
-
}
|
|
504
|
-
function contentKey(files) {
|
|
505
|
-
const hash = createHash("sha1");
|
|
506
|
-
for (const name of Object.keys(files).sort()) {
|
|
507
|
-
hash.update(name);
|
|
508
|
-
hash.update("\x00");
|
|
509
|
-
hash.update(files[name]);
|
|
510
|
-
hash.update("\x00");
|
|
511
|
-
}
|
|
512
|
-
return hash.digest("hex");
|
|
513
|
-
}
|
|
514
|
-
function sleepUntil(ms, signal) {
|
|
515
|
-
return new Promise((resolve) => {
|
|
516
|
-
if (signal.aborted)
|
|
517
|
-
return resolve();
|
|
518
|
-
const timer = setTimeout(done, ms);
|
|
519
|
-
function done() {
|
|
520
|
-
clearTimeout(timer);
|
|
521
|
-
signal.removeEventListener("abort", done);
|
|
522
|
-
resolve();
|
|
523
|
-
}
|
|
524
|
-
signal.addEventListener("abort", done);
|
|
525
|
-
});
|
|
526
|
-
}
|
|
527
|
-
async function watchLoop(opts) {
|
|
528
|
-
const sleep = opts.sleep ?? ((ms) => sleepUntil(ms, opts.signal));
|
|
529
|
-
let shipped = opts.baseline;
|
|
530
|
-
let seen = opts.baseline;
|
|
531
|
-
while (!opts.signal.aborted) {
|
|
532
|
-
await sleep(opts.pollMs ?? POLL_MS);
|
|
533
|
-
if (opts.signal.aborted)
|
|
534
|
-
return;
|
|
535
|
-
const now = await opts.snapshot();
|
|
536
|
-
if (now !== seen) {
|
|
537
|
-
seen = now;
|
|
538
|
-
continue;
|
|
539
|
-
}
|
|
540
|
-
if (now === null || now === shipped)
|
|
541
|
-
continue;
|
|
542
|
-
if (await opts.ship() === "retry") {
|
|
543
|
-
await sleep(opts.retryMs ?? RETRY_MS);
|
|
544
|
-
continue;
|
|
545
|
-
}
|
|
546
|
-
shipped = now;
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
|
|
550
474
|
// src/cli/commands.ts
|
|
551
475
|
function siteUrlFrom(site_id, baseUrl) {
|
|
552
476
|
const host = new URL(baseUrl).host;
|
|
@@ -566,8 +490,6 @@ Ship a new version of the site linked to this folder.
|
|
|
566
490
|
Flags:
|
|
567
491
|
--site <id> Target a site by id instead of the linked folder.
|
|
568
492
|
--token <tok> Authorize with a manage_token.
|
|
569
|
-
--watch Keep running and deploy again each time the folder changes.
|
|
570
|
-
With --json, one line per deploy. Ctrl+C to stop.
|
|
571
493
|
--timeline Show a version slider on the site's pages, so a visitor can
|
|
572
494
|
step back through earlier versions. --no-timeline hides it.
|
|
573
495
|
--verbose The full receipt: also the rollback command, and with
|
|
@@ -984,7 +906,7 @@ async function touchLink(target, version_id, env) {
|
|
|
984
906
|
await linkProject(target.dir, { ...target.rec, version_id, last_used: Date.now() }, env);
|
|
985
907
|
}
|
|
986
908
|
}
|
|
987
|
-
async function
|
|
909
|
+
async function update(args, io) {
|
|
988
910
|
const pre = await withTarget("update", args, io);
|
|
989
911
|
if (typeof pre === "number")
|
|
990
912
|
return pre;
|
|
@@ -996,15 +918,13 @@ async function updateContext(args, io) {
|
|
|
996
918
|
} catch (e) {
|
|
997
919
|
return emitError(noBuildDir(e.message), args, io);
|
|
998
920
|
}
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
async function publishUpdate(ctx, files, args, io, opts) {
|
|
1007
|
-
const { env, target, client } = ctx;
|
|
921
|
+
let files;
|
|
922
|
+
try {
|
|
923
|
+
files = await collectDist(dir);
|
|
924
|
+
} catch (e) {
|
|
925
|
+
return fail("no_files", `Could not read ${dir}: ${e.message}`, args, io);
|
|
926
|
+
}
|
|
927
|
+
const client = await clientForTarget(target, args, io);
|
|
1008
928
|
let res;
|
|
1009
929
|
try {
|
|
1010
930
|
res = await client.redeploy(target.site_id, packDeploy(files));
|
|
@@ -1016,7 +936,7 @@ async function publishUpdate(ctx, files, args, io, opts) {
|
|
|
1016
936
|
const body = await res.json();
|
|
1017
937
|
await touchLink(target, body.version_id, env);
|
|
1018
938
|
let timeline;
|
|
1019
|
-
if (args.timeline !== undefined
|
|
939
|
+
if (args.timeline !== undefined) {
|
|
1020
940
|
const ok = await client.setTimeline(target.site_id, args.timeline).then((r) => r.ok).catch(() => false);
|
|
1021
941
|
timeline = ok ? args.timeline : !args.timeline;
|
|
1022
942
|
}
|
|
@@ -1040,15 +960,7 @@ async function publishUpdate(ctx, files, args, io, opts) {
|
|
|
1040
960
|
return 0;
|
|
1041
961
|
}
|
|
1042
962
|
if (args.quiet) {
|
|
1043
|
-
|
|
1044
|
-
io.out(body.url);
|
|
1045
|
-
return 0;
|
|
1046
|
-
}
|
|
1047
|
-
const s = io.style ?? PLAIN;
|
|
1048
|
-
if (opts.again) {
|
|
1049
|
-
io.err(headline("Updated", `${clock(Date.now())} · version ${shortVersion(body.version_id)}`, s));
|
|
1050
|
-
for (const line of warningLines(body.warnings, s))
|
|
1051
|
-
io.err(line);
|
|
963
|
+
io.out(body.url);
|
|
1052
964
|
return 0;
|
|
1053
965
|
}
|
|
1054
966
|
for (const line of updateScreen({
|
|
@@ -1062,8 +974,9 @@ async function publishUpdate(ctx, files, args, io, opts) {
|
|
|
1062
974
|
io.err(line);
|
|
1063
975
|
}
|
|
1064
976
|
if (timeline !== undefined) {
|
|
1065
|
-
for (const line of timelineRows(args.timeline, timeline,
|
|
977
|
+
for (const line of timelineRows(args.timeline, timeline, io.style ?? PLAIN)) {
|
|
1066
978
|
io.err(line);
|
|
979
|
+
}
|
|
1067
980
|
}
|
|
1068
981
|
if (!io.interactive)
|
|
1069
982
|
io.out(body.url);
|
|
@@ -1078,68 +991,6 @@ function timelineRows(asked, now, s) {
|
|
|
1078
991
|
""
|
|
1079
992
|
];
|
|
1080
993
|
}
|
|
1081
|
-
async function watchUpdates(ctx, args, io, state) {
|
|
1082
|
-
const controller = new AbortController;
|
|
1083
|
-
const stop = () => controller.abort();
|
|
1084
|
-
if (io.signal) {
|
|
1085
|
-
if (io.signal.aborted)
|
|
1086
|
-
stop();
|
|
1087
|
-
else
|
|
1088
|
-
io.signal.addEventListener("abort", stop, { once: true });
|
|
1089
|
-
} else {
|
|
1090
|
-
process.once("SIGINT", stop);
|
|
1091
|
-
process.once("SIGTERM", stop);
|
|
1092
|
-
}
|
|
1093
|
-
if (!args.json && !args.quiet) {
|
|
1094
|
-
io.err(field("watching", ctx.dir, "saves deploy · Ctrl+C to stop", io.style ?? PLAIN));
|
|
1095
|
-
io.err("");
|
|
1096
|
-
}
|
|
1097
|
-
let shipped = state.shipped;
|
|
1098
|
-
await watchLoop({
|
|
1099
|
-
baseline: state.baseline,
|
|
1100
|
-
snapshot: () => snapshot(ctx.dir),
|
|
1101
|
-
signal: controller.signal,
|
|
1102
|
-
pollMs: io.watchPollMs,
|
|
1103
|
-
ship: async () => {
|
|
1104
|
-
let files;
|
|
1105
|
-
try {
|
|
1106
|
-
files = await collectDist(ctx.dir);
|
|
1107
|
-
} catch {
|
|
1108
|
-
return "retry";
|
|
1109
|
-
}
|
|
1110
|
-
const key = contentKey(files);
|
|
1111
|
-
if (Object.keys(files).length === 0 || key === shipped)
|
|
1112
|
-
return "done";
|
|
1113
|
-
const code = await publishUpdate(ctx, files, args, io, { again: true });
|
|
1114
|
-
if (code === 0)
|
|
1115
|
-
shipped = key;
|
|
1116
|
-
return code === 4 ? "retry" : "done";
|
|
1117
|
-
}
|
|
1118
|
-
});
|
|
1119
|
-
return 0;
|
|
1120
|
-
}
|
|
1121
|
-
async function update(args, io) {
|
|
1122
|
-
const ctx = await updateContext(args, io);
|
|
1123
|
-
if (typeof ctx === "number")
|
|
1124
|
-
return ctx;
|
|
1125
|
-
const baseline = args.watch ? await snapshot(ctx.dir) : null;
|
|
1126
|
-
let files;
|
|
1127
|
-
try {
|
|
1128
|
-
files = await collectDist(ctx.dir);
|
|
1129
|
-
} catch (e) {
|
|
1130
|
-
return fail("no_files", `Could not read ${ctx.dir}: ${e.message}`, args, io);
|
|
1131
|
-
}
|
|
1132
|
-
const code = await publishUpdate(ctx, files, args, io, { again: false });
|
|
1133
|
-
if (code !== 0 || !args.watch)
|
|
1134
|
-
return code;
|
|
1135
|
-
return watchUpdates(ctx, args, io, { baseline, shipped: contentKey(files) });
|
|
1136
|
-
}
|
|
1137
|
-
async function watchSite(args, io, state) {
|
|
1138
|
-
const ctx = await updateContext(args, io);
|
|
1139
|
-
if (typeof ctx === "number")
|
|
1140
|
-
return ctx;
|
|
1141
|
-
return watchUpdates(ctx, args, io, state);
|
|
1142
|
-
}
|
|
1143
994
|
async function versions(args, io) {
|
|
1144
995
|
const pre = await withTarget("versions", args, io);
|
|
1145
996
|
if (typeof pre === "number")
|
|
@@ -1929,7 +1780,6 @@ var TOP_LEVEL_FLAG_SPEC = {
|
|
|
1929
1780
|
"--comments": "bool",
|
|
1930
1781
|
"--mode": "value",
|
|
1931
1782
|
"--verbose": "bool",
|
|
1932
|
-
"--watch": "bool",
|
|
1933
1783
|
"--timeline": "bool",
|
|
1934
1784
|
"--no-timeline": "bool"
|
|
1935
1785
|
};
|
|
@@ -1963,7 +1813,6 @@ function parseArgs(argv) {
|
|
|
1963
1813
|
comments: Boolean(flags["--comments"]),
|
|
1964
1814
|
commentsMode: flags["--mode"] ?? "anonymous",
|
|
1965
1815
|
verbose: Boolean(flags["--verbose"]),
|
|
1966
|
-
watch: Boolean(flags["--watch"]),
|
|
1967
1816
|
timeline: timelineFlag(flags)
|
|
1968
1817
|
};
|
|
1969
1818
|
}
|
|
@@ -1976,7 +1825,6 @@ var SUB_FLAG_SPEC = {
|
|
|
1976
1825
|
"-h": "bool",
|
|
1977
1826
|
"--help": "bool",
|
|
1978
1827
|
"--verbose": "bool",
|
|
1979
|
-
"--watch": "bool",
|
|
1980
1828
|
"--timeline": "bool",
|
|
1981
1829
|
"--no-timeline": "bool"
|
|
1982
1830
|
};
|
|
@@ -2004,12 +1852,11 @@ function parseSub(name, argv) {
|
|
|
2004
1852
|
quiet: Boolean(flags["-q"] || flags["--quiet"]),
|
|
2005
1853
|
help: Boolean(flags["-h"] || flags["--help"]),
|
|
2006
1854
|
verbose: Boolean(flags["--verbose"]),
|
|
2007
|
-
watch: Boolean(flags["--watch"]),
|
|
2008
1855
|
timeline: timelineFlag(flags)
|
|
2009
1856
|
};
|
|
2010
1857
|
}
|
|
2011
|
-
function
|
|
2012
|
-
|
|
1858
|
+
async function runSubcommand(name, argv) {
|
|
1859
|
+
const io = {
|
|
2013
1860
|
out: (line) => process.stdout.write(`${line}
|
|
2014
1861
|
`),
|
|
2015
1862
|
err: (line) => process.stderr.write(`${line}
|
|
@@ -2017,13 +1864,10 @@ function terminalIO() {
|
|
|
2017
1864
|
interactive: Boolean(process.stdout.isTTY),
|
|
2018
1865
|
style: makeStyle(colorsEnabled(process.stderr))
|
|
2019
1866
|
};
|
|
2020
|
-
}
|
|
2021
|
-
async function runSubcommand(name, argv) {
|
|
2022
|
-
const io = terminalIO();
|
|
2023
1867
|
switch (name) {
|
|
2024
1868
|
case "update": {
|
|
2025
|
-
const { positionals, site, token: token2, json, quiet, help, verbose,
|
|
2026
|
-
return update({ path: positionals[0], site, token: token2, json, quiet, help, verbose,
|
|
1869
|
+
const { positionals, site, token: token2, json, quiet, help, verbose, timeline } = parseSub(name, argv);
|
|
1870
|
+
return update({ path: positionals[0], site, token: token2, json, quiet, help, verbose, timeline }, io);
|
|
2027
1871
|
}
|
|
2028
1872
|
case "versions": {
|
|
2029
1873
|
const { site, token: token2, json, help } = parseSub(name, argv);
|
|
@@ -2184,16 +2028,11 @@ Ownership — two states, one command:
|
|
|
2184
2028
|
|
|
2185
2029
|
Attribution:
|
|
2186
2030
|
flypod adds a small block of <meta> and JSON-LD to served HTML so crawlers
|
|
2187
|
-
can tell what hosts the page. It renders nothing. It also
|
|
2188
|
-
link-preview tags a page lacks (og:title, og:description,
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
For a day after each deploy, pages also carry a few lines of script that
|
|
2193
|
-
reload the page when the next version lands, so an open tab follows your
|
|
2194
|
-
work. A page someone has typed into is left alone.
|
|
2195
|
-
|
|
2196
|
-
To turn all of it off, put this anywhere in your page:
|
|
2031
|
+
can tell what hosts the page. It renders nothing and runs no script. It also
|
|
2032
|
+
fills in link-preview tags a page lacks (og:title, og:description), taken
|
|
2033
|
+
from the page's own title and text, so a pasted URL unfurls properly; tags
|
|
2034
|
+
you wrote are never changed. To turn all of it off, put this anywhere in
|
|
2035
|
+
your page:
|
|
2197
2036
|
|
|
2198
2037
|
<meta name="flypod" content="none">
|
|
2199
2038
|
|
|
@@ -2219,14 +2058,11 @@ Agents:
|
|
|
2219
2058
|
CLI, Copilot). Add --global for your home dir,
|
|
2220
2059
|
--list to see the paths, --dry-run to preview.
|
|
2221
2060
|
|
|
2222
|
-
Deploy flags
|
|
2223
|
-
--watch Keep running: deploy again each time the folder
|
|
2224
|
-
changes. An open page of the site reloads by
|
|
2225
|
-
itself, so a save shows up in the browser.
|
|
2226
|
-
Ctrl+C to stop. With --json, one line per deploy.
|
|
2061
|
+
Deploy flags:
|
|
2227
2062
|
--timeline Show a version slider on the site's pages, so a
|
|
2228
2063
|
visitor can step back through earlier versions.
|
|
2229
|
-
Off by default: it makes replaced versions
|
|
2064
|
+
Off by default: it makes replaced versions
|
|
2065
|
+
public. Also on 'flypod update'.
|
|
2230
2066
|
--no-timeline Turn the slider off again.
|
|
2231
2067
|
--comments Enable comments on the new site (mode: anonymous).
|
|
2232
2068
|
--comments --mode <mode> Same, but choose the mode: anonymous|passcode|
|
|
@@ -2331,7 +2167,6 @@ async function main() {
|
|
|
2331
2167
|
} catch (error) {
|
|
2332
2168
|
fail2(noBuildDir(error.message), args, style);
|
|
2333
2169
|
}
|
|
2334
|
-
const baseline = args.watch ? await snapshot(dir) : null;
|
|
2335
2170
|
let files;
|
|
2336
2171
|
try {
|
|
2337
2172
|
files = await collectDist(dir);
|
|
@@ -2410,17 +2245,6 @@ async function main() {
|
|
|
2410
2245
|
const ok = await siteClient.setTimeline(result.site_id, args.timeline).then((r) => r.ok).catch(() => false);
|
|
2411
2246
|
timeline = ok ? args.timeline : !args.timeline;
|
|
2412
2247
|
}
|
|
2413
|
-
const keepWatching = async () => {
|
|
2414
|
-
if (!args.watch)
|
|
2415
|
-
return;
|
|
2416
|
-
const code = await watchSite({
|
|
2417
|
-
path: dir,
|
|
2418
|
-
json: args.json,
|
|
2419
|
-
quiet: args.quiet,
|
|
2420
|
-
...linkSaved ? {} : { site: result.site_id, ...owned ? {} : { token: result.manage_token } }
|
|
2421
|
-
}, terminalIO(), { baseline, shipped: contentKey(files) });
|
|
2422
|
-
process.exit(code);
|
|
2423
|
-
};
|
|
2424
2248
|
if (args.json) {
|
|
2425
2249
|
const shared = {
|
|
2426
2250
|
healed: result.healed ?? [],
|
|
@@ -2461,9 +2285,8 @@ async function main() {
|
|
|
2461
2285
|
...shared,
|
|
2462
2286
|
...agentNextCommands(nextOpts)
|
|
2463
2287
|
};
|
|
2464
|
-
process.stdout.write(`${JSON.stringify(receipt, null,
|
|
2288
|
+
process.stdout.write(`${JSON.stringify(receipt, null, 2)}
|
|
2465
2289
|
`);
|
|
2466
|
-
await keepWatching();
|
|
2467
2290
|
return;
|
|
2468
2291
|
}
|
|
2469
2292
|
if (args.quiet) {
|
|
@@ -2472,7 +2295,6 @@ async function main() {
|
|
|
2472
2295
|
if (!linkSaved && !owned)
|
|
2473
2296
|
process.stderr.write(`${result.manage_token}
|
|
2474
2297
|
`);
|
|
2475
|
-
await keepWatching();
|
|
2476
2298
|
return;
|
|
2477
2299
|
}
|
|
2478
2300
|
for (const line of deployScreen({
|
|
@@ -2506,7 +2328,6 @@ async function main() {
|
|
|
2506
2328
|
if (!process.stdout.isTTY)
|
|
2507
2329
|
process.stdout.write(`${result.url}
|
|
2508
2330
|
`);
|
|
2509
|
-
await keepWatching();
|
|
2510
2331
|
}
|
|
2511
2332
|
main().catch((error) => {
|
|
2512
2333
|
const err = unexpectedError(error);
|
|
@@ -518,23 +518,6 @@ the site you already made, and the URL holds.
|
|
|
518
518
|
flypod update ./dist
|
|
519
519
|
\`\`\`
|
|
520
520
|
|
|
521
|
-
A page of the site that is open in a browser reloads itself when the new
|
|
522
|
-
version lands, for a day after each deploy. Tell the user they can leave the
|
|
523
|
-
tab open; they do not need to refresh.
|
|
524
|
-
|
|
525
|
-
### Deploy on every save
|
|
526
|
-
|
|
527
|
-
\`\`\`sh
|
|
528
|
-
flypod update ./dist --watch # the linked site
|
|
529
|
-
flypod ./dist --watch # a new site, then keep watching
|
|
530
|
-
\`\`\`
|
|
531
|
-
|
|
532
|
-
\`--watch\` keeps running and ships a new version each time the folder stops
|
|
533
|
-
changing. **It never exits**, so run it in the background and stop it when the
|
|
534
|
-
work is done; do not wait on it. With \`--json\` it prints one line per deploy.
|
|
535
|
-
Use it when the user is iterating with you and watching the page; for a single
|
|
536
|
-
change, a plain \`flypod update\` is simpler.
|
|
537
|
-
|
|
538
521
|
### Let a reviewer compare versions
|
|
539
522
|
|
|
540
523
|
\`\`\`sh
|
|
@@ -577,11 +560,6 @@ Every site also answers \`/llms.txt\` with a list of its pages, generated from
|
|
|
577
560
|
the deploy unless the folder ships its own. Another agent handed the URL can
|
|
578
561
|
start there; you do not need to write the file.
|
|
579
562
|
|
|
580
|
-
A pasted link unfurls with the page's title, description and a preview card
|
|
581
|
-
drawn from them, unless the page sets its own \`og:\` tags. Give each page a
|
|
582
|
-
real \`<title>\` and a first paragraph that says what it is, and the link looks
|
|
583
|
-
finished wherever the user shares it; you do not need to make an image.
|
|
584
|
-
|
|
585
563
|
## Deeper reference
|
|
586
564
|
|
|
587
565
|
Open these when the task calls for them.
|
|
@@ -19,10 +19,6 @@ export interface CommandIO {
|
|
|
19
19
|
* what it has always been.
|
|
20
20
|
*/
|
|
21
21
|
interactive?: boolean;
|
|
22
|
-
/** Ends a `--watch` loop when aborted. Tests inject one; the binary uses Ctrl+C. */
|
|
23
|
-
signal?: AbortSignal;
|
|
24
|
-
/** How often `--watch` looks at the folder. Tests shorten it; see ./watch.ts for the default. */
|
|
25
|
-
watchPollMs?: number;
|
|
26
22
|
/** Open a URL in the default browser. Tests inject a no-op. */
|
|
27
23
|
openUrl?: (url: string) => Promise<void>;
|
|
28
24
|
/**
|
|
@@ -50,7 +46,7 @@ export declare function claim(args: {
|
|
|
50
46
|
token?: string;
|
|
51
47
|
json?: boolean;
|
|
52
48
|
}, io: CommandIO): Promise<number>;
|
|
53
|
-
|
|
49
|
+
export declare function update(args: {
|
|
54
50
|
path?: string;
|
|
55
51
|
site?: string;
|
|
56
52
|
token?: string;
|
|
@@ -59,23 +55,11 @@ interface UpdateArgs {
|
|
|
59
55
|
help?: boolean;
|
|
60
56
|
/** The full receipt instead of the short default. See receipt.ts. */
|
|
61
57
|
verbose?: boolean;
|
|
62
|
-
/** Keep running and redeploy whenever the folder changes. See ./watch.ts. */
|
|
63
|
-
watch?: boolean;
|
|
64
58
|
/** Turn the version timeline on (`true`) or off (`false`); unset leaves it alone. */
|
|
65
59
|
timeline?: boolean;
|
|
66
|
-
}
|
|
60
|
+
}, io: CommandIO): Promise<number>;
|
|
67
61
|
/** What the screen says after `--timeline` / `--no-timeline`. */
|
|
68
62
|
export declare function timelineRows(asked: boolean, now: boolean, s: TailStyle): string[];
|
|
69
|
-
export declare function update(args: UpdateArgs, io: CommandIO): Promise<number>;
|
|
70
|
-
/**
|
|
71
|
-
* Carry on from a first deploy made with `flypod --watch`: the site exists
|
|
72
|
-
* and has just been published, so this only watches. `state` is what that
|
|
73
|
-
* deploy read from disk.
|
|
74
|
-
*/
|
|
75
|
-
export declare function watchSite(args: UpdateArgs, io: CommandIO, state: {
|
|
76
|
-
baseline: string | null;
|
|
77
|
-
shipped: string | null;
|
|
78
|
-
}): Promise<number>;
|
|
79
63
|
export declare function versions(args: {
|
|
80
64
|
site?: string;
|
|
81
65
|
token?: string;
|
package/dist/src/cli.js
CHANGED
package/package.json
CHANGED
package/dist/src/cli/watch.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A fingerprint of what is on disk at `path` (a folder or a single file):
|
|
3
|
-
* every file's name, size and modification time. Null when there is nothing
|
|
4
|
-
* to deploy there right now — the path is missing or the folder is empty,
|
|
5
|
-
* which is what the middle of a build looks like.
|
|
6
|
-
*/
|
|
7
|
-
export declare function snapshot(path: string): Promise<string | null>;
|
|
8
|
-
/**
|
|
9
|
-
* A fingerprint of the content about to be deployed. A save that changes
|
|
10
|
-
* nothing (an editor rewriting the same bytes, a build that produced identical
|
|
11
|
-
* output) changes the snapshot above but not this, and is not worth a deploy.
|
|
12
|
-
*/
|
|
13
|
-
export declare function contentKey(files: Record<string, Uint8Array>): string;
|
|
14
|
-
export interface WatchLoopOptions {
|
|
15
|
-
/** The snapshot of what was last deployed, taken before that deploy read the folder. */
|
|
16
|
-
baseline: string | null;
|
|
17
|
-
snapshot(): Promise<string | null>;
|
|
18
|
-
/**
|
|
19
|
-
* Publish what is on disk now. `"retry"` means it failed for a reason that
|
|
20
|
-
* may pass (the network, a rate limit) and the same content should be tried
|
|
21
|
-
* again; anything else is final until the folder changes.
|
|
22
|
-
*/
|
|
23
|
-
ship(): Promise<"done" | "retry">;
|
|
24
|
-
/** Stops the loop. */
|
|
25
|
-
signal: AbortSignal;
|
|
26
|
-
/** Injected by tests. */
|
|
27
|
-
sleep?: (ms: number) => Promise<void>;
|
|
28
|
-
pollMs?: number;
|
|
29
|
-
retryMs?: number;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Poll until stopped, shipping each time the folder has changed and then held
|
|
33
|
-
* still for one tick.
|
|
34
|
-
*
|
|
35
|
-
* "Held still" is the debounce: a build writes its files over a second or
|
|
36
|
-
* two, and deploying the first half of one publishes a broken site. A folder
|
|
37
|
-
* that reads the same on two consecutive ticks has finished changing.
|
|
38
|
-
*/
|
|
39
|
-
export declare function watchLoop(opts: WatchLoopOptions): Promise<void>;
|