Merged PR 1815: Angular Update V18

Related work items: #4830, #4834
This commit is contained in:
Lorenz Hilpert
2024-10-22 09:23:23 +00:00
committed by Nino Righi
parent 301f5878c2
commit 8ae990bcde
1026 changed files with 397921 additions and 12034 deletions

23
tools/download-file.js Normal file
View File

@@ -0,0 +1,23 @@
/**
* Script that downloads the swagger file from the given url
*/
const fetch = require('node-fetch');
const https = require('https');
const path = require('path');
const httpsAgent = new https.Agent({
rejectUnauthorized: false,
});
(async () => {
const url = process.argv[2];
const fileName = process.argv[3];
const res = await fetch(url, {
agent: httpsAgent,
});
// Write the file to the disk
const fileStream = require('fs').createWriteStream(fileName);
res.body.pipe(fileStream);
console.log('Swagger file downloaded successfully');
})();

43
tools/fix-files.js Normal file
View File

@@ -0,0 +1,43 @@
const fs = require('fs');
const path = require('path');
/**
* Script that removes \ufffd for all files in a specified directory and its subdirectories.
*/
const directoryPath = process.argv[2]; // Get the target directory from command-line arguments
function removeInvalidChars(filePath) {
fs.readFile(filePath, 'utf8', (err, data) => {
if (err) {
console.error(`Error reading file ${filePath}:`, err);
return;
}
const cleanedData = data.replace(/\ufffd/g, '');
fs.writeFile(filePath, cleanedData, 'utf8', (err) => {
if (err) {
console.error(`Error writing file ${filePath}:`, err);
} else {
console.log(`Fixed file: ${filePath}`);
}
});
});
}
function traverseDirectory(dir) {
fs.readdir(dir, { withFileTypes: true }, (err, files) => {
if (err) {
console.error(`Error reading directory ${dir}:`, err);
return;
}
files.forEach((file) => {
const fullPath = path.join(dir, file.name);
if (file.isDirectory()) {
traverseDirectory(fullPath);
} else if (file.isFile()) {
removeInvalidChars(fullPath);
}
});
});
}
traverseDirectory(directoryPath);