cli-microsoft365
cli-microsoft365 copied to clipboard
correct how we import `chalk` in cli.ts
here we made a small mistake https://github.com/pnp/cli-microsoft365/commit/3b7cd6f617bb737fac9201196d3b80d755933b02#diff-25768f5853544984f9e0188641fe6d70f0e5d5245c9317d80be7d3d32a71dd44
We should not import chalk at the top globally but rather inline only when needed.
We already have it done like this in other places, for example:
const chalk = (await import('chalk')).default;
await logger.logToStderr(chalk.green('DONE'));
We only need chalk when we write colors, ie. log errors. Since we typically don't do it, we don't load chalk by default, which improves performance of the CLI.