Skip to content

fix(pnpm): various strictness errors #2580

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 7, 2025

Conversation

Tyriar
Copy link
Contributor

@Tyriar Tyriar commented Mar 6, 2025

No description provided.

@withfig-bot
Copy link
Collaborator

withfig-bot commented Mar 6, 2025

Overview

src/pnpm.ts:

Info:

Single Functions:

postProcess:

 function (out) {
    const output = filterMessages(out);

    if (output.startsWith("fatal:")) {
      return [];
    }

    return output.split("\n").map((elm) => {
      let name = elm.trim();
      const parts = elm.match(/\S+/g);
      if (parts && parts.length > 1) {
        if (parts[0] == "*") {
          // Current branch.
          return {
            name: elm.replace("*", "").trim(),
            description: "Current branch",
            icon: "⭐️",
          };
        } else if (parts[0] == "+") {
          // Branch checked out in another worktree.
          name = elm.replace("+", "").trim();
        }
      }

      return {
        name,
        description: "Branch",
        icon: "fig://icon?type=git",
      };
    });
  }

postProcess:

 function (out) {
    /**
     * out
     * @example
     * ```
     * Legend: production dependency, optional only, dev only
     *
     * /xxxx/xxxx/<package-name> (PRIVATE)
     *
     * dependencies:
     * lodash 4.17.21
     * foo link:packages/foo
     *
     * devDependencies:
     * typescript 4.7.4
     * ```
     */
    if (out.includes("ERR_PNPM")) {
      return [];
    }

    const output = out
      .split("\n")
      .slice(3)
      // remove empty lines, "*dependencies:" lines, local workspace packages (eg: "foo":"workspace:*")
      .filter(
        (item) =>
          !!item &&
          !item.toLowerCase().includes("dependencies") &&
          !item.includes("link:")
      )
      .map((item) => item.replace(/\s/, "@")); // typescript 4.7.4 -> [email protected]

    return output.map((pkg) => {
      return {
        name: pkg,
        icon: "fig://icon?type=package",
      };
    });
  }

@withfig-bot
Copy link
Collaborator

Hello @Tyriar,
thank you very much for creating a Pull Request!
Here is a small checklist to get this PR merged as quickly as possible:

  • Do all subcommands / options which take arguments include the args property (args: {})?
  • Are all options modular? E.g. -a -u -x instead of -aux
  • Have all other checks passed?

Please add a 👍 as a reaction to this comment to show that you read this.

@Tyriar Tyriar force-pushed the tyriar/strict_pnpm branch from f2c3a06 to ea13931 Compare March 6, 2025 13:12
@chaynabors chaynabors merged commit 037f98a into withfig:master Mar 7, 2025
5 checks passed
@withfig withfig locked and limited conversation to collaborators Mar 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants