build: Add script to update readme before stable release (#3781)
* build: Add script to update readme before stable release * fix * fix
This commit is contained in:
parent
f861a9fdd0
commit
bc8ba08ad0
23
scripts/updateReadme.js
Normal file
23
scripts/updateReadme.js
Normal file
@ -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(
|
||||
/<!-- unstable-readme-start-->[\s\S]*?<!-- unstable-readme-end-->/,
|
||||
"",
|
||||
);
|
||||
|
||||
// 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");
|
@ -1,4 +1,4 @@
|
||||
<!-- stable-readme-start-->
|
||||
<!-- unstable-readme-start-->
|
||||
|
||||
## Note
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
|
||||
For stable release please use [@excalidraw/excalidraw](https://www.npmjs.com/package/@excalidraw/excalidraw).
|
||||
|
||||
<!-- stable-readme-end-->
|
||||
<!-- unstable-readme-end-->
|
||||
|
||||
### Excalidraw
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user