From bc8ba08ad0369fdf13e138e094677707a99622c9 Mon Sep 17 00:00:00 2001 From: Aakansha Doshi Date: Sat, 3 Jul 2021 18:50:22 +0530 Subject: [PATCH] build: Add script to update readme before stable release (#3781) * build: Add script to update readme before stable release * fix * fix --- scripts/updateReadme.js | 23 +++++++++++++++++++++++ src/packages/excalidraw/README_NEXT.md | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 scripts/updateReadme.js diff --git a/scripts/updateReadme.js b/scripts/updateReadme.js new file mode 100644 index 00000000..1c923b21 --- /dev/null +++ b/scripts/updateReadme.js @@ -0,0 +1,23 @@ +const fs = require("fs"); + +const excalidrawDir = `${__dirname}/../src/packages/excalidraw`; +let data = fs.readFileSync(`${excalidrawDir}/README_NEXT.md`, "utf8"); + +// remove note for unstable release +data = data.replace( + /[\s\S]*?/, + "", +); + +// replace "excalidraw-next" with "excalidraw" +data = data.replace(/excalidraw-next/g, "excalidraw"); +data = data.trim(); + +const demoIndex = data.indexOf("### Demo"); +const excalidrawNextNote = + "#### Note\n\n**If you don't want to wait for the next stable release and try out the unreleased changes you can use [@excalidraw/excalidraw-next](https://www.npmjs.com/package/@excalidraw/excalidraw-next).**\n\n"; +// Add excalidraw next note to try out for unreleased changes +data = data.slice(0, demoIndex) + excalidrawNextNote + data.slice(demoIndex); + +// update readme +fs.writeFileSync(`${excalidrawDir}/README.md`, data, "utf8"); diff --git a/src/packages/excalidraw/README_NEXT.md b/src/packages/excalidraw/README_NEXT.md index 1cb4d852..047eb5e2 100644 --- a/src/packages/excalidraw/README_NEXT.md +++ b/src/packages/excalidraw/README_NEXT.md @@ -1,4 +1,4 @@ - + ## Note @@ -6,7 +6,7 @@ For stable release please use [@excalidraw/excalidraw](https://www.npmjs.com/package/@excalidraw/excalidraw). - + ### Excalidraw