chore: Remove chalk module (#10700)

This commit is contained in:
Tom Moor
2025-11-23 20:01:49 +01:00
committed by GitHub
parent 893e451f7f
commit f4d9b6b257
4 changed files with 18 additions and 12 deletions

View File

@@ -118,7 +118,6 @@
"babel-plugin-transform-class-properties": "^6.24.1",
"body-scroll-lock": "^4.0.0-beta.0",
"bull": "^4.16.5",
"chalk": "^4.1.0",
"class-validator": "^0.14.2",
"command-score": "^0.1.2",
"compressorjs": "^1.2.1",

View File

@@ -1,6 +1,6 @@
/* oxlint-disable no-console */
import { IncomingMessage } from "http";
import chalk from "chalk";
import { styleText } from "node:util";
import isArray from "lodash/isArray";
import isEmpty from "lodash/isEmpty";
import isObject from "lodash/isObject";
@@ -60,7 +60,7 @@ class Logger {
winston.format.printf(
({ message, level, label, ...extra }) =>
`${level}: ${
label ? chalk.bold("[" + label + "] ") : ""
label ? styleText("bold", `[${label}] `) : ""
}${message} ${isEmpty(extra) ? "" : JSON.stringify(extra)}`
)
),

View File

@@ -1,4 +1,4 @@
import chalk from "chalk";
import { styleText } from "node:util";
import isEmpty from "lodash/isEmpty";
import env from "@server/env";
import Logger from "@server/logging/Logger";
@@ -17,7 +17,8 @@ export async function checkPendingMigrations() {
if (!isEmpty(pending)) {
if (getArg("no-migrate")) {
Logger.warn(
chalk.red(
styleText(
"red",
`Database migrations are pending and were not ran because --no-migrate flag was passed.\nRun the migrations with "yarn db:migrate".`
)
);
@@ -31,12 +32,13 @@ export async function checkPendingMigrations() {
} catch (err) {
if (err.message.includes("ECONNREFUSED")) {
Logger.warn(
chalk.red(
styleText(
"red",
`Could not connect to the database. Please check your connection settings.`
)
);
} else {
Logger.warn(chalk.red(err.message));
Logger.warn(styleText("red", err.message));
}
process.exit(1);
} finally {
@@ -75,15 +77,20 @@ export async function printEnv() {
if (env.isProduction) {
Logger.info(
"lifecycle",
chalk.green(`
styleText(
"green",
`
Is your team enjoying Outline? Consider supporting future development by sponsoring the project:\n\nhttps://github.com/sponsors/outline
`)
`
)
);
} else if (env.isDevelopment) {
Logger.warn(
`Running Outline in ${chalk.bold(
`Running Outline in ${styleText(
"bold",
"development mode"
)}. To run Outline in production mode set the ${chalk.bold(
)}. To run Outline in production mode set the ${styleText(
"bold",
"NODE_ENV"
)} env variable to "production"`
);

View File

@@ -6514,7 +6514,7 @@ chalk@^2.4.2:
escape-string-regexp "^1.0.5"
supports-color "^5.3.0"
chalk@^4.0.0, chalk@^4.0.2, chalk@^4.1.0, chalk@^4.1.2:
chalk@^4.0.0, chalk@^4.0.2, chalk@^4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01"
integrity "sha1-qsTit3NKdAhnrrFr8CqtVWoeegE= sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="