mirror of
https://github.com/affaan-m/ECC.git
synced 2026-09-30 21:45:13 +02:00
fix(install): accept UTF-8 BOM in install configs
This commit is contained in:
@@ -10,7 +10,9 @@ let cachedValidator = null;
|
||||
|
||||
function readJson(filePath, label) {
|
||||
try {
|
||||
return JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
||||
// Windows PowerShell 5.1 writes a BOM with Set-Content -Encoding UTF8.
|
||||
const content = fs.readFileSync(filePath, 'utf8').replace(/^\uFEFF/, '');
|
||||
return JSON.parse(content);
|
||||
} catch (error) {
|
||||
throw new Error(`Invalid JSON in ${label}: ${error.message}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user