Skip to content

Commit

Permalink
fix: workaround for chalk5
Browse files Browse the repository at this point in the history
  • Loading branch information
Vikram Kalta authored and Vikram Kalta committed Sep 28, 2023
1 parent 8a2c0e3 commit 2889a25
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
3 changes: 1 addition & 2 deletions src/types/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Color } from "chalk";
import { PrintOptions } from "@contentstack/cli-utilities";

import config from "../config";
Expand All @@ -25,5 +24,5 @@ export type LoggerType = "info" | "warn" | "error" | "debug";
export type PrintType = {
message: string;
bold?: boolean;
color?: typeof Color;
color?: any;
};
5 changes: 2 additions & 3 deletions src/util/log.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import map from "lodash/map";
import winston from "winston";
import { existsSync } from "fs";
import chalk, { Chalk } from "chalk";
import replace from "lodash/replace";
import { join, normalize } from "path";
import isObject from "lodash/isObject";
Expand Down Expand Up @@ -174,8 +173,8 @@ export default class Logger {
* @param {Array<PrintType>} printInput
*/
export function print(printInput: Array<PrintType>): void {
const str = map(printInput, ({ message, bold, color }: PrintType) => {
let chalkFn: Chalk = chalk;
const str = map(printInput, async ({ message, bold, color }: PrintType) => {
let chalkFn: any = new (await import('chalk')).Chalk();
if (color) chalkFn = chalkFn[color];
if (bold) chalkFn = chalkFn.bold;

Expand Down
6 changes: 3 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
"compilerOptions": {
"declaration": true,
"importHelpers": true,
"module": "commonjs",
"module": "NodeNext",
"outDir": "lib",
"rootDir": "src",
"strict": true,
"target": "es2017",
"target": "ESNext",
"esModuleInterop": true,
// The composite option enforces certain constraints which make it possible for build tools
// (including TypeScript itself, under --build mode) to quickly determine if a project has been built
"composite": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true
"moduleResolution": "NodeNext"
},
"include": [
"src/**/*",
Expand Down

0 comments on commit 2889a25

Please sign in to comment.