From c8135b45c27528eacbc78e6f06feebd5a69a6da3 Mon Sep 17 00:00:00 2001 From: henry Date: Thu, 4 Jan 2024 23:03:18 +0900 Subject: [PATCH 1/2] fix: correct files' field to use latest name --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 379ebd7c..b499689b 100644 --- a/README.md +++ b/README.md @@ -188,8 +188,9 @@ generateApi({ } }) .then(({ files, configuration }) => { - files.forEach(({ content, name }) => { - fs.writeFile(path, content); + files.forEach(({ fileContent, fileName, fileExtension }) => { + const path = `${PATH_TO_OUTPUT_DIR}/${fileName}${fileExtension}`; + fs.writeFile(path, fileContent); }); }) .catch(e => console.error(e)) From efdf1a5b037cb69c17a141b8e53bfcd69d30d0bd Mon Sep 17 00:00:00 2001 From: henry Date: Thu, 4 Jan 2024 23:03:42 +0900 Subject: [PATCH 2/2] fix: writeFile takes callback --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b499689b..2d2561b3 100644 --- a/README.md +++ b/README.md @@ -190,7 +190,10 @@ generateApi({ .then(({ files, configuration }) => { files.forEach(({ fileContent, fileName, fileExtension }) => { const path = `${PATH_TO_OUTPUT_DIR}/${fileName}${fileExtension}`; - fs.writeFile(path, fileContent); + fs.writeFile(path, fileContent, (err) => { + if (err) throw err; + console.log(`${path} has been saved!`); + }); }); }) .catch(e => console.error(e))