build: update npm install command to use --legacy-peer-deps

This change modifies the build scripts to use --legacy-peer-deps flag when installing npm dependencies to resolve potential peer dependency conflicts during the build process. The change is applied to both bash (build.sh) and batch (build.bat) build scripts.
This commit is contained in:
Luiz Costa
2025-11-18 10:23:55 -03:00
parent 20129a1ac7
commit ac4f232e5e
787 changed files with 82341 additions and 121690 deletions
+79 -127
View File
@@ -5,8 +5,6 @@
"use strict";
const { startTime, endTime } = require("../shared/stats");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
@@ -15,26 +13,26 @@ const { startTime, endTime } = require("../shared/stats");
/**
* Align the string to left
* @param {string} str string to evaluate
* @param {number} len length of the string
* @param {int} len length of the string
* @param {string} ch delimiter character
* @returns {string} modified string
* @private
*/
function alignLeft(str, len, ch) {
return str + new Array(len - str.length + 1).join(ch || " ");
return str + new Array(len - str.length + 1).join(ch || " ");
}
/* c8 ignore next */
/**
* Align the string to right
* @param {string} str string to evaluate
* @param {number} len length of the string
* @param {int} len length of the string
* @param {string} ch delimiter character
* @returns {string} modified string
* @private
*/
function alignRight(str, len, ch) {
return new Array(len - str.length + 1).join(ch || " ") + str;
return new Array(len - str.length + 1).join(ch || " ") + str;
}
//------------------------------------------------------------------------------
@@ -51,21 +49,19 @@ const ALIGN = [alignLeft, alignRight, alignRight];
* @returns {number} the number of rules to show
*/
function getListSize() {
const MINIMUM_SIZE = 10;
const MINIMUM_SIZE = 10;
if (typeof process.env.TIMING !== "string") {
return MINIMUM_SIZE;
}
if (typeof process.env.TIMING !== "string") {
return MINIMUM_SIZE;
}
if (process.env.TIMING.toLowerCase() === "all") {
return Number.POSITIVE_INFINITY;
}
if (process.env.TIMING.toLowerCase() === "all") {
return Number.POSITIVE_INFINITY;
}
const TIMING_ENV_VAR_AS_INTEGER = Number.parseInt(process.env.TIMING, 10);
const TIMING_ENV_VAR_AS_INTEGER = Number.parseInt(process.env.TIMING, 10);
return TIMING_ENV_VAR_AS_INTEGER > 10
? TIMING_ENV_VAR_AS_INTEGER
: MINIMUM_SIZE;
return TIMING_ENV_VAR_AS_INTEGER > 10 ? TIMING_ENV_VAR_AS_INTEGER : MINIMUM_SIZE;
}
/* c8 ignore next */
@@ -76,134 +72,90 @@ function getListSize() {
* @private
*/
function display(data) {
let total = 0;
const rows = Object.keys(data)
.map(key => {
const time = data[key];
let total = 0;
const rows = Object.keys(data)
.map(key => {
const time = data[key];
total += time;
return [key, time];
})
.sort((a, b) => b[1] - a[1])
.slice(0, getListSize());
total += time;
return [key, time];
})
.sort((a, b) => b[1] - a[1])
.slice(0, getListSize());
rows.forEach(row => {
row.push(`${((row[1] * 100) / total).toFixed(1)}%`);
row[1] = row[1].toFixed(3);
});
rows.forEach(row => {
row.push(`${(row[1] * 100 / total).toFixed(1)}%`);
row[1] = row[1].toFixed(3);
});
rows.unshift(HEADERS);
rows.unshift(HEADERS);
const widths = [];
const widths = [];
rows.forEach(row => {
const len = row.length;
rows.forEach(row => {
const len = row.length;
for (let i = 0; i < len; i++) {
const n = row[i].length;
for (let i = 0; i < len; i++) {
const n = row[i].length;
if (!widths[i] || n > widths[i]) {
widths[i] = n;
}
}
});
if (!widths[i] || n > widths[i]) {
widths[i] = n;
}
}
});
const table = rows.map(row =>
row.map((cell, index) => ALIGN[index](cell, widths[index])).join(" | "),
);
const table = rows.map(row => (
row
.map((cell, index) => ALIGN[index](cell, widths[index]))
.join(" | ")
));
table.splice(
1,
0,
widths
.map((width, index) => {
const extraAlignment =
index !== 0 && index !== widths.length - 1 ? 2 : 1;
table.splice(1, 0, widths.map((width, index) => {
const extraAlignment = index !== 0 && index !== widths.length - 1 ? 2 : 1;
return ALIGN[index](":", width + extraAlignment, "-");
})
.join("|"),
);
return ALIGN[index](":", width + extraAlignment, "-");
}).join("|"));
console.log(table.join("\n")); // eslint-disable-line no-console -- Debugging function
console.log(table.join("\n")); // eslint-disable-line no-console -- Debugging function
}
/* c8 ignore next */
module.exports = (function () {
const data = Object.create(null);
let displayEnabled = true;
module.exports = (function() {
/**
* Time the run
* @param {any} key key from the data object
* @param {Function} fn function to be called
* @param {boolean} stats if 'stats' is true, return the result and the time difference
* @returns {Function} function to be executed
* @private
*/
function time(key, fn, stats) {
return function (...args) {
const t = startTime();
const result = fn(...args);
const tdiff = endTime(t);
const data = Object.create(null);
if (enabled) {
if (typeof data[key] === "undefined") {
data[key] = 0;
}
/**
* Time the run
* @param {any} key key from the data object
* @param {Function} fn function to be called
* @returns {Function} function to be executed
* @private
*/
function time(key, fn) {
if (typeof data[key] === "undefined") {
data[key] = 0;
}
data[key] += tdiff;
}
return function(...args) {
let t = process.hrtime();
const result = fn(...args);
return stats ? { result, tdiff } : result;
};
}
t = process.hrtime(t);
data[key] += t[0] * 1e3 + t[1] / 1e6;
return result;
};
}
/**
* Returns a shallow copy of the collected timings data.
* @returns {Record<string, number>} mapping of ruleId to total time in ms
*/
function getData() {
return { ...data };
}
if (enabled) {
process.on("exit", () => {
display(data);
});
}
/**
* Merges rule timing totals collected elsewhere into this process' totals.
* @param {Record<string, number>} dataToMerge mapping of ruleId to total time in ms
* @returns {void}
*/
function mergeData(dataToMerge) {
for (const [key, value] of Object.entries(dataToMerge)) {
if (typeof data[key] === "undefined") {
data[key] = 0;
}
data[key] += value;
}
}
return {
time,
enabled,
getListSize
};
/**
* Disables printing of timing data on process exit.
* Intended for worker threads or non-main contexts.
* @returns {void}
*/
function disableDisplay() {
displayEnabled = false;
}
if (enabled) {
process.on("exit", () => {
if (displayEnabled && Object.keys(data).length > 0) {
display(data);
}
});
}
return {
time,
enabled,
getListSize,
getData,
mergeData,
disableDisplay,
};
})();
}());