From 38819c93500c441b9adb50a3e76dde65b969eaa9 Mon Sep 17 00:00:00 2001 From: Damon <126731021+damon314159@users.noreply.github.com> Date: Mon, 23 Sep 2024 18:30:36 +0100 Subject: [PATCH 1/5] Inhouse deployment instructions --- .../project_restaurant_page.md | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/javascript/organizing_your_javascript_code/project_restaurant_page.md b/javascript/organizing_your_javascript_code/project_restaurant_page.md index 616a204e94f..92941142d75 100644 --- a/javascript/organizing_your_javascript_code/project_restaurant_page.md +++ b/javascript/organizing_your_javascript_code/project_restaurant_page.md @@ -36,8 +36,23 @@ When creating a new repo on GitHub, there is an option to specify a `.gitignore` 1. Next, set up your restaurant site to use tabbed browsing to access the Menu and Contact pages. Look at the behavior of this [student's live preview site](https://web.archive.org/web/20221024060550/https://eckben.github.io/bearysBreakfastBar/) for visual inspiration. 1. Put the contents of each "tab" inside of its own module. Each module will export a function that creates a div element, adds the appropriate content and styles to that element and then appends it to the DOM. 1. Write the tab-switching logic inside of `index.js`. You should have event listeners for each button in the header navbar that wipes out the current contents of `div#content` and then runs the correct 'tab module' to populate it with the new contents again. -1. Let's deploy to GitHub pages! First, we will need to bundle our application into `dist` by running `npx webpack`. Unfortunately, we need to do a little more work to deploy to GitHub pages, because GitHub Pages tries to look for an `index.html` *in the root of your project*, but yours is inside `dist`! We will need to do a few steps to push *the contents* of your `dist` directory to its own branch on GitHub, which will then have a root-level `index.html` for GitHub pages to serve. - 1. Follow the instructions in this [gist about deploying your dist subdirectory to GitHub pages](https://gist.github.com/cobyism/4730490). EZPZ! - 1. Recall that the **source branch** for GitHub Pages is set in your repository's settings. Get this changed to the `gh-pages` branch. + +#### Deployment + +Let's deploy your project to GitHub pages! This is a little more work than it has been for previous projects, because GitHub Pages tries to look for an `index.html` *in the root of your project*, but yours is inside `dist`! We will need to do a few steps to push *the contents* of your `dist` directory to its own branch on GitHub, which will then have a root-level `index.html` for GitHub pages to serve. You don't need to know exactly what all the commands do - as long as you follow the instructions below carefully you should be fine. You can use these instructions to deploy your project intially, and also redeploy it again if you make more changes to your project later. + +1. Make a new branch to deploy from by running `git branch gh-pages`. You only need to do this the first time you deploy. The rest of the steps should be done every time you deploy or redeploy your project. +1. Make sure you have all your work committed. You can use `git status` to see if there's anything that needs committing. +1. Run `git checkout gh-pages && git merge main --no-edit` to change branch so that you're ready to deploy. +1. Now let's bundle our application into `dist` with your build command. For now, that's `npx webpack`. +1. Now there are a few more commands. Run each of these in order. + + ```sh + git add dist -f && git commit -m "Deployment commit" + git subtree push --prefix dist origin gh-pages + git checkout main + ``` + +1. Recall that the **source branch** for GitHub Pages is set in your repository's settings. Get this changed to the `gh-pages` branch. That should be everything! From 325ca9e084f1779e9b2b1a9bb3853e9fc4525fdf Mon Sep 17 00:00:00 2001 From: Damon <126731021+damon314159@users.noreply.github.com> Date: Mon, 23 Sep 2024 18:35:43 +0100 Subject: [PATCH 2/5] Fix spelling --- .../project_restaurant_page.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/javascript/organizing_your_javascript_code/project_restaurant_page.md b/javascript/organizing_your_javascript_code/project_restaurant_page.md index 92941142d75..4795baf150e 100644 --- a/javascript/organizing_your_javascript_code/project_restaurant_page.md +++ b/javascript/organizing_your_javascript_code/project_restaurant_page.md @@ -39,7 +39,7 @@ When creating a new repo on GitHub, there is an option to specify a `.gitignore` #### Deployment -Let's deploy your project to GitHub pages! This is a little more work than it has been for previous projects, because GitHub Pages tries to look for an `index.html` *in the root of your project*, but yours is inside `dist`! We will need to do a few steps to push *the contents* of your `dist` directory to its own branch on GitHub, which will then have a root-level `index.html` for GitHub pages to serve. You don't need to know exactly what all the commands do - as long as you follow the instructions below carefully you should be fine. You can use these instructions to deploy your project intially, and also redeploy it again if you make more changes to your project later. +Let's deploy your project to GitHub pages! This is a little more work than it has been for previous projects, because GitHub Pages tries to look for an `index.html` *in the root of your project*, but yours is inside `dist`! We will need to do a few steps to push *the contents* of your `dist` directory to its own branch on GitHub, which will then have a root-level `index.html` for GitHub pages to serve. You don't need to know exactly what all the commands do - as long as you follow the instructions below carefully you should be fine. You can use these instructions to deploy your project initially, and also redeploy it again if you make more changes to your project later. 1. Make a new branch to deploy from by running `git branch gh-pages`. You only need to do this the first time you deploy. The rest of the steps should be done every time you deploy or redeploy your project. 1. Make sure you have all your work committed. You can use `git status` to see if there's anything that needs committing. @@ -47,7 +47,7 @@ Let's deploy your project to GitHub pages! This is a little more work than it ha 1. Now let's bundle our application into `dist` with your build command. For now, that's `npx webpack`. 1. Now there are a few more commands. Run each of these in order. - ```sh + ```bash git add dist -f && git commit -m "Deployment commit" git subtree push --prefix dist origin gh-pages git checkout main From e94b3a8069ac52d7d54d89299926d4dd6a48d756 Mon Sep 17 00:00:00 2001 From: Damon <126731021+damon314159@users.noreply.github.com> Date: Mon, 23 Sep 2024 20:45:20 +0100 Subject: [PATCH 3/5] Break long paragraph in two Co-authored-by: MaoShizhong <122839503+MaoShizhong@users.noreply.github.com> --- .../project_restaurant_page.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/javascript/organizing_your_javascript_code/project_restaurant_page.md b/javascript/organizing_your_javascript_code/project_restaurant_page.md index 4795baf150e..0a9d7f40ef6 100644 --- a/javascript/organizing_your_javascript_code/project_restaurant_page.md +++ b/javascript/organizing_your_javascript_code/project_restaurant_page.md @@ -39,7 +39,9 @@ When creating a new repo on GitHub, there is an option to specify a `.gitignore` #### Deployment -Let's deploy your project to GitHub pages! This is a little more work than it has been for previous projects, because GitHub Pages tries to look for an `index.html` *in the root of your project*, but yours is inside `dist`! We will need to do a few steps to push *the contents* of your `dist` directory to its own branch on GitHub, which will then have a root-level `index.html` for GitHub pages to serve. You don't need to know exactly what all the commands do - as long as you follow the instructions below carefully you should be fine. You can use these instructions to deploy your project initially, and also redeploy it again if you make more changes to your project later. +Let's deploy your project to GitHub pages! This is a little more work than it has been for previous projects, because GitHub Pages tries to look for an `index.html` *in the root of your project*, but yours is inside `dist`! We will need to do a few steps to push *the contents* of your `dist` directory to its own branch on GitHub, which will then have a root-level `index.html` for GitHub pages to serve. + +You don't need to know exactly what all the commands do - as long as you follow the instructions below carefully you should be fine. You can use these instructions to deploy your project initially, and also redeploy it again if you make more changes to your project later. 1. Make a new branch to deploy from by running `git branch gh-pages`. You only need to do this the first time you deploy. The rest of the steps should be done every time you deploy or redeploy your project. 1. Make sure you have all your work committed. You can use `git status` to see if there's anything that needs committing. From 96a2a6a197caf476eb39eb11b85bf61547fbab8e Mon Sep 17 00:00:00 2001 From: Damon <126731021+damon314159@users.noreply.github.com> Date: Mon, 23 Sep 2024 20:45:39 +0100 Subject: [PATCH 4/5] Explain purpose of merge main Co-authored-by: MaoShizhong <122839503+MaoShizhong@users.noreply.github.com> --- .../organizing_your_javascript_code/project_restaurant_page.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/javascript/organizing_your_javascript_code/project_restaurant_page.md b/javascript/organizing_your_javascript_code/project_restaurant_page.md index 0a9d7f40ef6..ee22c092609 100644 --- a/javascript/organizing_your_javascript_code/project_restaurant_page.md +++ b/javascript/organizing_your_javascript_code/project_restaurant_page.md @@ -45,7 +45,7 @@ You don't need to know exactly what all the commands do - as long as you follow 1. Make a new branch to deploy from by running `git branch gh-pages`. You only need to do this the first time you deploy. The rest of the steps should be done every time you deploy or redeploy your project. 1. Make sure you have all your work committed. You can use `git status` to see if there's anything that needs committing. -1. Run `git checkout gh-pages && git merge main --no-edit` to change branch so that you're ready to deploy. +1. Run `git checkout gh-pages && git merge main --no-edit` to change branch and sync your changes from `main` so that you're ready to deploy. 1. Now let's bundle our application into `dist` with your build command. For now, that's `npx webpack`. 1. Now there are a few more commands. Run each of these in order. From 9e270876b677751c80a58e53255038213d9523ef Mon Sep 17 00:00:00 2001 From: Damon <126731021+damon314159@users.noreply.github.com> Date: Mon, 23 Sep 2024 21:13:50 +0100 Subject: [PATCH 5/5] Add missing colon before list --- .../organizing_your_javascript_code/project_restaurant_page.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/javascript/organizing_your_javascript_code/project_restaurant_page.md b/javascript/organizing_your_javascript_code/project_restaurant_page.md index ee22c092609..6730aa551cb 100644 --- a/javascript/organizing_your_javascript_code/project_restaurant_page.md +++ b/javascript/organizing_your_javascript_code/project_restaurant_page.md @@ -47,7 +47,7 @@ You don't need to know exactly what all the commands do - as long as you follow 1. Make sure you have all your work committed. You can use `git status` to see if there's anything that needs committing. 1. Run `git checkout gh-pages && git merge main --no-edit` to change branch and sync your changes from `main` so that you're ready to deploy. 1. Now let's bundle our application into `dist` with your build command. For now, that's `npx webpack`. -1. Now there are a few more commands. Run each of these in order. +1. Now there are a few more commands. Run each of these in order: ```bash git add dist -f && git commit -m "Deployment commit"