drop2run 0.1.2 → 0.2.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/dist/index.js CHANGED
@@ -299,6 +299,56 @@ function isDocumentPath(path) {
299
299
  const lower = path.toLowerCase();
300
300
  return DOCUMENT_EXTENSIONS.some((extension) => lower.endsWith(extension));
301
301
  }
302
+ const VIEWABLE_EXTENSIONS = [
303
+ // Documents — these also count at any depth, via DOCUMENT_EXTENSIONS.
304
+ ".md",
305
+ ".markdown",
306
+ ".pdf",
307
+ // Prose the reader shows preformatted.
308
+ ".txt",
309
+ ".log",
310
+ ".csv",
311
+ // Source the reader shows with highlighting.
312
+ ".json",
313
+ ".yaml",
314
+ ".yml",
315
+ ".toml",
316
+ ".css",
317
+ ".js",
318
+ ".ts",
319
+ ".tsx",
320
+ ".jsx",
321
+ ".sh",
322
+ ".xml",
323
+ // Pictures the reader shows with an img element.
324
+ ".png",
325
+ ".jpg",
326
+ ".jpeg",
327
+ ".gif",
328
+ ".webp",
329
+ ".avif",
330
+ ".svg",
331
+ ".ico",
332
+ // See the note above: a floor for a caller that did not rename it.
333
+ ".html",
334
+ ".htm"
335
+ ];
336
+ function isViewablePath(path) {
337
+ const lower = path.toLowerCase();
338
+ return VIEWABLE_EXTENSIONS.some((extension) => lower.endsWith(extension));
339
+ }
340
+ function canPublish(paths) {
341
+ if (paths.some((path) => path === REQUIRED_INDEX)) return true;
342
+ if (paths.some(isDocumentPath)) return true;
343
+ return paths.length === 1 && paths[0] !== void 0 && isViewablePath(paths[0]);
344
+ }
345
+ function renameOfLoneHtmlPage(paths) {
346
+ if (paths.length !== 1) return null;
347
+ const [only] = paths;
348
+ if (only === void 0 || only === REQUIRED_INDEX) return null;
349
+ const lower = only.toLowerCase();
350
+ return lower.endsWith(".html") || lower.endsWith(".htm") ? only : null;
351
+ }
302
352
  function formatBytes(bytes) {
303
353
  if (bytes < 1024) return `${bytes} B`;
304
354
  if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
@@ -312,11 +362,10 @@ function checkLimits(files, limits) {
312
362
  "That drop contained no files to deploy. Folders like .git and node_modules are skipped."
313
363
  );
314
364
  }
315
- const hasIndex = files.some((file) => file.path === REQUIRED_INDEX);
316
- if (!hasIndex && !files.some((file) => isDocumentPath(file.path))) {
365
+ if (!canPublish(files.map((file) => file.path))) {
317
366
  throw new DeployError(
318
367
  ClientErrorCode.MissingIndex,
319
- `A site needs an ${REQUIRED_INDEX} at its top level, or at least one .md or .pdf file to publish as a documents site. Drop the folder that contains it, not the folder above.`
368
+ `A site needs an ${REQUIRED_INDEX} at its top level, or at least one .md or .pdf file to publish as a documents site — or be a single file that can be displayed on its own, such as a note, a PDF, a page or an image. Drop the folder that contains it, not the folder above.`
320
369
  );
321
370
  }
322
371
  if (!limits) return;
@@ -327,9 +376,7 @@ function checkLimits(files, limits) {
327
376
  { limit: limits.maxFiles, actual: files.length }
328
377
  );
329
378
  }
330
- const oversized = files.find(
331
- (file) => file.bytes.length > limits.maxFileBytes
332
- );
379
+ const oversized = files.find((file) => file.bytes.length > limits.maxFileBytes);
333
380
  if (oversized) {
334
381
  throw new DeployError(
335
382
  ClientErrorCode.FileTooLarge,
@@ -558,8 +605,10 @@ function asDeployError(error) {
558
605
  }
559
606
  async function deploy(source, siteId, onProgress, signal, options = {}) {
560
607
  try {
561
- const files = await source(signal);
562
- onProgress({ type: "collecting", files: files.length });
608
+ const collected = await source(signal);
609
+ onProgress({ type: "collecting", files: collected.length });
610
+ const rename = renameOfLoneHtmlPage(collected.map((file) => file.path));
611
+ const files = rename === null ? collected : collected.map((file) => file.path === rename ? { ...file, path: "index.html" } : file);
563
612
  const hashed = await hashAll(
564
613
  files,
565
614
  (done, total) => onProgress({ type: "hashing", done, total }),
@@ -1191,7 +1240,7 @@ async function run(argv) {
1191
1240
  const positional = argv.filter((argument) => !argument.startsWith("-"));
1192
1241
  const [command, ...rest] = positional;
1193
1242
  if (argv.includes("--version")) {
1194
- const { version } = await import("./package-RiuDiPsO.js").then(
1243
+ const { version } = await import("./package-C6bEGZf_.js").then(
1195
1244
  (module) => module.default
1196
1245
  );
1197
1246
  return { text: version, json: { version }, code: 0 };
@@ -1,5 +1,5 @@
1
1
  const name = "drop2run";
2
- const version = "0.1.2";
2
+ const version = "0.2.0";
3
3
  const description = "Publish a static site to Drop2Run from the command line.";
4
4
  const license = "MIT";
5
5
  const type = "module";
@@ -8,7 +8,9 @@ const files = ["bin", "dist"];
8
8
  const engines = { "node": ">=20" };
9
9
  const publishConfig = { "access": "public" };
10
10
  const homepage = "https://dropto.run";
11
- const keywords = ["static-site", "deploy", "hosting", "cli"];
11
+ const repository = { "type": "git", "url": "git+https://github.com/Drop-to-run/drop2run-cli.git" };
12
+ const bugs = { "url": "https://github.com/Drop-to-run/drop2run-cli/issues" };
13
+ const keywords = ["static-site", "deploy", "hosting", "cli", "ai", "claude", "agent", "llm"];
12
14
  const scripts = { "prepublishOnly": "npm run build && npm test", "build": "vite build", "typecheck": "tsc --noEmit", "test": "vitest run", "lint": "biome check .", "format": "biome check --write ." };
13
15
  const devDependencies = { "@biomejs/biome": "^2.5.11", "@types/node": "^26.4.0", "typescript": "^5.9.3", "vite": "^7.2.1", "vitest": "^4.1.11" };
14
16
  const _package = {
@@ -22,12 +24,15 @@ const _package = {
22
24
  engines,
23
25
  publishConfig,
24
26
  homepage,
27
+ repository,
28
+ bugs,
25
29
  keywords,
26
30
  scripts,
27
31
  devDependencies
28
32
  };
29
33
  export {
30
34
  bin,
35
+ bugs,
31
36
  _package as default,
32
37
  description,
33
38
  devDependencies,
@@ -38,6 +43,7 @@ export {
38
43
  license,
39
44
  name,
40
45
  publishConfig,
46
+ repository,
41
47
  scripts,
42
48
  type,
43
49
  version
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drop2run",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "Publish a static site to Drop2Run from the command line.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -18,11 +18,22 @@
18
18
  "access": "public"
19
19
  },
20
20
  "homepage": "https://dropto.run",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/Drop-to-run/drop2run-cli.git"
24
+ },
25
+ "bugs": {
26
+ "url": "https://github.com/Drop-to-run/drop2run-cli/issues"
27
+ },
21
28
  "keywords": [
22
29
  "static-site",
23
30
  "deploy",
24
31
  "hosting",
25
- "cli"
32
+ "cli",
33
+ "ai",
34
+ "claude",
35
+ "agent",
36
+ "llm"
26
37
  ],
27
38
  "scripts": {
28
39
  "prepublishOnly": "npm run build && npm test",