Skip to content
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

fix(common,config): remove chalk usage #1824

Merged
merged 4 commits into from
Oct 24, 2023
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: 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.

Loading