From fd179d524fb92723454374bc42cb58c2dfb19a10 Mon Sep 17 00:00:00 2001 From: "radek.Bednarik" Date: Sun, 17 Dec 2023 08:16:44 +0100 Subject: [PATCH 1/2] fix: clear up saveJsonFile func --- src/io/io.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/io/io.ts b/src/io/io.ts index 28d75b7..aa214b0 100644 --- a/src/io/io.ts +++ b/src/io/io.ts @@ -26,10 +26,11 @@ export async function readJsonFile(filePath: string): Promise { export async function saveJsonFile(filePath: string, data: any): Promise { try { const fullPath = resolve(filePath); + const _data = JSON.stringify(data, null, 2); - log.trace(`Saving JSON file: ${fullPath} with data: ${JSON.stringify(data)}}`); + log.trace(`Saving JSON file: ${fullPath} with data: ${data}}`); - await writeFile(resolve(filePath), JSON.stringify(data, null, 2), "utf-8"); + await writeFile(fullPath, _data, { encoding: "utf-8" }); log.trace(`JSON file saved`); } catch (error: any) { From 7ff2e272eea3ab4bb2ba58c4e69ee72828b6583d Mon Sep 17 00:00:00 2001 From: "radek.Bednarik" Date: Sun, 17 Dec 2023 08:17:24 +0100 Subject: [PATCH 2/2] 0.2.1 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4b1a6c9..9820d98 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "mockserver-cli", - "version": "0.2.0", + "version": "0.2.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "mockserver-cli", - "version": "0.2.0", + "version": "0.2.1", "license": "ISC", "dependencies": { "commander": "^11.1.0", diff --git a/package.json b/package.json index 472b5fb..7c47d55 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bednarik_radek/mockserver-cli", - "version": "0.2.0", + "version": "0.2.1", "description": "CLI utility for Mock-server client. Allows for easy creation/deletion of expectations on the Mock-server instance.", "main": "index.js", "type": "module",