Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
"@opentelemetry/core": "npm:@opentelemetry/core@^2.5.0",
"@opentelemetry/sdk-trace-base": "npm:@opentelemetry/sdk-trace-base@^2.5.0",
"@opentelemetry/semantic-conventions": "npm:@opentelemetry/semantic-conventions@^1.39.0",
"@optique/config": "jsr:@optique/config@^0.10.0",
"@optique/core": "jsr:@optique/core@^0.10.0",
"@optique/run": "jsr:@optique/run@^0.10.0",
"@optique/config": "jsr:@optique/config@^0.10.1",
"@optique/core": "jsr:@optique/core@^0.10.1",
"@optique/run": "jsr:@optique/run@^0.10.1",
"@std/assert": "jsr:@std/assert@^1.0.13",
"@std/async": "jsr:@std/async@^1.0.13",
"@std/encoding": "jsr:@std/encoding@^1.0.10",
Expand Down
24 changes: 12 additions & 12 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"test-init": "deno task test-init",
"pretest:bun": "pnpm build",
"test:bun": "bun test",
"run": "pnpm build && node dist/mod.js",
"runi": "tsdown && node dist/mod.js",
"run": "pnpm build && node --disable-warning=ExperimentalWarning dist/mod.js",
"runi": "tsdown && node --disable-warning=ExperimentalWarning dist/mod.js",
"run:bun": "pnpm build && bun dist/mod.js",
"runi:bun": "tsdown && bun dist/mod.js"
},
Expand Down Expand Up @@ -73,6 +73,7 @@
},
"dependencies": {
"@fedify/fedify": "workspace:*",
"@fedify/init": "workspace:*",
"@fedify/relay": "workspace:*",
"@fedify/sqlite": "workspace:*",
"@fedify/vocab": "workspace:*",
Expand Down
40 changes: 25 additions & 15 deletions packages/cli/src/mod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env node
#!/usr/bin/env node --disable-warning=ExperimentalWarning
import { runWithConfig } from "@optique/config/run";
import { merge, message, or } from "@optique/core";
import { printError } from "@optique/run";
Expand All @@ -21,6 +21,7 @@ import { globalOptions } from "./options.ts";
import { relayCommand, runRelay } from "./relay.ts";
import { runTunnel, tunnelCommand } from "./tunnel.ts";
import { runWebFinger, webFingerCommand } from "./webfinger/mod.ts";
import metadata from "../deno.json" with { type: "json" };

/**
* Returns the system-wide configuration file paths.
Expand Down Expand Up @@ -107,31 +108,40 @@ async function main() {
mode: "both",
onShow: () => process.exit(0),
},
version: {
mode: "both",
value: metadata.version,
},
completion: {
mode: "command",
name: "both",
},
onError: () => process.exit(1),
colors: process.stdout.isTTY &&
(process.env.NO_COLOR == null || process.env.NO_COLOR === ""),
maxWidth: process.stdout.columns,
showDefault: true,
showChoices: true,
});
if (result.command === "init") {
await runInit(result);
}
if (result.command === "lookup") {
} else if (result.command === "lookup") {
await runLookup(result);
}
if (result.command === "webfinger") {
} else if (result.command === "webfinger") {
await runWebFinger(result);
}
if (result.command === "inbox") {
} else if (result.command === "inbox") {
runInbox(result);
}
if (result.command === "nodeinfo") {
} else if (result.command === "nodeinfo") {
runNodeInfo(result);
}
if (result.command === "tunnel") {
} else if (result.command === "tunnel") {
await runTunnel(result);
}
if (result.command === "generate-vocab") {
} else if (result.command === "generate-vocab") {
await runGenerateVocab(result);
}
if (result.command === "relay") {
} else if (result.command === "relay") {
await runRelay(result);
} else {
// Make this branch exhaustive for type safety, even though it should never happen:
const _exhaustiveCheck: never = result;
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export function createTunnelOption<S extends TunnelConfigSection>(section: S) {
});
}

export const debugOption = object("Global options", {
export const debugOption = object({
debug: bindConfig(
option("-d", "--debug", {
description: message`Enable debug mode.`,
Expand Down
8 changes: 0 additions & 8 deletions packages/init/src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ const messageQueue = optional(option(
},
));

const debugOption = object("Global options", {
debug: option("-d", "--debug", {
description: message`Enable debug mode.`,
}),
});

export const initOptions = object("Initialization options", {
dir: optional(argument(path({ metavar: "DIR" }), {
description:
Expand All @@ -74,7 +68,6 @@ export const initOptions = object("Initialization options", {
dryRun: option("--dry-run", {
description: message`Perform a trial run with no changes made.`,
}),
debugOption,
});

export const initCommand = command(
Expand Down Expand Up @@ -117,7 +110,6 @@ export const testInitCommand = command(
packageManager: multiple(packageManager),
kvStore: multiple(kvStore),
messageQueue: multiple(messageQueue),
debugOption,
}),
optional(or(noHydRun, noDryRun)),
),
Expand Down
51 changes: 27 additions & 24 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ catalog:
"@opentelemetry/sdk-node": ^0.211.0
"@opentelemetry/sdk-trace-base": ^2.5.0
"@opentelemetry/semantic-conventions": ^1.39.0
"@optique/config": ^0.10.0
"@optique/core": ^0.10.0
"@optique/run": ^0.10.0
"@optique/config": ^0.10.1
"@optique/core": ^0.10.1
"@optique/run": ^0.10.1
"@std/assert": "jsr:^1.0.13"
"@std/async": "jsr:^1.0.13"
"@std/path": "jsr:^1.0.6"
Expand Down
Loading