@eventcatalog/sdk 2.3.4 → 2.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -250,7 +250,14 @@ var rmResourceById = async (catalogDir, id, version, options) => {
250
250
  var addFileToResource = async (catalogDir, id, file, version) => {
251
251
  const pathToResource = await findFileById(catalogDir, id, version);
252
252
  if (!pathToResource) throw new Error("Cannot find directory to write file to");
253
- fsSync2.writeFileSync(join2(dirname2(pathToResource), file.fileName), file.content);
253
+ let fileContent = file.content.trim();
254
+ try {
255
+ const json = JSON.parse(fileContent);
256
+ fileContent = JSON.stringify(json, null, 2);
257
+ } catch (error) {
258
+ console.error(error);
259
+ }
260
+ fsSync2.writeFileSync(join2(dirname2(pathToResource), file.fileName), fileContent);
254
261
  };
255
262
  var getFileFromResource = async (catalogDir, id, file, version) => {
256
263
  const pathToResource = await findFileById(catalogDir, id, version);