commit
62ef6bf1b9
1
common/Tests/colors-test/.gitignore
vendored
Normal file
1
common/Tests/colors-test/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.html
|
10
common/Tests/colors-test/package.json
Normal file
10
common/Tests/colors-test/package.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "colors-test",
|
||||
"version": "1.0.0",
|
||||
"main": "index.js",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"start": "node src/index.js"
|
||||
}
|
||||
}
|
39
common/Tests/colors-test/src/exclude.js
Normal file
39
common/Tests/colors-test/src/exclude.js
Normal file
@ -0,0 +1,39 @@
|
||||
// (c) Copyright Ascensio System SIA 2010-2024
|
||||
//
|
||||
// This program is a free software product.
|
||||
// You can redistribute it and/or modify it under the terms
|
||||
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
|
||||
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
|
||||
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
|
||||
// any third-party rights.
|
||||
//
|
||||
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
|
||||
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
//
|
||||
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
|
||||
//
|
||||
// The interactive user interfaces in modified source and object code versions of the Program must
|
||||
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
|
||||
//
|
||||
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
|
||||
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
|
||||
// trademark law for use of our trademarks.
|
||||
//
|
||||
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
|
||||
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
|
||||
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
|
||||
export const excludeFiles = ["../../../packages/shared/utils/encoder.ts"];
|
||||
|
||||
export const excludeDirs = [
|
||||
"../../../packages/client/node_modules",
|
||||
"../../../packages/shared/node_modules",
|
||||
"../../../packages/login/node_modules",
|
||||
"../../../packages/doceditor/node_modules",
|
||||
"../../../packages/management/node_modules",
|
||||
"../../../packages/doceditor/.next",
|
||||
"../../../packages/login/.next",
|
||||
"../../../packages/login/dist",
|
||||
"../../../packages/shared/themes",
|
||||
];
|
42
common/Tests/colors-test/src/index.js
Normal file
42
common/Tests/colors-test/src/index.js
Normal file
@ -0,0 +1,42 @@
|
||||
// (c) Copyright Ascensio System SIA 2010-2024
|
||||
//
|
||||
// This program is a free software product.
|
||||
// You can redistribute it and/or modify it under the terms
|
||||
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
|
||||
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
|
||||
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
|
||||
// any third-party rights.
|
||||
//
|
||||
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
|
||||
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
//
|
||||
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
|
||||
//
|
||||
// The interactive user interfaces in modified source and object code versions of the Program must
|
||||
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
|
||||
//
|
||||
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
|
||||
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
|
||||
// trademark law for use of our trademarks.
|
||||
//
|
||||
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
|
||||
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
|
||||
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
|
||||
import fs from "fs";
|
||||
import { searchDirectoryForHexColors } from "./utils.js";
|
||||
import { excludeDirs, excludeFiles } from "./exclude.js";
|
||||
import { generateReport } from "./report.js";
|
||||
|
||||
const directoryPath = "../../../packages";
|
||||
const reportName = `colors_report_${new Date().toJSON()}.html`;
|
||||
|
||||
const hexColorsFound = searchDirectoryForHexColors(
|
||||
directoryPath,
|
||||
excludeFiles,
|
||||
excludeDirs
|
||||
);
|
||||
|
||||
const htmlReport = generateReport(hexColorsFound);
|
||||
fs.writeFileSync(reportName, htmlReport, "utf-8");
|
67
common/Tests/colors-test/src/report.js
Normal file
67
common/Tests/colors-test/src/report.js
Normal file
@ -0,0 +1,67 @@
|
||||
// (c) Copyright Ascensio System SIA 2010-2024
|
||||
//
|
||||
// This program is a free software product.
|
||||
// You can redistribute it and/or modify it under the terms
|
||||
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
|
||||
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
|
||||
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
|
||||
// any third-party rights.
|
||||
//
|
||||
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
|
||||
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
//
|
||||
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
|
||||
//
|
||||
// The interactive user interfaces in modified source and object code versions of the Program must
|
||||
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
|
||||
//
|
||||
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
|
||||
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
|
||||
// trademark law for use of our trademarks.
|
||||
//
|
||||
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
|
||||
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
|
||||
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
|
||||
export function generateReport(hexColorsFound) {
|
||||
let htmlReport = `
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Colors report</title>
|
||||
<style>
|
||||
body { font-family: Arial, sans-serif; margin: 20px; }
|
||||
h1 { color: #333; }
|
||||
h3 { margin-top: 8px; }
|
||||
ul { list-style-type: none; padding: 0; }
|
||||
li { margin-bottom: 4px; }
|
||||
.color-box { display: inline-block; width: 16px; height: 16px; margin-right: 8px; vertical-align: middle; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Colors Report</h1>
|
||||
<p>Found colors in the following files:</p>
|
||||
`;
|
||||
|
||||
Object.keys(hexColorsFound).forEach((file) => {
|
||||
htmlReport += `<h3>File: ${file}</h3><ul>`;
|
||||
hexColorsFound[file].forEach((color) => {
|
||||
htmlReport += `
|
||||
<li>
|
||||
<div class="color-box" style="background-color: ${color};"></div>
|
||||
${color}
|
||||
</li>`;
|
||||
});
|
||||
htmlReport += "</ul>";
|
||||
});
|
||||
|
||||
htmlReport += `
|
||||
<p>Total files with colors: ${Object.keys(hexColorsFound).length}</p>
|
||||
</body>
|
||||
</html>`;
|
||||
|
||||
return htmlReport;
|
||||
}
|
72
common/Tests/colors-test/src/utils.js
Normal file
72
common/Tests/colors-test/src/utils.js
Normal file
@ -0,0 +1,72 @@
|
||||
// (c) Copyright Ascensio System SIA 2010-2024
|
||||
//
|
||||
// This program is a free software product.
|
||||
// You can redistribute it and/or modify it under the terms
|
||||
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
|
||||
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
|
||||
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
|
||||
// any third-party rights.
|
||||
//
|
||||
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
|
||||
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
|
||||
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
//
|
||||
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
|
||||
//
|
||||
// The interactive user interfaces in modified source and object code versions of the Program must
|
||||
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
|
||||
//
|
||||
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
|
||||
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
|
||||
// trademark law for use of our trademarks.
|
||||
//
|
||||
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
|
||||
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
|
||||
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
|
||||
const hexColorPattern = /#(?:[0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})\b/g;
|
||||
|
||||
export function findHexColorsInFile(filePath) {
|
||||
const content = fs.readFileSync(filePath, "utf-8");
|
||||
const matches = content.match(hexColorPattern);
|
||||
return matches || [];
|
||||
}
|
||||
|
||||
export function searchDirectoryForHexColors(
|
||||
directory,
|
||||
excludeFiles = [],
|
||||
excludeDirs = []
|
||||
) {
|
||||
let hexColors = {};
|
||||
|
||||
function walkDirectory(currentPath) {
|
||||
const items = fs.readdirSync(currentPath);
|
||||
|
||||
items.forEach((item) => {
|
||||
const fullPath = path.join(currentPath, item);
|
||||
const isDirectory = fs.statSync(fullPath).isDirectory();
|
||||
|
||||
if (isDirectory) {
|
||||
if (!excludeDirs.includes(fullPath)) {
|
||||
walkDirectory(fullPath);
|
||||
}
|
||||
} else {
|
||||
if (
|
||||
!excludeFiles.includes(fullPath) &&
|
||||
/\.(js|ts|jsx|tsx)$/.test(item)
|
||||
) {
|
||||
const matches = findHexColorsInFile(fullPath);
|
||||
if (matches.length > 0) {
|
||||
hexColors[fullPath] = matches;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
walkDirectory(directory);
|
||||
return hexColors;
|
||||
}
|
12
common/Tests/colors-test/yarn.lock
Normal file
12
common/Tests/colors-test/yarn.lock
Normal file
@ -0,0 +1,12 @@
|
||||
# This file is generated by running "yarn install" inside your project.
|
||||
# Manual changes might be lost - proceed with caution!
|
||||
|
||||
__metadata:
|
||||
version: 8
|
||||
cacheKey: 10
|
||||
|
||||
"colors-test@workspace:.":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "colors-test@workspace:."
|
||||
languageName: unknown
|
||||
linkType: soft
|
@ -49,20 +49,16 @@ const {
|
||||
darkBlack,
|
||||
|
||||
lightGrayBlackout,
|
||||
darkGrayBlackout,
|
||||
grayLight,
|
||||
darkGrayLight,
|
||||
lightGrayHover,
|
||||
lightDarkGrayHover,
|
||||
grayLightMid,
|
||||
grayDarkMid,
|
||||
lightGraySelected,
|
||||
grayStrong,
|
||||
grayDarkStrong,
|
||||
gray,
|
||||
grayDark,
|
||||
lightGrayDark,
|
||||
darkGrayDark,
|
||||
grayText,
|
||||
grayDarkText,
|
||||
lightBlueMain,
|
||||
@ -76,32 +72,21 @@ const {
|
||||
mainGreen,
|
||||
|
||||
lightErrorStatus,
|
||||
darkErrorStatus,
|
||||
favoritesStatus,
|
||||
lightStatusWarning,
|
||||
darkStatusWarning,
|
||||
lightStatusPositive,
|
||||
darkStatusPositive,
|
||||
|
||||
lightIcons,
|
||||
darkIcon,
|
||||
link,
|
||||
darkLink,
|
||||
blueLightMid,
|
||||
|
||||
lightToastDone,
|
||||
darkToastDone,
|
||||
lightToastInfo,
|
||||
darkToastInfo,
|
||||
lightToastAlert,
|
||||
darkToastAlert,
|
||||
lightToastWarning,
|
||||
darkToastWarning,
|
||||
|
||||
dndColor,
|
||||
dndDarkColor,
|
||||
dndHoverColor,
|
||||
dndDarkHover,
|
||||
|
||||
onWhiteColor,
|
||||
boxShadowColor,
|
||||
|
@ -37,7 +37,6 @@ const {
|
||||
black,
|
||||
darkBlack,
|
||||
|
||||
lightGrayBlackout,
|
||||
darkGrayBlackout,
|
||||
grayLight,
|
||||
darkGrayLight,
|
||||
@ -64,28 +63,21 @@ const {
|
||||
|
||||
mainOrange,
|
||||
|
||||
lightErrorStatus,
|
||||
darkErrorStatus,
|
||||
favoritesStatus,
|
||||
lightStatusWarning,
|
||||
darkStatusWarning,
|
||||
lightStatusPositive,
|
||||
darkStatusPositive,
|
||||
|
||||
lightIcons,
|
||||
darkIcon,
|
||||
link,
|
||||
darkLink,
|
||||
blueLightMid,
|
||||
bigGrayDarkMid,
|
||||
|
||||
lightToastDone,
|
||||
darkToastDone,
|
||||
lightToastInfo,
|
||||
darkToastInfo,
|
||||
lightToastAlert,
|
||||
darkToastAlert,
|
||||
lightToastWarning,
|
||||
darkToastWarning,
|
||||
|
||||
dndColor,
|
||||
@ -665,7 +657,7 @@ const Dark: TTheme = {
|
||||
color: white,
|
||||
disableColor: grayDarkText,
|
||||
|
||||
backgroundColor: black,
|
||||
backgroundColor: darkGrayLight,
|
||||
disableBackgroundColor: grayDarkStrong,
|
||||
|
||||
width: {
|
||||
|
Loading…
Reference in New Issue
Block a user