Skip to content

Commit e3a7db6

Browse files
Script Updated (#14)
* script updated * Update latest videos * Update latest videos * Update latest videos * Update latest videos * Update latest videos --------- Co-authored-by: GitHub Actions <[email protected]>
1 parent a413576 commit e3a7db6

File tree

3 files changed

+22
-24
lines changed

3 files changed

+22
-24
lines changed

.github/scripts/updateVideos.mjs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,17 @@ const updateReadme = async (videos, readmePath) => {
104104

105105
const startTag = "<!-- latest-videos -->";
106106
const endTag = "<!-- latest-videos-end -->";
107-
const startIdx = readmeContent.indexOf(startTag) + startTag.length;
108-
const endIdx = readmeContent.indexOf(endTag);
109107

110-
if (startIdx === -1 || endIdx === -1) {
108+
const start = readmeContent.indexOf(startTag);
109+
const end = readmeContent.indexOf(endTag);
110+
111+
if (start === -1 || end === -1) {
111112
throw new Error("Start or end tags not found in README.");
112113
}
113114

115+
const before = readmeContent.slice(0, start + startTag.length);
116+
const after = readmeContent.slice(end);
117+
114118
const videosMarkdown = `
115119
<table border="0">
116120
${videos
@@ -135,19 +139,21 @@ const updateReadme = async (videos, readmePath) => {
135139
<br/>
136140
<p>${video.description?.replace(/\n/g, " ").slice(0, 300).trim()}...</p>
137141
</td>
138-
</tr>
139-
`
142+
</tr>`
140143
)
141144
.join("")}
142145
</table>
143146
`;
144147

145-
readmeContent = `${readmeContent.substring(
146-
0,
147-
startIdx
148-
)}\n${videosMarkdown.trim()}\n${readmeContent.substring(endIdx)}`;
148+
const newContent = `
149+
${before}
150+
151+
${videosMarkdown.trim()}
152+
153+
${after}
154+
`.trim();
149155

150-
await fs.writeFile(readmePath, readmeContent, "utf-8");
156+
await fs.writeFile(readmePath, newContent, "utf-8");
151157
log("✅ README successfully updated with latest videos.");
152158
} catch (error) {
153159
errorLog("Error updating README: " + error.message);

README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Join me on YouTube, where I pour years of gathered wisdom into empowering you. T
3636
Check out my latest videos:
3737

3838
<!-- latest-videos -->
39+
3940
<table border="0">
4041

4142
<tr>
@@ -52,7 +53,6 @@ Check out my latest videos:
5253
<p>Welcome to Part 2 of The Ultimate React Performance Guide. During this advanced session, we go beyond memoization and ......</p>
5354
</td>
5455
</tr>
55-
5656
<tr>
5757
<td style="padding: 10px; vertical-align: top;">
5858
<a href="https://www.youtube.com/watch?v=kHcc9lCbzLk" target="_blank">
@@ -67,7 +67,6 @@ Check out my latest videos:
6767
<p>Developers… English-এ দুর্বল? Interview-এ আটকে যাচ্ছেন? Documentation পড়তে কষ্ট হয়?...</p>
6868
</td>
6969
</tr>
70-
7170
<tr>
7271
<td style="padding: 10px; vertical-align: top;">
7372
<a href="https://www.youtube.com/watch?v=G8Mk6lsSOcw" target="_blank">
@@ -82,7 +81,6 @@ Check out my latest videos:
8281
<p>Welcome to Part 1 of the React Performance Mastery Series! In this video, we break down the core fundamentals every React ......</p>
8382
</td>
8483
</tr>
85-
8684
<tr>
8785
<td style="padding: 10px; vertical-align: top;">
8886
<a href="https://www.youtube.com/watch?v=ax2BryZwkMQ" target="_blank">
@@ -97,7 +95,6 @@ Check out my latest videos:
9795
<p>Welcome Developers! এই ভিডিওতে আপনি শিখবেন Top 10 JavaScript Code Snippets যেগুলো আপনার ......</p>
9896
</td>
9997
</tr>
100-
10198
<tr>
10299
<td style="padding: 10px; vertical-align: top;">
103100
<a href="https://www.youtube.com/watch?v=ociC3llkLHk" target="_blank">
@@ -112,7 +109,6 @@ Check out my latest videos:
112109
<p>In this video, you will learn the Pub-Sub (Publish–Subscribe) Design Pattern in React with real-world architecture, clean code, and ......</p>
113110
</td>
114111
</tr>
115-
116112
<tr>
117113
<td style="padding: 10px; vertical-align: top;">
118114
<a href="https://www.youtube.com/watch?v=IGK3Bv7EuEc" target="_blank">
@@ -127,6 +123,6 @@ Check out my latest videos:
127123
<p>Big-O Notation & Time–Space Complexity finally explained in Bangla, with real examples, visuals, code walkthroughs, and a full ......</p>
128124
</td>
129125
</tr>
130-
131126
</table>
132-
<!-- latest-videos-end -->
127+
128+
<!-- latest-videos-end -->

profile/README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Join me on YouTube, where I pour years of gathered wisdom into empowering you. T
3838
Check out my latest videos:
3939

4040
<!-- latest-videos -->
41+
4142
<table border="0">
4243

4344
<tr>
@@ -54,7 +55,6 @@ Check out my latest videos:
5455
<p>Welcome to Part 2 of The Ultimate React Performance Guide. During this advanced session, we go beyond memoization and ......</p>
5556
</td>
5657
</tr>
57-
5858
<tr>
5959
<td style="padding: 10px; vertical-align: top;">
6060
<a href="https://www.youtube.com/watch?v=kHcc9lCbzLk" target="_blank">
@@ -69,7 +69,6 @@ Check out my latest videos:
6969
<p>Developers… English-এ দুর্বল? Interview-এ আটকে যাচ্ছেন? Documentation পড়তে কষ্ট হয়?...</p>
7070
</td>
7171
</tr>
72-
7372
<tr>
7473
<td style="padding: 10px; vertical-align: top;">
7574
<a href="https://www.youtube.com/watch?v=G8Mk6lsSOcw" target="_blank">
@@ -84,7 +83,6 @@ Check out my latest videos:
8483
<p>Welcome to Part 1 of the React Performance Mastery Series! In this video, we break down the core fundamentals every React ......</p>
8584
</td>
8685
</tr>
87-
8886
<tr>
8987
<td style="padding: 10px; vertical-align: top;">
9088
<a href="https://www.youtube.com/watch?v=ax2BryZwkMQ" target="_blank">
@@ -99,7 +97,6 @@ Check out my latest videos:
9997
<p>Welcome Developers! এই ভিডিওতে আপনি শিখবেন Top 10 JavaScript Code Snippets যেগুলো আপনার ......</p>
10098
</td>
10199
</tr>
102-
103100
<tr>
104101
<td style="padding: 10px; vertical-align: top;">
105102
<a href="https://www.youtube.com/watch?v=ociC3llkLHk" target="_blank">
@@ -114,7 +111,6 @@ Check out my latest videos:
114111
<p>In this video, you will learn the Pub-Sub (Publish–Subscribe) Design Pattern in React with real-world architecture, clean code, and ......</p>
115112
</td>
116113
</tr>
117-
118114
<tr>
119115
<td style="padding: 10px; vertical-align: top;">
120116
<a href="https://www.youtube.com/watch?v=IGK3Bv7EuEc" target="_blank">
@@ -129,6 +125,6 @@ Check out my latest videos:
129125
<p>Big-O Notation & Time–Space Complexity finally explained in Bangla, with real examples, visuals, code walkthroughs, and a full ......</p>
130126
</td>
131127
</tr>
132-
133128
</table>
134-
<!-- latest-videos-end -->
129+
130+
<!-- latest-videos-end -->

0 commit comments

Comments
 (0)