flypod 0.15.0 → 0.16.1
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 +73 -13
- package/dist/bin/deploy.js +595 -244
- package/dist/{cli-xrnr1hed.js → cli-8h0vc7g2.js} +145 -16
- package/dist/src/cli/commands.d.ts +14 -0
- package/dist/src/cli/errors.d.ts +1 -0
- package/dist/src/cli/limits.d.ts +7 -0
- package/dist/src/cli/projects.d.ts +25 -1
- package/dist/src/cli/receipt.d.ts +10 -0
- package/dist/src/cli.d.ts +38 -2
- package/dist/src/cli.js +7 -1
- package/dist/src/ingest-error.d.ts +23 -0
- package/dist/src/ui.d.ts +27 -0
- package/dist/src/upload-limits.d.ts +25 -0
- package/package.json +10 -10
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/cli.ts
|
|
2
|
-
import { readdir, readFile as readFile3, stat as stat2 } from "node:fs/promises";
|
|
3
|
-
import { join as join3, relative } from "node:path";
|
|
2
|
+
import { readdir, readFile as readFile3, realpath, stat as stat2 } from "node:fs/promises";
|
|
3
|
+
import { join as join3, relative, sep } from "node:path";
|
|
4
4
|
|
|
5
5
|
// src/deploy-source.ts
|
|
6
6
|
var SOURCE_HEADER = "x-flypod-source";
|
|
@@ -245,6 +245,11 @@ npx flypod ./dist --comments --json # mode: anonymous
|
|
|
245
245
|
npx flypod ./dist --comments --mode approved --json
|
|
246
246
|
\`\`\`
|
|
247
247
|
|
|
248
|
+
This needs a signed-in deploy. Without one the site still deploys, and the
|
|
249
|
+
receipt says \`"comments_enabled": false, "comments_skipped": "not_signed_in"\`
|
|
250
|
+
— tell the user comments are off, and that \`flypod login\` then
|
|
251
|
+
\`flypod comments enable\` turns them on.
|
|
252
|
+
|
|
248
253
|
On a site that already exists:
|
|
249
254
|
|
|
250
255
|
\`\`\`sh
|
|
@@ -316,7 +321,7 @@ var troubleshootingReference = {
|
|
|
316
321
|
| \`1\` | runtime error you can act on — no build folder, site gone, upload rejected or blocked |
|
|
317
322
|
| \`2\` | usage error — unknown flag or bad arguments, or a login that needs a browser |
|
|
318
323
|
| \`3\` | auth — not signed in, credential refused (\`token_rejected\`), sign-in denied |
|
|
319
|
-
| \`4\` | retryable — rate limited, server 5xx, network failure, sign-in still pending |
|
|
324
|
+
| \`4\` | retryable — rate limited, server 5xx, network failure (including a proxy refusing the request), sign-in still pending |
|
|
320
325
|
|
|
321
326
|
The exit code follows the failure's \`code\`, on every verb. With \`--json\`, every
|
|
322
327
|
failure prints one line on stdout and nothing on stderr:
|
|
@@ -331,7 +336,15 @@ step when there is one. Codes you will meet: \`no_build_dir\`, \`no_files\`,
|
|
|
331
336
|
\`invalid_upload\`, \`too_large\`, \`blocked\`, \`challenge_required\`,
|
|
332
337
|
\`rate_limited\`, \`server_error\`, \`network\`, \`unknown_flag\`, \`usage\`.
|
|
333
338
|
|
|
334
|
-
|
|
339
|
+
\`usage\` includes a value flag given no value (\`--site needs a value\`) and a
|
|
340
|
+
\`--mode\` that is not \`anonymous\`, \`passcode\` or \`approved\`. \`unknown_flag\`
|
|
341
|
+
names the closest real flag when there is one. \`no_build_dir\` also covers a
|
|
342
|
+
path that does not exist. \`too_large\` is checked before uploading to flypod.dev
|
|
343
|
+
(at most 200 files, 10 MB of files, 12 MB as an upload) and names the largest files.
|
|
344
|
+
|
|
345
|
+
Rarer ones: \`unknown_command\` (a verb that does not exist — \`flypod verisons\`
|
|
346
|
+
fails this way with \`"fix": "flypod versions"\` instead of deploying a folder
|
|
347
|
+
called \`verisons\` — or a \`flypod comments\` verb that does not exist),
|
|
335
348
|
\`no_such_version\` (nothing to roll back to), \`no_token\` (\`flypod token\` on a
|
|
336
349
|
site this machine holds no manage token for), \`already_claimed\`, \`not_found\`,
|
|
337
350
|
\`bad_request\` (any other 4xx), \`unexpected\`, and from the login flow
|
|
@@ -392,8 +405,13 @@ it would otherwise outlive.
|
|
|
392
405
|
## Getting the full command surface
|
|
393
406
|
|
|
394
407
|
\`flypod --help\` is authoritative and current; so is \`--help\` on any subcommand
|
|
395
|
-
(\`update\`, \`versions\`, \`rollback\`, \`forget\`, \`token\`, \`login\`
|
|
396
|
-
than guessing at a
|
|
408
|
+
(\`update\`, \`versions\`, \`rollback\`, \`forget\`, \`token\`, \`login\`, \`logout\`,
|
|
409
|
+
\`list\`, \`claim\`, \`install\`, \`comments\`). Read it rather than guessing at a
|
|
410
|
+
flag. Help never runs the command: it prints on stdout and exits 0, and with
|
|
411
|
+
\`--json\` it is one line, \`{"ok":true,"help":"…"}\`.
|
|
412
|
+
|
|
413
|
+
To install this skill into another project without a prompt:
|
|
414
|
+
\`npx flypod install skill --yes\` (\`-y\`; the same as \`--all\`).
|
|
397
415
|
`
|
|
398
416
|
};
|
|
399
417
|
var REFERENCES = [
|
|
@@ -463,6 +481,10 @@ is the normal path rather than a fallback. To install once: \`npm install -g fly
|
|
|
463
481
|
commands carry \`--site <id>\` and the receipt also has a \`manage_token\`:
|
|
464
482
|
that is the only copy, so pass it as \`--token\` on later commands and keep it
|
|
465
483
|
out of chat, commits, logs, and PR descriptions.
|
|
484
|
+
- \`skipped\` — present only when flypod left something out: \`.env\`,
|
|
485
|
+
\`.env.*\`, \`.git\`, \`node_modules\` and OS litter never upload, nor does
|
|
486
|
+
anything matched by a \`.flypodignore\` in the folder. Each entry has a
|
|
487
|
+
\`path\` and a \`reason\`. If the site needs a file listed here, tell the user.
|
|
466
488
|
|
|
467
489
|
The receipt carries no credentials otherwise; the CLI has saved what it needs,
|
|
468
490
|
keyed by the folder you deployed from. \`--json --verbose\` adds tokens, file
|
|
@@ -1507,24 +1529,131 @@ async function resolveDeployDir(opts = {}) {
|
|
|
1507
1529
|
}
|
|
1508
1530
|
throw new Error(`No build output folder found. Looked for ${BUILD_DIR_CANDIDATES.join(", ")} ` + `(each must contain an index.html). Pass the folder explicitly, e.g. \`npx flypod ./dist\`.`);
|
|
1509
1531
|
}
|
|
1510
|
-
|
|
1532
|
+
var DEFAULT_IGNORES = [
|
|
1533
|
+
".git",
|
|
1534
|
+
".hg",
|
|
1535
|
+
".svn",
|
|
1536
|
+
"node_modules",
|
|
1537
|
+
".DS_Store",
|
|
1538
|
+
"Thumbs.db",
|
|
1539
|
+
".env",
|
|
1540
|
+
".env.*"
|
|
1541
|
+
];
|
|
1542
|
+
var IGNORE_FILE = ".flypodignore";
|
|
1543
|
+
function compileRule(line, source) {
|
|
1544
|
+
let pattern = line.trim();
|
|
1545
|
+
if (pattern === "" || pattern.startsWith("#"))
|
|
1546
|
+
return null;
|
|
1547
|
+
const negate = pattern.startsWith("!");
|
|
1548
|
+
if (negate)
|
|
1549
|
+
pattern = pattern.slice(1);
|
|
1550
|
+
const dirOnly = pattern.endsWith("/");
|
|
1551
|
+
if (dirOnly)
|
|
1552
|
+
pattern = pattern.slice(0, -1);
|
|
1553
|
+
const anchored = pattern.includes("/");
|
|
1554
|
+
if (pattern.startsWith("/"))
|
|
1555
|
+
pattern = pattern.slice(1);
|
|
1556
|
+
if (pattern === "")
|
|
1557
|
+
return null;
|
|
1558
|
+
let body = "";
|
|
1559
|
+
for (let i2 = 0;i2 < pattern.length; i2++) {
|
|
1560
|
+
const ch = pattern[i2];
|
|
1561
|
+
if (ch === "*" && pattern[i2 + 1] === "*") {
|
|
1562
|
+
if (pattern[i2 + 2] === "/") {
|
|
1563
|
+
body += "(?:.*/)?";
|
|
1564
|
+
i2 += 2;
|
|
1565
|
+
} else {
|
|
1566
|
+
body += ".*";
|
|
1567
|
+
i2 += 1;
|
|
1568
|
+
}
|
|
1569
|
+
} else if (ch === "*")
|
|
1570
|
+
body += "[^/]*";
|
|
1571
|
+
else if (ch === "?")
|
|
1572
|
+
body += "[^/]";
|
|
1573
|
+
else
|
|
1574
|
+
body += ch.replace(/[.+^${}()|[\]\\]/g, "\\$&");
|
|
1575
|
+
}
|
|
1576
|
+
const re = new RegExp(anchored ? `^${body}$` : `(?:^|/)${body}$`);
|
|
1577
|
+
return { re, negate, dirOnly, source };
|
|
1578
|
+
}
|
|
1579
|
+
function ignoredBy(rules, rel, isDir) {
|
|
1580
|
+
let verdict = null;
|
|
1581
|
+
for (const rule of rules) {
|
|
1582
|
+
if (rule.dirOnly && !isDir)
|
|
1583
|
+
continue;
|
|
1584
|
+
if (rule.re.test(rel))
|
|
1585
|
+
verdict = rule.negate ? null : rule.source;
|
|
1586
|
+
}
|
|
1587
|
+
return verdict;
|
|
1588
|
+
}
|
|
1589
|
+
async function collectFiles(path) {
|
|
1511
1590
|
const info = await stat2(path);
|
|
1512
1591
|
if (info.isFile()) {
|
|
1513
1592
|
const name = path.split("/").pop() ?? "index.html";
|
|
1514
|
-
return { [name]: await readFile3(path) };
|
|
1593
|
+
return { files: { [name]: await readFile3(path) }, skipped: [] };
|
|
1515
1594
|
}
|
|
1595
|
+
const rules = DEFAULT_IGNORES.map((p) => compileRule(p, "default"));
|
|
1596
|
+
try {
|
|
1597
|
+
const text = await readFile3(join3(path, IGNORE_FILE), "utf8");
|
|
1598
|
+
for (const line of text.split(/\r?\n/)) {
|
|
1599
|
+
const rule = compileRule(line, "flypodignore");
|
|
1600
|
+
if (rule)
|
|
1601
|
+
rules.push(rule);
|
|
1602
|
+
}
|
|
1603
|
+
} catch {}
|
|
1604
|
+
const root = await realpath(path);
|
|
1516
1605
|
const files = {};
|
|
1517
|
-
|
|
1606
|
+
const skipped = [];
|
|
1607
|
+
const active = new Set([root]);
|
|
1608
|
+
async function walk(current, currentReal) {
|
|
1518
1609
|
for (const entry of await readdir(current, { withFileTypes: true })) {
|
|
1519
1610
|
const full = join3(current, entry.name);
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1611
|
+
const rel = relative(path, full).split("\\").join("/");
|
|
1612
|
+
if (rel === IGNORE_FILE)
|
|
1613
|
+
continue;
|
|
1614
|
+
let isDir = entry.isDirectory();
|
|
1615
|
+
let real;
|
|
1616
|
+
if (entry.isSymbolicLink()) {
|
|
1617
|
+
try {
|
|
1618
|
+
real = await realpath(full);
|
|
1619
|
+
isDir = (await stat2(real)).isDirectory();
|
|
1620
|
+
} catch {
|
|
1621
|
+
skipped.push({ path: rel, reason: "broken_symlink" });
|
|
1622
|
+
continue;
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
const reason = ignoredBy(rules, rel, isDir);
|
|
1626
|
+
if (reason) {
|
|
1627
|
+
skipped.push({ path: isDir ? `${rel}/` : rel, reason });
|
|
1628
|
+
continue;
|
|
1629
|
+
}
|
|
1630
|
+
if (isDir) {
|
|
1631
|
+
const childReal = real ?? join3(currentReal, entry.name);
|
|
1632
|
+
if (real !== undefined) {
|
|
1633
|
+
const inside = real === root || real.startsWith(`${root}${sep}`);
|
|
1634
|
+
if (!inside) {
|
|
1635
|
+
skipped.push({ path: `${rel}/`, reason: "symlink_outside" });
|
|
1636
|
+
continue;
|
|
1637
|
+
}
|
|
1638
|
+
if (active.has(real)) {
|
|
1639
|
+
skipped.push({ path: `${rel}/`, reason: "symlink_loop" });
|
|
1640
|
+
continue;
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
active.add(childReal);
|
|
1644
|
+
await walk(full, childReal);
|
|
1645
|
+
active.delete(childReal);
|
|
1646
|
+
} else {
|
|
1647
|
+
files[rel] = await readFile3(full);
|
|
1648
|
+
}
|
|
1524
1649
|
}
|
|
1525
1650
|
}
|
|
1526
|
-
await walk(path);
|
|
1527
|
-
|
|
1651
|
+
await walk(path, root);
|
|
1652
|
+
skipped.sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
|
|
1653
|
+
return { files, skipped };
|
|
1654
|
+
}
|
|
1655
|
+
async function collectDist(path) {
|
|
1656
|
+
return (await collectFiles(path)).files;
|
|
1528
1657
|
}
|
|
1529
1658
|
function envSource() {
|
|
1530
1659
|
const value = globalThis.process?.env?.FLYPOD_SOURCE;
|
|
@@ -1570,4 +1699,4 @@ class DeployError extends Error {
|
|
|
1570
1699
|
}
|
|
1571
1700
|
}
|
|
1572
1701
|
|
|
1573
|
-
export { projectsFilePath, atomicWriteFile, saveSession, clearSession, installSkill, resolveCredentials, createClient, packDeploy, BUILD_DIR_CANDIDATES, resolveDeployDir, collectDist, deploySite, DeployError };
|
|
1702
|
+
export { projectsFilePath, atomicWriteFile, saveSession, clearSession, installSkill, resolveCredentials, createClient, packDeploy, BUILD_DIR_CANDIDATES, resolveDeployDir, DEFAULT_IGNORES, IGNORE_FILE, collectFiles, collectDist, deploySite, DeployError };
|
|
@@ -30,6 +30,17 @@ export interface CommandIO {
|
|
|
30
30
|
*/
|
|
31
31
|
style?: TailStyle;
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Print help text: always on stdout and always exit 0, for every verb, so
|
|
35
|
+
* `flypod <verb> --help | less` works everywhere. Under `--json` the text
|
|
36
|
+
* rides in one line of JSON instead, so the `--json` contract (one line of
|
|
37
|
+
* JSON on stdout, nothing on stderr) holds even for help.
|
|
38
|
+
*/
|
|
39
|
+
export declare function emitHelp(text: string, args: {
|
|
40
|
+
json?: boolean;
|
|
41
|
+
}, io: Pick<CommandIO, "out">): number;
|
|
42
|
+
/** The help text for a verb, or undefined. */
|
|
43
|
+
export declare function subcommandHelp(name: string): string | undefined;
|
|
33
44
|
export declare function login(args: {
|
|
34
45
|
token?: string;
|
|
35
46
|
deviceCode?: string;
|
|
@@ -38,14 +49,17 @@ export declare function login(args: {
|
|
|
38
49
|
}, io: CommandIO): Promise<number>;
|
|
39
50
|
export declare function logout(args: {
|
|
40
51
|
json?: boolean;
|
|
52
|
+
help?: boolean;
|
|
41
53
|
}, io: CommandIO): Promise<number>;
|
|
42
54
|
export declare function list(args: {
|
|
43
55
|
json?: boolean;
|
|
56
|
+
help?: boolean;
|
|
44
57
|
}, io: CommandIO): Promise<number>;
|
|
45
58
|
export declare function claim(args: {
|
|
46
59
|
site_id?: string;
|
|
47
60
|
token?: string;
|
|
48
61
|
json?: boolean;
|
|
62
|
+
help?: boolean;
|
|
49
63
|
}, io: CommandIO): Promise<number>;
|
|
50
64
|
export declare function update(args: {
|
|
51
65
|
path?: string;
|
package/dist/src/cli/errors.d.ts
CHANGED
|
@@ -44,6 +44,7 @@ export declare function fail(code: ErrorCode, error: string, args: {
|
|
|
44
44
|
export declare function readServerMessage(res: Response): Promise<{
|
|
45
45
|
message: string;
|
|
46
46
|
code?: string;
|
|
47
|
+
json?: boolean;
|
|
47
48
|
}>;
|
|
48
49
|
export interface ClassifyContext {
|
|
49
50
|
/** `flypod update`, `flypod comments post`, … — for the human prefix. */
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { UploadLimits } from "../ingest-error";
|
|
2
|
+
import type { CliError } from "./errors";
|
|
3
|
+
/**
|
|
4
|
+
* `too_large` with the limit and the biggest files named, or null when the
|
|
5
|
+
* build fits or the limits are unknown (`uploadLimitsFor` returned null).
|
|
6
|
+
*/
|
|
7
|
+
export declare function checkUploadSize(files: Record<string, Uint8Array>, limits: UploadLimits | null): CliError | null;
|
|
@@ -25,10 +25,34 @@ export declare const MAX_PROJECTS = 64;
|
|
|
25
25
|
export declare function loadProjects(env?: NodeJS.ProcessEnv): Promise<Record<string, ProjectRecord>>;
|
|
26
26
|
/** Persist the registry, pruning expired entries and LRU-capping the size. */
|
|
27
27
|
export declare function saveProjects(projects: Record<string, ProjectRecord>, env?: NodeJS.ProcessEnv): Promise<string>;
|
|
28
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Key prefix for a record no folder points at any more. Registry keys are
|
|
30
|
+
* otherwise absolute directories, so `detached:<site_id>` can never collide
|
|
31
|
+
* with one, and every reader that scans the values — `flypod login`'s
|
|
32
|
+
* claim-all, `flypod token --site`, `--site <id>` on the version verbs, the
|
|
33
|
+
* expiry prune and the eviction order in `cap` — handles it with no special
|
|
34
|
+
* case.
|
|
35
|
+
*/
|
|
36
|
+
export declare const DETACHED_PREFIX = "detached:";
|
|
37
|
+
/**
|
|
38
|
+
* Link (or repoint) a directory to a site.
|
|
39
|
+
*
|
|
40
|
+
* Repointing used to overwrite the old record, and with it the old site's
|
|
41
|
+
* manage token — the one credential for a site that is still live and still
|
|
42
|
+
* unclaimed, which the server cannot re-issue. Running `flypod` twice in one
|
|
43
|
+
* folder therefore made the first site impossible to update or to keep with
|
|
44
|
+
* `flypod login`. The replaced record is now kept, detached from the folder,
|
|
45
|
+
* until the site expires or is claimed. See docs/ownership.md.
|
|
46
|
+
*/
|
|
29
47
|
export declare function linkProject(dir: string, rec: ProjectRecord, env?: NodeJS.ProcessEnv): Promise<void>;
|
|
30
48
|
/** The site linked to a directory, or null. */
|
|
31
49
|
export declare function projectForDir(dir: string, env?: NodeJS.ProcessEnv): Promise<ProjectRecord | null>;
|
|
50
|
+
/**
|
|
51
|
+
* Any record this machine holds for a site id — a folder link first, then a
|
|
52
|
+
* detached record — or null. This is how `--site <id>` finds the manage token
|
|
53
|
+
* of a site whose folder has since been pointed somewhere else.
|
|
54
|
+
*/
|
|
55
|
+
export declare function projectForSite(site_id: string, env?: NodeJS.ProcessEnv): Promise<ProjectRecord | null>;
|
|
32
56
|
/** Forget the link for a directory. Returns whether anything was removed. */
|
|
33
57
|
export declare function forgetDir(dir: string, env?: NodeJS.ProcessEnv): Promise<boolean>;
|
|
34
58
|
/** Forget every link pointing at a site id. Returns how many were removed. */
|
|
@@ -149,6 +149,16 @@ export declare function relinkNotice(prev: {
|
|
|
149
149
|
site_id: string;
|
|
150
150
|
url: string;
|
|
151
151
|
}, style?: TailStyle): string[];
|
|
152
|
+
/**
|
|
153
|
+
* What a deploy left out (see `collectFiles` in ../cli.ts). Said every time,
|
|
154
|
+
* because a file that silently is not there reads as a broken site; and said
|
|
155
|
+
* as a notice, not a failure, because leaving `.env` behind is the point. The
|
|
156
|
+
* `--json` receipt carries the same list as `skipped`.
|
|
157
|
+
*/
|
|
158
|
+
export declare function skippedRows(skipped: ReadonlyArray<{
|
|
159
|
+
path: string;
|
|
160
|
+
reason: string;
|
|
161
|
+
}>, style?: TailStyle): string[];
|
|
152
162
|
/**
|
|
153
163
|
* The folder link could not be saved, so the person is the only holder of the
|
|
154
164
|
* site's token (docs/ownership.md). The one moment a token belongs on screen:
|
package/dist/src/cli.d.ts
CHANGED
|
@@ -15,8 +15,44 @@ export declare function resolveDeployDir(opts?: {
|
|
|
15
15
|
explicit?: string;
|
|
16
16
|
}): Promise<string>;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
18
|
+
* Names that are never part of a website and are skipped wherever they sit in
|
|
19
|
+
* the tree. Uploading a folder used to mean uploading *everything* in it, so a
|
|
20
|
+
* deploy run from a project root (or a build tool that copies `.env` into
|
|
21
|
+
* `dist/`) published secrets and version-control history at a public URL.
|
|
22
|
+
*
|
|
23
|
+
* Deliberately short: each entry is something no static site serves on
|
|
24
|
+
* purpose. Other dotfiles stay — `.well-known/` is how a site proves domain
|
|
25
|
+
* ownership and serves security.txt, and `.nojekyll`/`_headers` are ordinary
|
|
26
|
+
* build output. A `.flypodignore` in the folder adds to this list.
|
|
27
|
+
*/
|
|
28
|
+
export declare const DEFAULT_IGNORES: readonly [".git", ".hg", ".svn", "node_modules", ".DS_Store", "Thumbs.db", ".env", ".env.*"];
|
|
29
|
+
/** The optional per-folder ignore file. Read, honoured, and never uploaded. */
|
|
30
|
+
export declare const IGNORE_FILE = ".flypodignore";
|
|
31
|
+
/** A path left out of a deploy, and why. Directories end in `/`. */
|
|
32
|
+
export interface SkippedPath {
|
|
33
|
+
path: string;
|
|
34
|
+
reason: "default" | "flypodignore" | "symlink_outside" | "symlink_loop" | "broken_symlink";
|
|
35
|
+
}
|
|
36
|
+
export interface CollectedFiles {
|
|
37
|
+
files: Record<string, Uint8Array>;
|
|
38
|
+
/** What was left out. Empty when nothing was. */
|
|
39
|
+
skipped: SkippedPath[];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Read files for a deploy, and report what was left out. Accepts either a
|
|
43
|
+
* directory (walked recursively) or a single file (deployed as the only file
|
|
44
|
+
* in the site; an explicitly named file is never filtered).
|
|
45
|
+
*
|
|
46
|
+
* Symlinks: a link to a file is read through (as it always was). A link to a
|
|
47
|
+
* directory is followed when it resolves inside the folder being deployed, and
|
|
48
|
+
* skipped — and reported — when it points outside it, so a stray link to a
|
|
49
|
+
* home directory cannot publish it. Broken links are skipped and reported.
|
|
50
|
+
* Before this, a linked directory failed the whole deploy with EISDIR.
|
|
51
|
+
*/
|
|
52
|
+
export declare function collectFiles(path: string): Promise<CollectedFiles>;
|
|
53
|
+
/**
|
|
54
|
+
* Read files for a deploy: `collectFiles` without the report. Applies the
|
|
55
|
+
* same defaults and `.flypodignore`, so a library caller is protected too.
|
|
20
56
|
*/
|
|
21
57
|
export declare function collectDist(path: string): Promise<Record<string, Uint8Array>>;
|
|
22
58
|
export interface DeployResult {
|
package/dist/src/cli.js
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BUILD_DIR_CANDIDATES,
|
|
3
|
+
DEFAULT_IGNORES,
|
|
3
4
|
DeployError,
|
|
5
|
+
IGNORE_FILE,
|
|
4
6
|
collectDist,
|
|
7
|
+
collectFiles,
|
|
5
8
|
deploySite,
|
|
6
9
|
resolveDeployDir
|
|
7
|
-
} from "../cli-
|
|
10
|
+
} from "../cli-8h0vc7g2.js";
|
|
8
11
|
export {
|
|
9
12
|
BUILD_DIR_CANDIDATES,
|
|
13
|
+
DEFAULT_IGNORES,
|
|
10
14
|
DeployError,
|
|
15
|
+
IGNORE_FILE,
|
|
11
16
|
collectDist,
|
|
17
|
+
collectFiles,
|
|
12
18
|
deploySite,
|
|
13
19
|
resolveDeployDir
|
|
14
20
|
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Split out of `deploy-pipeline.ts` so `unzip.ts` can throw these without the
|
|
3
|
+
* two modules importing each other. Nothing else about them changed, and
|
|
4
|
+
* `deploy-pipeline.ts` still re-exports both so existing imports keep working.
|
|
5
|
+
*/
|
|
6
|
+
export declare class IngestError extends Error {
|
|
7
|
+
status: number;
|
|
8
|
+
constructor(message: string, status: number);
|
|
9
|
+
}
|
|
10
|
+
/** A byte count the way a person reads a limit: "50 MB", "12.5 MB", "800 KB". */
|
|
11
|
+
export declare function formatBytes(n: number): string;
|
|
12
|
+
/**
|
|
13
|
+
* The 413 for an archive over `maxZipBytes`, naming the limit. `actual` is
|
|
14
|
+
* null when the upload was cut off mid-stream, before its size was known.
|
|
15
|
+
* The `too_large` code is what callers branch on; this is the prose beside it,
|
|
16
|
+
* and "upload too large" left a person guessing how far over they were.
|
|
17
|
+
*/
|
|
18
|
+
export declare function zipTooLarge(actual: number | null, limit: number): IngestError;
|
|
19
|
+
export interface UploadLimits {
|
|
20
|
+
maxFiles: number;
|
|
21
|
+
maxTotalBytes: number;
|
|
22
|
+
maxZipBytes: number;
|
|
23
|
+
}
|
package/dist/src/ui.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Honors NO_COLOR (https://no-color.org) and FORCE_COLOR; falls back to TTY. */
|
|
2
|
+
export declare function colorsEnabled(stream?: NodeJS.WriteStream): boolean;
|
|
3
|
+
export interface Style {
|
|
4
|
+
dim(s: string): string;
|
|
5
|
+
bold(s: string): string;
|
|
6
|
+
accent(s: string): string;
|
|
7
|
+
ok(s: string): string;
|
|
8
|
+
err(s: string): string;
|
|
9
|
+
/** Needs a look, did not fail. */
|
|
10
|
+
warn(s: string): string;
|
|
11
|
+
muted(s: string): string;
|
|
12
|
+
}
|
|
13
|
+
export declare function makeStyle(enabled: boolean): Style;
|
|
14
|
+
/** A spinner that animates on TTY (`⠋⠙⠹…`) and falls back to plain dots on pipe. */
|
|
15
|
+
export interface Spinner {
|
|
16
|
+
start(label: string): void;
|
|
17
|
+
update(label: string): void;
|
|
18
|
+
success(label: string): void;
|
|
19
|
+
fail(label: string): void;
|
|
20
|
+
stop(): void;
|
|
21
|
+
}
|
|
22
|
+
export declare function makeSpinner(stream?: NodeJS.WriteStream, style?: Style): Spinner;
|
|
23
|
+
export declare function fmtBytes(n: number): string;
|
|
24
|
+
export declare function fmtSeconds(ms: number): string;
|
|
25
|
+
export declare function fmtCount(n: number, singular: string): string;
|
|
26
|
+
/** Soft-mask a long token for display: `fl_abc…xyz`. */
|
|
27
|
+
export declare function maskToken(token: string, keep?: number): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { UploadLimits } from "./ingest-error";
|
|
2
|
+
/**
|
|
3
|
+
* The limits flypod.dev itself enforces, which are tighter than the
|
|
4
|
+
* self-host defaults (worker.ts passes them to `uploadLimitsFromEnv`;
|
|
5
|
+
* the CLI keeps its own copy so the published package never bundles the
|
|
6
|
+
* Worker;
|
|
7
|
+
* `test/cli-collect.test.ts` pins the two together).
|
|
8
|
+
*/
|
|
9
|
+
export declare const HOSTED_UPLOAD_LIMITS: UploadLimits;
|
|
10
|
+
/**
|
|
11
|
+
* Which limits to check before uploading to `baseUrl`, or null to leave it to
|
|
12
|
+
* the server. Only flypod.dev's limits are known for certain: a self-hosted
|
|
13
|
+
* server may raise them (UPLOAD_MAX_*), and a precheck against the defaults
|
|
14
|
+
* would then refuse a build that server accepts and name the wrong number.
|
|
15
|
+
*/
|
|
16
|
+
export declare function uploadLimitsFor(baseUrl: string): UploadLimits | null;
|
|
17
|
+
/**
|
|
18
|
+
* The exact size of the archive `packDeploy` builds for these files.
|
|
19
|
+
*
|
|
20
|
+
* The archive is stored, not deflated (see src/pack.ts), so its size is the
|
|
21
|
+
* bytes plus fixed per-entry headers: a 30-byte local header and a 46-byte
|
|
22
|
+
* central-directory entry, each carrying the UTF-8 name, and a 22-byte end
|
|
23
|
+
* record. Computing it beats packing twice.
|
|
24
|
+
*/
|
|
25
|
+
export declare function storedZipBytes(files: Record<string, Uint8Array>): number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flypod",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.1",
|
|
4
4
|
"description": "Zero-auth deploy primitive. Turns any folder into a live URL in one command. For AI agents and humans.",
|
|
5
5
|
"module": "./dist/src/cli.js",
|
|
6
6
|
"types": "./dist/src/cli.d.ts",
|
|
@@ -48,14 +48,14 @@
|
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@flypod/comments": "workspace:*",
|
|
51
|
-
"@libsql/client": "^0.17.
|
|
52
|
-
"@types/bun": "^1.4.
|
|
53
|
-
"better-auth": "1.
|
|
54
|
-
"drizzle-orm": "^0.45.
|
|
55
|
-
"hono": "^4.
|
|
56
|
-
"marked": "^18.
|
|
57
|
-
"playwright": "^1.
|
|
58
|
-
"typescript": "^
|
|
59
|
-
"wrangler": "^4.
|
|
51
|
+
"@libsql/client": "^0.17.4",
|
|
52
|
+
"@types/bun": "^1.4.3",
|
|
53
|
+
"better-auth": "1.7.10",
|
|
54
|
+
"drizzle-orm": "^0.45.4",
|
|
55
|
+
"hono": "^4.13.13",
|
|
56
|
+
"marked": "^18.1.1",
|
|
57
|
+
"playwright": "^1.64.1",
|
|
58
|
+
"typescript": "^7.0.2",
|
|
59
|
+
"wrangler": "^4.151.0"
|
|
60
60
|
}
|
|
61
61
|
}
|