@angular-architects/native-federation
Advanced tools
Comparing version
{ | ||
"name": "@angular-architects/native-federation", | ||
"version": "20.0.4", | ||
"version": "20.0.5", | ||
"main": "src/index.js", | ||
@@ -5,0 +5,0 @@ "generators": "./collection.json", |
@@ -20,2 +20,3 @@ "use strict"; | ||
const json5_1 = tslib_1.__importDefault(require("json5")); | ||
const node_util_1 = require("node:util"); | ||
let _memResultHandler; | ||
@@ -208,3 +209,3 @@ function setMemResultHandler(handler) { | ||
const tsconfigFedPath = path.join(tsconfigDir, 'tsconfig.federation.json'); | ||
if (!doesFileExist(tsconfigFedPath, content)) { | ||
if (!doesFileExistAndJsonEqual(tsconfigFedPath, content)) { | ||
fs.writeFileSync(tsconfigFedPath, JSON.stringify(tsconfig, null, 2)); | ||
@@ -215,2 +216,24 @@ } | ||
} | ||
/** | ||
* Checks if a file exists and if its content is equal to the provided content. | ||
* If the file does not exist, it returns false. | ||
* If the file or its content is invalid JSON, it returns false. | ||
* @param {string} path - The path to the file | ||
* @param {string} content - The content to compare with | ||
* @returns {boolean} - Returns true if the file exists and its content is equal to the provided content | ||
*/ | ||
function doesFileExistAndJsonEqual(path, content) { | ||
if (!fs.existsSync(path)) { | ||
return false; | ||
} | ||
try { | ||
const currentContent = fs.readFileSync(path, 'utf-8'); | ||
const currentJson = json5_1.default.parse(currentContent); | ||
const newJson = json5_1.default.parse(content); | ||
return (0, node_util_1.isDeepStrictEqual)(currentJson, newJson); | ||
} | ||
catch (_error) { | ||
return false; | ||
} | ||
} | ||
function doesFileExist(path, content) { | ||
@@ -217,0 +240,0 @@ if (!fs.existsSync(path)) { |
Sorry, the diff of this file is not supported yet
259284
0.54%2466
0.94%