Skip to content

Commit

Permalink
fix: improve output readablility
Browse files Browse the repository at this point in the history
  • Loading branch information
winchesHe committed Jul 21, 2024
1 parent cc6fe74 commit ca7e31e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/actions/add-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,17 +216,17 @@ export async function addAction(components: string[], options: AddActionOptions)
// Check whether have added redundant dependencies
Logger.newLine();
Logger.log(
`${chalk.bold('Attention')}: Individual components from NextUI do not require the \`@nextui-org/react\` package. For optimized bundle sizes, consider using individual components.`
`${chalk.yellow('Attention')} Individual components from NextUI do not require the \`@nextui-org/react\` package. For optimized bundle sizes, consider using individual components.`
);
Logger.log('The redundant dependencies are:');
currentComponents.forEach((component) => {
[...new Set(currentComponents)].forEach((component) => {
Logger.log(`- ${component.package}`);
});
}

// Warn the user to check the NextUIProvider whether in the correct place
Logger.newLine();
Logger.log(
Logger.grey(
`Please check the ${chalk.bold(
'NextUIProvider'
)} whether in the correct place (ignore if added)\nSee more info here: ${DOCS_PROVIDER_SETUP}`
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@ export function checkTailwind(
});

if (logWarning && isHaveAllContent) {
Logger.warn(
`\nAttention: Individual components from NextUI do not require the "${chalk.bold(
Logger.log(
`\n${chalk.yellow('Attention')} Individual components from NextUI do not require the "${chalk.bold(
tailwindRequired.content
)}" in the tailwind config\nFor optimized bundle sizes, consider using "${chalk.bold(
individualContent
Expand Down
4 changes: 4 additions & 0 deletions src/helpers/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export class Logger {
console.error(...args.map((item) => chalk.red(item)));
}

static grey(...args: Parameters<typeof console.log>) {
console.log(...args.map((item) => chalk.gray(item)));
}

static gradient(content: string | number | boolean, options?: {colors?: tinycolor.ColorInput[]}) {
this.log(_gradientString(...(options?.colors ?? defaultColors))(String(content)));
}
Expand Down

0 comments on commit ca7e31e

Please sign in to comment.