Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ planned for 2025-07-01
- Switch Stylelint config to flat format and simplify Stylelint scripts
- [workflow] Replace Node.js version v23 with v24 (#3770)
- [refactor] Replace deprecated constants `fs.F_OK` and `fs.R_OK` (#3789)
- [refactor] Replace `ansis` with built-in function `util.styleText`

### Fixed

Expand Down
6 changes: 3 additions & 3 deletions js/check_config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const path = require("node:path");
const fs = require("node:fs");
const { styleText } = require("node:util");
const Ajv = require("ajv");
const colors = require("ansis");
const globals = require("globals");
const { Linter } = require("eslint");

Expand Down Expand Up @@ -61,7 +61,7 @@ function checkConfigFile () {
);

if (errors.length === 0) {
Log.info(colors.green("Your configuration file doesn't contain syntax errors :)"));
Log.info(styleText("green", "Your configuration file doesn't contain syntax errors :)"));
validateModulePositions(configFileName);
} else {
let errorMessage = "Your configuration file contains syntax errors :(";
Expand Down Expand Up @@ -112,7 +112,7 @@ function validateModulePositions (configFileName) {

const valid = validate(data);
if (valid) {
Log.info(colors.green("Your modules structure configuration doesn't contain errors :)"));
Log.info(styleText("green", "Your modules structure configuration doesn't contain errors :)"));
} else {
const module = validate.errors[0].instancePath.split("/")[2];
const position = validate.errors[0].instancePath.split("/")[3];
Expand Down
16 changes: 8 additions & 8 deletions js/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
(function (root, factory) {
if (typeof exports === "object") {
if (process.env.JEST_WORKER_ID === undefined) {
const colors = require("ansis");
const { styleText } = require("node:util");

// add timestamps in front of log messages
require("console-stamp")(console, {
Expand All @@ -12,25 +12,25 @@
const { method, defaultTokens } = arg;
let label = defaultTokens.label(arg);
if (method === "error") {
label = colors.red(label);
label = styleText("red", label);
} else if (method === "warn") {
label = colors.yellow(label);
label = styleText("yellow", label);
} else if (method === "debug") {
label = colors.bgBlue(label);
label = styleText("bgBlue", label);
} else if (method === "info") {
label = colors.blue(label);
label = styleText("blue", label);
}
return label;
},
msg: (arg) => {
const { method, defaultTokens } = arg;
let msg = defaultTokens.msg(arg);
if (method === "error") {
msg = colors.red(msg);
msg = styleText("red", msg);
} else if (method === "warn") {
msg = colors.yellow(msg);
msg = styleText("yellow", msg);
} else if (method === "info") {
msg = colors.blue(msg);
msg = styleText("blue", msg);
}
return msg;
}
Expand Down
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
},
"dependencies": {
"ajv": "^8.17.1",
"ansis": "^4.0.0",
"console-stamp": "^3.1.2",
"envsub": "^4.1.0",
"eslint": "^9.27.0",
Expand Down