Loading CHANGES.md +6 −0 Original line number Diff line number Diff line Loading @@ -117,10 +117,15 @@ the versioning. in each activity, in addition to the activity's own type. [[#191], [#342] by Jang Hanarae] - The `fedify` CLI now correctly disables color output when standard output isn't a TTY (for example, when redirecting to a file) or when the `NO_COLOR` environment variable is set. [[#257], [#341] by Cho Hasang] [#168]: https://github.com/fedify-dev/fedify/issues/168 [#191]: https://github.com/fedify-dev/fedify/issues/191 [#197]: https://github.com/fedify-dev/fedify/issues/197 [#248]: https://github.com/fedify-dev/fedify/issues/248 [#257]: https://github.com/fedify-dev/fedify/issues/257 [#260]: https://github.com/fedify-dev/fedify/issues/260 [#261]: https://github.com/fedify-dev/fedify/issues/261 [#262]: https://github.com/fedify-dev/fedify/issues/262 Loading @@ -142,6 +147,7 @@ the versioning. [#331]: https://github.com/fedify-dev/fedify/pull/331 [#332]: https://github.com/fedify-dev/fedify/pull/332 [#342]: https://github.com/fedify-dev/fedify/pull/342 [#341]: https://github.com/fedify-dev/fedify/pull/341 Version 1.7.7 Loading cli/deno.json +1 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ "@jimp/wasm-webp": "npm:@jimp/wasm-webp@^1.6.0", "@poppanator/http-constants": "npm:@poppanator/http-constants@^1.1.1", "@std/assert": "jsr:@std/assert@^1.0.13", "@std/fmt/colors": "jsr:@std/fmt@^0.224.0/colors", "@std/dotenv": "jsr:@std/dotenv@^0.225.2", "@std/assert": "jsr:@std/assert@^1.0.0", "@std/semver": "jsr:@std/semver@^1.0.5", Loading cli/inbox.tsx +1 −1 Original line number Diff line number Diff line /** @jsx react-jsx */ /** @jsxImportSource hono/jsx */ import { colors } from "@cliffy/ansi"; import { Command } from "@cliffy/command"; import { Cell, Table } from "@cliffy/table"; import { Loading @@ -23,6 +22,7 @@ import { type Recipient, } from "@fedify/fedify"; import { getLogger } from "@logtape/logtape"; import * as colors from "@std/fmt/colors"; import { parse } from "@std/semver"; import { type Context as HonoContext, Hono } from "hono"; import type { BlankEnv, BlankInput } from "hono/types"; Loading cli/init.ts +35 −25 Original line number Diff line number Diff line import { colors } from "@cliffy/ansi"; import { Command, EnumType } from "@cliffy/command"; import { Select } from "@cliffy/prompt"; import { getLogger } from "@logtape/logtape"; import { stringify } from "@std/dotenv/stringify"; import * as colors from "@std/fmt/colors"; import { exists } from "@std/fs"; import { basename, dirname, join, normalize } from "@std/path"; import metadata from "./deno.json" with { type: "json" }; Loading Loading @@ -172,11 +172,11 @@ Deno.serve({ handler, ...config.server }); instruction: ` To start the server, run the following command: ${colors.bold.green("deno task start")} ${colors.bold(colors.green("deno task start"))} Then, try look up an actor from your server: ${colors.bold.green("fedify lookup http://localhost:8000/users/john")} ${colors.bold(colors.green("fedify lookup http://localhost:8000/users/john"))} `, }), }, Loading Loading @@ -293,18 +293,18 @@ Deno.serve( To start the server, run the following command: ${ colors.bold.green( colors.bold(colors.green( runtime === "deno" ? "deno task dev" : runtime === "bun" ? "bun dev" : `${pm} run dev`, ) )) } Then, try look up an actor from your server: ${colors.bold.green("fedify lookup http://localhost:8000/users/john")} ${colors.bold(colors.green("fedify lookup http://localhost:8000/users/john"))} `, }), }, Loading Loading @@ -377,11 +377,11 @@ app.listen(8000, () => { instruction: ` To start the server, run the following command: ${colors.bold.green(runtime === "bun" ? "bun dev" : `${pm} run dev`)} ${colors.bold(colors.green(runtime === "bun" ? "bun dev" : `${pm} run dev`))} Then, try look up an actor from your server: ${colors.bold.green("fedify lookup http://localhost:8000/users/john")} ${colors.bold(colors.green("fedify lookup http://localhost:8000/users/john"))} `, }), }, Loading Loading @@ -430,11 +430,11 @@ export default defineNitroConfig({ instruction: ` To start the server, run the following command: ${colors.bold.green(runtime === "bun" ? "bun dev" : `${pm} run dev`)} ${colors.bold(colors.green(runtime === "bun" ? "bun dev" : `${pm} run dev`))} Then, try look up an actor from your server: ${colors.bold.green("fedify lookup http://localhost:3000/users/john")} ${colors.bold(colors.green("fedify lookup http://localhost:3000/users/john"))} `, }), }, Loading Loading @@ -879,18 +879,18 @@ Deno.serve( To start the server, run the following command: ${ colors.bold.green( colors.bold(colors.green( runtime === "deno" ? "deno task dev" : runtime === "bun" ? "bun dev" : `${packageManager} run dev`, ) )) } Then, try look up an actor from your server: ${colors.bold.green("fedify lookup http://localhost:8000/users/john")} ${colors.bold(colors.green("fedify lookup http://localhost:8000/users/john"))} `, }; } else { Loading Loading @@ -1017,7 +1017,9 @@ await configure({ if (dryRun) { console.log( colors.bold.yellow("🔍 DRY RUN MODE - No files will be created\n"), colors.bold( colors.yellow("🔍 DRY RUN MODE - No files will be created\n"), ), ); } Loading @@ -1043,7 +1045,7 @@ await configure({ } if (initializer.command != null) { if (dryRun) { console.log(colors.bold.cyan("📦 Would run command:")); console.log(colors.bold(colors.cyan("📦 Would run command:"))); console.log( ` ${ [initializer.command[0], ...initializer.command.slice(1)].join(" ") Loading Loading @@ -1088,7 +1090,7 @@ await configure({ .map(([name, version]) => `${name}@${version}`) .join("\n"); if (deps) { console.log(colors.bold.cyan("📦 Would install dependencies:")); console.log(colors.bold(colors.cyan("📦 Would install dependencies:"))); console.log(`${deps}\n`); } } else { Loading @@ -1111,7 +1113,9 @@ await configure({ .map(([name, version]) => `${name}@${version}`) .join("\n"); if (devDeps) { console.log(colors.bold.cyan("📦 Would install dev dependencies:")); console.log( colors.bold(colors.cyan("📦 Would install dev dependencies:")), ); console.log(`${devDeps}\n`); } } else { Loading @@ -1125,7 +1129,7 @@ await configure({ } } if (dryRun) { console.log(colors.bold.green("📄 Would create files:\n")); console.log(colors.bold(colors.green("📄 Would create files:\n"))); for (const [filename, content] of Object.entries(files)) { const path = join(dir, filename); displayFileContent(path, content); Loading @@ -1140,7 +1144,7 @@ await configure({ } if (prependFiles != null) { if (dryRun) { console.log(colors.bold.blue("Would prepend to files:\n")); console.log(colors.bold(colors.blue("Would prepend to files:\n"))); for (const [filename, prefix] of Object.entries(prependFiles)) { const path = join(dir, filename); console.log(colors.blue(`${path}`)); Loading @@ -1163,7 +1167,9 @@ await configure({ } if (runtime === "deno") { if (dryRun) { console.log(colors.bold.green("Would create/update JSON files:\n")); console.log( colors.bold(colors.green("Would create/update JSON files:\n")), ); } await rewriteJsonFile( join(dir, "deno.json"), Loading Loading @@ -1248,7 +1254,9 @@ await configure({ ); } else { if (dryRun) { console.log(colors.bold.green("Would create/update JSON files:\n")); console.log( colors.bold(colors.green("Would create/update JSON files:\n")), ); } await rewriteJsonFile( join(dir, "package.json"), Loading Loading @@ -1362,23 +1370,25 @@ await configure({ if (Object.keys(env).length > 0) { console.error( `Note that you probably want to edit the ${ colors.bold.blue(".env") colors.bold(colors.blue(".env")) } file. It currently contains the following values:\n`, ); for (const key in env) { const value = stringify({ _: env[key] }).substring(2); console.error(` ${colors.green.bold(key)}${colors.gray("=")}${value}`); console.error( ` ${colors.bold(colors.green(key))}${colors.gray("=")}${value}`, ); } console.error(); } console.error(`\ Start by editing the ${colors.bold.blue(initializer.federationFile)} \ Start by editing the ${colors.bold(colors.blue(initializer.federationFile))} \ file to define your federation! `); }); function drawDinosaur() { const d = colors.bgBlue.black; const d = (text: string) => colors.bgBlue(colors.black(text)); const f = colors.blue; console.error(`\ ${d(" ___ ")} ${f(" _____ _ _ __")} Loading cli/lookup.ts +4 −4 Original line number Diff line number Diff line import { colors } from "@cliffy/ansi"; import { Command, EnumType } from "@cliffy/command"; import { Application, Loading @@ -15,10 +14,12 @@ import { traverseCollection, } from "@fedify/fedify"; import { getLogger } from "@logtape/logtape"; import * as colors from "@std/fmt/colors"; import { dirname, isAbsolute, resolve } from "@std/path"; import ora from "ora"; import { getContextLoader, getDocumentLoader } from "./docloader.ts"; import { spawnTemporaryServer, type TemporaryServer } from "./tempserver.ts"; import { colorEnabled, formatCliObjectOutputWithColor } from "./utils.ts"; const logger = getLogger(["fedify", "cli", "lookup"]); Loading Loading @@ -107,9 +108,8 @@ export async function writeObjectToStream( content = object; } content = Deno.inspect(content, { colors: !(options.output), }); const enableColors = colorEnabled && options.output === undefined; content = formatCliObjectOutputWithColor(content, enableColors); const encoder = new TextEncoder(); const bytes = encoder.encode(content + "\n"); Loading Loading
CHANGES.md +6 −0 Original line number Diff line number Diff line Loading @@ -117,10 +117,15 @@ the versioning. in each activity, in addition to the activity's own type. [[#191], [#342] by Jang Hanarae] - The `fedify` CLI now correctly disables color output when standard output isn't a TTY (for example, when redirecting to a file) or when the `NO_COLOR` environment variable is set. [[#257], [#341] by Cho Hasang] [#168]: https://github.com/fedify-dev/fedify/issues/168 [#191]: https://github.com/fedify-dev/fedify/issues/191 [#197]: https://github.com/fedify-dev/fedify/issues/197 [#248]: https://github.com/fedify-dev/fedify/issues/248 [#257]: https://github.com/fedify-dev/fedify/issues/257 [#260]: https://github.com/fedify-dev/fedify/issues/260 [#261]: https://github.com/fedify-dev/fedify/issues/261 [#262]: https://github.com/fedify-dev/fedify/issues/262 Loading @@ -142,6 +147,7 @@ the versioning. [#331]: https://github.com/fedify-dev/fedify/pull/331 [#332]: https://github.com/fedify-dev/fedify/pull/332 [#342]: https://github.com/fedify-dev/fedify/pull/342 [#341]: https://github.com/fedify-dev/fedify/pull/341 Version 1.7.7 Loading
cli/deno.json +1 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ "@jimp/wasm-webp": "npm:@jimp/wasm-webp@^1.6.0", "@poppanator/http-constants": "npm:@poppanator/http-constants@^1.1.1", "@std/assert": "jsr:@std/assert@^1.0.13", "@std/fmt/colors": "jsr:@std/fmt@^0.224.0/colors", "@std/dotenv": "jsr:@std/dotenv@^0.225.2", "@std/assert": "jsr:@std/assert@^1.0.0", "@std/semver": "jsr:@std/semver@^1.0.5", Loading
cli/inbox.tsx +1 −1 Original line number Diff line number Diff line /** @jsx react-jsx */ /** @jsxImportSource hono/jsx */ import { colors } from "@cliffy/ansi"; import { Command } from "@cliffy/command"; import { Cell, Table } from "@cliffy/table"; import { Loading @@ -23,6 +22,7 @@ import { type Recipient, } from "@fedify/fedify"; import { getLogger } from "@logtape/logtape"; import * as colors from "@std/fmt/colors"; import { parse } from "@std/semver"; import { type Context as HonoContext, Hono } from "hono"; import type { BlankEnv, BlankInput } from "hono/types"; Loading
cli/init.ts +35 −25 Original line number Diff line number Diff line import { colors } from "@cliffy/ansi"; import { Command, EnumType } from "@cliffy/command"; import { Select } from "@cliffy/prompt"; import { getLogger } from "@logtape/logtape"; import { stringify } from "@std/dotenv/stringify"; import * as colors from "@std/fmt/colors"; import { exists } from "@std/fs"; import { basename, dirname, join, normalize } from "@std/path"; import metadata from "./deno.json" with { type: "json" }; Loading Loading @@ -172,11 +172,11 @@ Deno.serve({ handler, ...config.server }); instruction: ` To start the server, run the following command: ${colors.bold.green("deno task start")} ${colors.bold(colors.green("deno task start"))} Then, try look up an actor from your server: ${colors.bold.green("fedify lookup http://localhost:8000/users/john")} ${colors.bold(colors.green("fedify lookup http://localhost:8000/users/john"))} `, }), }, Loading Loading @@ -293,18 +293,18 @@ Deno.serve( To start the server, run the following command: ${ colors.bold.green( colors.bold(colors.green( runtime === "deno" ? "deno task dev" : runtime === "bun" ? "bun dev" : `${pm} run dev`, ) )) } Then, try look up an actor from your server: ${colors.bold.green("fedify lookup http://localhost:8000/users/john")} ${colors.bold(colors.green("fedify lookup http://localhost:8000/users/john"))} `, }), }, Loading Loading @@ -377,11 +377,11 @@ app.listen(8000, () => { instruction: ` To start the server, run the following command: ${colors.bold.green(runtime === "bun" ? "bun dev" : `${pm} run dev`)} ${colors.bold(colors.green(runtime === "bun" ? "bun dev" : `${pm} run dev`))} Then, try look up an actor from your server: ${colors.bold.green("fedify lookup http://localhost:8000/users/john")} ${colors.bold(colors.green("fedify lookup http://localhost:8000/users/john"))} `, }), }, Loading Loading @@ -430,11 +430,11 @@ export default defineNitroConfig({ instruction: ` To start the server, run the following command: ${colors.bold.green(runtime === "bun" ? "bun dev" : `${pm} run dev`)} ${colors.bold(colors.green(runtime === "bun" ? "bun dev" : `${pm} run dev`))} Then, try look up an actor from your server: ${colors.bold.green("fedify lookup http://localhost:3000/users/john")} ${colors.bold(colors.green("fedify lookup http://localhost:3000/users/john"))} `, }), }, Loading Loading @@ -879,18 +879,18 @@ Deno.serve( To start the server, run the following command: ${ colors.bold.green( colors.bold(colors.green( runtime === "deno" ? "deno task dev" : runtime === "bun" ? "bun dev" : `${packageManager} run dev`, ) )) } Then, try look up an actor from your server: ${colors.bold.green("fedify lookup http://localhost:8000/users/john")} ${colors.bold(colors.green("fedify lookup http://localhost:8000/users/john"))} `, }; } else { Loading Loading @@ -1017,7 +1017,9 @@ await configure({ if (dryRun) { console.log( colors.bold.yellow("🔍 DRY RUN MODE - No files will be created\n"), colors.bold( colors.yellow("🔍 DRY RUN MODE - No files will be created\n"), ), ); } Loading @@ -1043,7 +1045,7 @@ await configure({ } if (initializer.command != null) { if (dryRun) { console.log(colors.bold.cyan("📦 Would run command:")); console.log(colors.bold(colors.cyan("📦 Would run command:"))); console.log( ` ${ [initializer.command[0], ...initializer.command.slice(1)].join(" ") Loading Loading @@ -1088,7 +1090,7 @@ await configure({ .map(([name, version]) => `${name}@${version}`) .join("\n"); if (deps) { console.log(colors.bold.cyan("📦 Would install dependencies:")); console.log(colors.bold(colors.cyan("📦 Would install dependencies:"))); console.log(`${deps}\n`); } } else { Loading @@ -1111,7 +1113,9 @@ await configure({ .map(([name, version]) => `${name}@${version}`) .join("\n"); if (devDeps) { console.log(colors.bold.cyan("📦 Would install dev dependencies:")); console.log( colors.bold(colors.cyan("📦 Would install dev dependencies:")), ); console.log(`${devDeps}\n`); } } else { Loading @@ -1125,7 +1129,7 @@ await configure({ } } if (dryRun) { console.log(colors.bold.green("📄 Would create files:\n")); console.log(colors.bold(colors.green("📄 Would create files:\n"))); for (const [filename, content] of Object.entries(files)) { const path = join(dir, filename); displayFileContent(path, content); Loading @@ -1140,7 +1144,7 @@ await configure({ } if (prependFiles != null) { if (dryRun) { console.log(colors.bold.blue("Would prepend to files:\n")); console.log(colors.bold(colors.blue("Would prepend to files:\n"))); for (const [filename, prefix] of Object.entries(prependFiles)) { const path = join(dir, filename); console.log(colors.blue(`${path}`)); Loading @@ -1163,7 +1167,9 @@ await configure({ } if (runtime === "deno") { if (dryRun) { console.log(colors.bold.green("Would create/update JSON files:\n")); console.log( colors.bold(colors.green("Would create/update JSON files:\n")), ); } await rewriteJsonFile( join(dir, "deno.json"), Loading Loading @@ -1248,7 +1254,9 @@ await configure({ ); } else { if (dryRun) { console.log(colors.bold.green("Would create/update JSON files:\n")); console.log( colors.bold(colors.green("Would create/update JSON files:\n")), ); } await rewriteJsonFile( join(dir, "package.json"), Loading Loading @@ -1362,23 +1370,25 @@ await configure({ if (Object.keys(env).length > 0) { console.error( `Note that you probably want to edit the ${ colors.bold.blue(".env") colors.bold(colors.blue(".env")) } file. It currently contains the following values:\n`, ); for (const key in env) { const value = stringify({ _: env[key] }).substring(2); console.error(` ${colors.green.bold(key)}${colors.gray("=")}${value}`); console.error( ` ${colors.bold(colors.green(key))}${colors.gray("=")}${value}`, ); } console.error(); } console.error(`\ Start by editing the ${colors.bold.blue(initializer.federationFile)} \ Start by editing the ${colors.bold(colors.blue(initializer.federationFile))} \ file to define your federation! `); }); function drawDinosaur() { const d = colors.bgBlue.black; const d = (text: string) => colors.bgBlue(colors.black(text)); const f = colors.blue; console.error(`\ ${d(" ___ ")} ${f(" _____ _ _ __")} Loading
cli/lookup.ts +4 −4 Original line number Diff line number Diff line import { colors } from "@cliffy/ansi"; import { Command, EnumType } from "@cliffy/command"; import { Application, Loading @@ -15,10 +14,12 @@ import { traverseCollection, } from "@fedify/fedify"; import { getLogger } from "@logtape/logtape"; import * as colors from "@std/fmt/colors"; import { dirname, isAbsolute, resolve } from "@std/path"; import ora from "ora"; import { getContextLoader, getDocumentLoader } from "./docloader.ts"; import { spawnTemporaryServer, type TemporaryServer } from "./tempserver.ts"; import { colorEnabled, formatCliObjectOutputWithColor } from "./utils.ts"; const logger = getLogger(["fedify", "cli", "lookup"]); Loading Loading @@ -107,9 +108,8 @@ export async function writeObjectToStream( content = object; } content = Deno.inspect(content, { colors: !(options.output), }); const enableColors = colorEnabled && options.output === undefined; content = formatCliObjectOutputWithColor(content, enableColors); const encoder = new TextEncoder(); const bytes = encoder.encode(content + "\n"); Loading