From 07c9a002aee7f8ca227e6f02bcc06eae7398174e Mon Sep 17 00:00:00 2001 From: VItto Rivabella <72762629+Eversmile12@users.noreply.github.com> Date: Mon, 5 Feb 2024 14:09:18 +0100 Subject: [PATCH 1/5] Update README.md --- README.md | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 167fd195..004fa342 100644 --- a/README.md +++ b/README.md @@ -66,14 +66,20 @@ Our content is structured as follows: - `courses/` - `course_name/` - - `lesson_name/` - - `lesson_content.md` + - `section_name/` + - `lesson_name/` + - `lesson_content.md` -Each course is contained within its own directory, and within each course, you will find directories for each lesson, which contain a Markdown file (.md) with the lesson's content. +Each course is contained within its directory, and for each course, you will find directories for each lesson, which contain a Markdown file (.md) with the lesson's content. ## How to Contribute -We deeply value community contributions, whether it's correcting typos, enhancing code snippets, or refining our educational content. Here's how you can contribute: +We deeply value every kind of community contribution: +- Correcting typos or subtitles +- Enhancing code snippets +- Refining our educational content + +Here's how you can contribute: ### Prerequisites @@ -114,7 +120,7 @@ We deeply value community contributions, whether it's correcting typos, enhancin 7. **Create a Pull Request (PR):** Go to the original Cyfrin Updraft repository on GitHub and create a pull request from your forked repository. In your PR, explain the changes you've made and why they're beneficial. -8. **Await Review:** Your PR will be reviewed by the Cyfrin team or community maintainers. Be responsive to any feedback or requested changes. +8. **Await Review:** The Cyfrin team or community maintainers will review your PR. Be responsive to any feedback or requested changes. ### Best Practices for Contribution @@ -139,7 +145,7 @@ This project exists thanks to all the people who contribute.
## License -Cyfrin Updraft content is open sourced [licensed as GPLv3](https://github.com/cyfrin/updraft/blob/main/LICENSE). +Cyfrin Updraft content is open-sourced [licensed as GPLv3](https://github.com/cyfrin/updraft/blob/main/LICENSE). [![Cyfrin Twitter](https://img.shields.io/badge/Twitter-1DA1F2?style=for-the-badge&logo=twitter&logoColor=white)](https://twitter.com/cyfrinupdraft) @@ -152,4 +158,4 @@ git clone https://github.com/Cyfrin/Updraft cd Updraft pnpm install pnpm dev -``` \ No newline at end of file +``` From 53cace355d8158cc8f14c3f4bb6720061abd0913 Mon Sep 17 00:00:00 2001 From: hunter <104146303+solhosty@users.noreply.github.com> Date: Tue, 6 Feb 2024 18:57:54 -0500 Subject: [PATCH 2/5] Update update-json.yml --- .github/workflows/update-json.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-json.yml b/.github/workflows/update-json.yml index 1df92d95..10275539 100644 --- a/.github/workflows/update-json.yml +++ b/.github/workflows/update-json.yml @@ -20,7 +20,7 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v2 with: - node-version: '14' + node-version: '20' - name: Run script to update JSON run: node update_json.js From 81dc975283b1125e2067f6b8d0261a9507b30407 Mon Sep 17 00:00:00 2001 From: hunter <104146303+solhosty@users.noreply.github.com> Date: Fri, 8 Mar 2024 06:56:16 -0500 Subject: [PATCH 3/5] Update update-json.yml --- .github/workflows/update-json.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-json.yml b/.github/workflows/update-json.yml index 10275539..1df92d95 100644 --- a/.github/workflows/update-json.yml +++ b/.github/workflows/update-json.yml @@ -20,7 +20,7 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v2 with: - node-version: '20' + node-version: '14' - name: Run script to update JSON run: node update_json.js From b7b863b1675e5a3f8a237ec66f28c52e2f9a9d1d Mon Sep 17 00:00:00 2001 From: hunter <104146303+solhosty@users.noreply.github.com> Date: Fri, 8 Mar 2024 07:25:47 -0500 Subject: [PATCH 4/5] remove workflows --- .github/workflows/update-json.yml | 34 ------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 .github/workflows/update-json.yml diff --git a/.github/workflows/update-json.yml b/.github/workflows/update-json.yml deleted file mode 100644 index 1df92d95..00000000 --- a/.github/workflows/update-json.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Update JSON on Markdown Change - -on: - pull_request: - paths: - - '**/*.md' - push: - branches: - - main - - dev - paths: - - '**/*.md' -jobs: - update-json: - runs-on: ubuntu-latest - steps: - - name: Check out repository - uses: actions/checkout@v2 - - - name: Set up Node.js - uses: actions/setup-node@v2 - with: - node-version: '14' - - - name: Run script to update JSON - run: node update_json.js - - - name: Commit and push if changed - run: | - git config --global user.email "actions@github.com" - git config --global user.name "GitHub Actions" - git add -u - git commit -m "Updated JSON file via GitHub Actions" || exit 0 # This will not fail if no changes - git push From 5e837af23fb6b441181a7e07714c6092367df224 Mon Sep 17 00:00:00 2001 From: hunter <104146303+solhosty@users.noreply.github.com> Date: Fri, 8 Mar 2024 07:28:48 -0500 Subject: [PATCH 5/5] remove workflows --- update_json.js | 57 -------------------------------------------------- 1 file changed, 57 deletions(-) delete mode 100644 update_json.js diff --git a/update_json.js b/update_json.js deleted file mode 100644 index 36458e60..00000000 --- a/update_json.js +++ /dev/null @@ -1,57 +0,0 @@ -const fs = require("fs"); -const path = require("path"); -const { execSync } = require("child_process"); - -const coursesPath = "courses"; -const jsonFilesPath = "content/courses"; - -// Function to update the corresponding JSON file for a changed Markdown file -function updateJsonForMarkdown(mdFilePath) { - // Extract course slug from the Markdown file path - const courseSlug = path.basename(path.dirname(path.dirname(mdFilePath))); - - // Construct the path to the corresponding JSON file - const jsonFilePath = path.join(jsonFilesPath, courseSlug + ".json"); - - // Check if the JSON file exists - if (!fs.existsSync(jsonFilePath)) { - console.log(`JSON file not found for course: ${courseSlug}`); - return; - } - - // Read the Markdown file - const markdownContent = fs.readFileSync(mdFilePath, "utf8"); - - // Read and update the JSON file - const jsonContent = JSON.parse(fs.readFileSync(jsonFilePath, "utf8")); - - // Iterate through sections and lessons to find the correct one to update - let updated = false; - jsonContent.sections.forEach((section) => { - section.lessons.forEach((lesson) => { - if (lesson.rawMarkdownUrl === mdFilePath.replace(coursesPath, "")) { - lesson.markdownContent = markdownContent; - updated = true; - } - }); - }); - - if (!updated) { - console.log(`Lesson not found in JSON for Markdown file: ${mdFilePath}`); - return; - } - - // Write updated JSON back to file - fs.writeFileSync(jsonFilePath, JSON.stringify(jsonContent, null, 2)); -} - -// Get a list of changed Markdown files -const changedFiles = execSync("git diff --name-only HEAD HEAD~1") - .toString() - .split("\n"); -changedFiles.forEach((file) => { - if (file.startsWith(coursesPath) && path.extname(file) === ".md") { - console.log(`Updating JSON for changed file: ${file}`); - updateJsonForMarkdown(file); - } -});