|
@@ -1,23 +1,27 @@
|
1
|
1
|
const fs = require("fs");
|
2
|
2
|
|
3
|
|
-const excalidrawDir = `${__dirname}/../src/packages/excalidraw`;
|
4
|
|
-let data = fs.readFileSync(`${excalidrawDir}/README_NEXT.md`, "utf8");
|
|
3
|
+const updateReadme = () => {
|
|
4
|
+ const excalidrawDir = `${__dirname}/../src/packages/excalidraw`;
|
|
5
|
+ let data = fs.readFileSync(`${excalidrawDir}/README_NEXT.md`, "utf8");
|
5
|
6
|
|
6
|
|
-// remove note for unstable release
|
7
|
|
-data = data.replace(
|
8
|
|
- /<!-- unstable-readme-start-->[\s\S]*?<!-- unstable-readme-end-->/,
|
9
|
|
- "",
|
10
|
|
-);
|
|
7
|
+ // remove note for unstable release
|
|
8
|
+ data = data.replace(
|
|
9
|
+ /<!-- unstable-readme-start-->[\s\S]*?<!-- unstable-readme-end-->/,
|
|
10
|
+ "",
|
|
11
|
+ );
|
11
|
12
|
|
12
|
|
-// replace "excalidraw-next" with "excalidraw"
|
13
|
|
-data = data.replace(/excalidraw-next/g, "excalidraw");
|
14
|
|
-data = data.trim();
|
|
13
|
+ // replace "excalidraw-next" with "excalidraw"
|
|
14
|
+ data = data.replace(/excalidraw-next/g, "excalidraw");
|
|
15
|
+ data = data.trim();
|
15
|
16
|
|
16
|
|
-const demoIndex = data.indexOf("### Demo");
|
17
|
|
-const excalidrawNextNote =
|
18
|
|
- "#### 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";
|
19
|
|
-// Add excalidraw next note to try out for unreleased changes
|
20
|
|
-data = data.slice(0, demoIndex) + excalidrawNextNote + data.slice(demoIndex);
|
|
17
|
+ const demoIndex = data.indexOf("### Demo");
|
|
18
|
+ const excalidrawNextNote =
|
|
19
|
+ "#### 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";
|
|
20
|
+ // Add excalidraw next note to try out for unreleased changes
|
|
21
|
+ data = data.slice(0, demoIndex) + excalidrawNextNote + data.slice(demoIndex);
|
21
|
22
|
|
22
|
|
-// update readme
|
23
|
|
-fs.writeFileSync(`${excalidrawDir}/README.md`, data, "utf8");
|
|
23
|
+ // update readme
|
|
24
|
+ fs.writeFileSync(`${excalidrawDir}/README.md`, data, "utf8");
|
|
25
|
+};
|
|
26
|
+
|
|
27
|
+module.exports = updateReadme;
|