Skip to content

Commit

Permalink
fix(common,config): remove chalk usage (#1824)
Browse files Browse the repository at this point in the history
Co-authored-by: Kevin Ingersoll <[email protected]>
  • Loading branch information
emersonhsieh and holic authored Oct 24, 2023
1 parent c5148da commit 3e05706
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 15 deletions.
6 changes: 6 additions & 0 deletions .changeset/small-dots-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@latticexyz/common": patch
"@latticexyz/config": patch
---

Removed chalk usage from modules imported in client fix downstream client builds (vite in particular).
1 change: 0 additions & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
"dependencies": {
"@latticexyz/schema-type": "workspace:*",
"@solidity-parser/parser": "^0.16.0",
"chalk": "^5.2.0",
"debug": "^4.3.4",
"execa": "^7.0.0",
"p-queue": "^7.4.1",
Expand Down
3 changes: 1 addition & 2 deletions packages/common/src/codegen/utils/format.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import chalk from "chalk";
import prettier from "prettier";
import prettierPluginSolidity from "prettier-plugin-solidity";

Expand Down Expand Up @@ -27,7 +26,7 @@ export async function formatSolidity(content: string, prettierConfigPath?: strin
} else {
message = error;
}
console.log(chalk.yellow(`Error during output formatting: ${message}`));
console.log(`Error during output formatting: ${message}`);
return content;
}
}
Expand Down
5 changes: 2 additions & 3 deletions packages/common/src/foundry/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { execa, Options } from "execa";
import chalk from "chalk";

export interface ForgeConfig {
// project
Expand Down Expand Up @@ -127,13 +126,13 @@ export async function anvil(args: string[]): Promise<string> {
async function execLog(command: string, args: string[], options?: Options<string>): Promise<string> {
const commandString = `${command} ${args.join(" ")}`;
try {
console.log(chalk.gray(`running "${commandString}"`));
console.log(`running "${commandString}"`);
const { stdout } = await execa(command, args, { stdout: "pipe", stderr: "pipe", ...options });
return stdout;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (error: any) {
let errorMessage = error?.stderr || error?.message || "";
errorMessage += chalk.red(`\nError running "${commandString}"`);
errorMessage += `\nError running "${commandString}"`;
throw new Error(errorMessage);
}
}
1 change: 0 additions & 1 deletion packages/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"dependencies": {
"@latticexyz/common": "workspace:*",
"@latticexyz/schema-type": "workspace:*",
"chalk": "^5.2.0",
"esbuild": "^0.17.15",
"ethers": "^5.7.2",
"find-up": "^6.3.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/config/src/library/errors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import chalk from "chalk";
import { z, ZodError, ZodIssueCode } from "zod";
import { fromZodError } from "zod-validation-error";

Expand All @@ -15,7 +14,7 @@ export class MUDContextNotCreatedError extends Error {
// Wrapper with preset styles, only requires a `prefix`
export function fromZodErrorCustom(error: ZodError, prefix: string) {
return fromZodError(error, {
prefix: chalk.red(prefix),
prefix: prefix,
prefixSeparator: "\n- ",
issueSeparator: "\n- ",
});
Expand Down
6 changes: 0 additions & 6 deletions pnpm-lock.yaml

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

0 comments on commit 3e05706

Please sign in to comment.