Unverified Commit b429de42 authored by Hong Minhee's avatar Hong Minhee
Browse files

Fix npx @fedify/cli execution across platforms

- Fix binary path resolution in Node.js wrapper script
- Temporarily remove Sharp dependency to resolve installation issues
- Remove image resizing from fedify lookup command (temporary)
- Fix build artifact paths in GitHub Actions workflow

This is a comprehensive hotfix for various npx @fedify/cli execution
issues on different platforms. The Sharp dependency removal is a
temporary workaround; image resizing will be restored in a future
patch using an alternative approach.
parent a6d81c15
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -354,8 +354,8 @@ jobs:
        name: dist
        path: |
          fedify-*.tgz
          cli/fedify-cli-*.tar.xz
          cli/fedify-cli-*.zip
          packages/cli/fedify-cli-*.tar.xz
          packages/cli/fedify-cli-*.zip
    - if: github.event_name == 'push' && github.ref_type == 'tag'
      uses: softprops/action-gh-release@v1
      with:
@@ -363,8 +363,8 @@ jobs:
        name: Fedify ${{ github.ref_name }}
        files: |
          fedify-*.tgz
          cli/fedify-cli-*.tar.xz
          cli/fedify-cli-*.zip
          packages/cli/fedify-cli-*.tar.xz
          packages/cli/fedify-cli-*.zip
        generate_release_notes: false
    - run: |
        set -ex
+14 −0
Original line number Diff line number Diff line
@@ -8,6 +8,20 @@ Version 1.8.2

To be released.

### @fedify/cli

 -  Fixed `npx @fedify/cli` command not working on various platforms by
    correcting the binary path resolution in the Node.js wrapper script.

 -  Temporarily removed Sharp dependency to resolve installation issues
    across different platforms. As a result, `fedify lookup` command will no
    longer resize images when displaying them in the terminal. This is a
    temporary workaround and image resizing functionality will be restored
    in a future patch version using an alternative approach.

 -  Fixed build artifact paths in GitHub Actions workflow to correctly
    reference CLI package location in the monorepo structure.


Version 1.8.1
-------------
+1 −2
Original line number Diff line number Diff line
@@ -24,8 +24,7 @@
    "icojs": "npm:icojs@^0.19.4",
    "jimp": "npm:jimp@^1.6.0",
    "ora": "npm:ora@^8.0.1",
    "shiki": "npm:shiki@^1.6.4",
    "sharp": "npm:sharp@^0.34.3"
    "shiki": "npm:shiki@^1.6.4"
  },
  "exclude": [
    ".vscode",
+5 −14
Original line number Diff line number Diff line
import { encodeBase64 } from "@std/encoding/base64";
import sharp from "sharp";

export type TerminalType = "kitty" | "iterm2" | "none";

@@ -114,28 +113,20 @@ export async function downloadImage(url: string): Promise<string | null> {
export async function renderImages(
  imageUrls: URL[],
): Promise<void> {
  const graphicsProtocol = await detectTerminalCapabilities();
  const graphicsProtocol = detectTerminalCapabilities();
  for (const url of imageUrls) {
    const tempPath = await downloadImage(url.toString());
    if (!tempPath) {
      continue;
    }
    const resizedPath = tempPath + "_resized." +
      (tempPath.split(".").pop() || "png");

    await sharp(tempPath)
      .resize(300)
      .toFile(resizedPath);
    const tempPath = await downloadImage(url.href);
    if (!tempPath) continue;

    console.log(""); // clear the line before rendering image

    if (graphicsProtocol === "kitty") {
      await renderImageKitty(resizedPath, {
      await renderImageKitty(tempPath, {
        a: "T",
        f: 100, // specify the image format is png
      });
    } else if (graphicsProtocol === "iterm2") {
      await renderImageITerm2(resizedPath);
      await renderImageITerm2(tempPath);
    } else {
      continue;
    }
+2 −2
Original line number Diff line number Diff line
@@ -2,11 +2,11 @@
import { spawnSync } from "node:child_process";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
import { isFile, main as install } from "./install.mjs";
import { main as install, isFile } from "./install.mjs";

async function main() {
  const filename = fileURLToPath(import.meta.url);
  const dirName = dirname(filename);
  const dirName = dirname(dirname(filename));
  const binPath = join(
    dirName,
    "bin",