The website will serve as a place for Chris to showcase his photos and adventures through the gallery and blog. The website will be built on the wordpress ecosystem (LAMP stack) and will be set up in a way where almost every piece of information or content can be updated via the Wordpress admin, allowing us to change the website as much as needed. The first iteration of the website will be built via the Sage framework. The second iteration of the website will be a headless set up, where we install the CMS on a subdomain and use wordpress' REST API to expose data needed to build the site. The main site will then be built in React/Typescript.
- Download Local by Flywheel
- Create a new website (name it
chrisdinh
) - Once the website has been set up, open your terminal
- Change directory into the public directory of the newly set up website (on mac, the command should be
cd ~/Local\ Sites/chrisdinh/app/public
) - Run
git init
- Add our remote origin
git remote add origin ...
- Run
git pull && git fetch -p
- Run
git checkout main --force
- Head over to the staging website and export a copy of the database
- From the local app, click the command
Open site shell
- Run
wp db import path/to/db-dump.sql
to replace your database with the staging database - Run
wp search-replace db-url chrisdinh.local --dry-run
- Once you've confirmed the import looks correct, run the same command without the
--dry-run
flag - Export all the images from staging and replace the local
uploads
folder (inside/wp-content/uploads
) with the uploads folder from staging - Exit the site shell
- Open your VSC and via the terminal, run
composer update
in thepublic
directory - Change directory to the theme
cd wp-content/themes/chrisdinh-photography
- Ensure you're using a node version of
16.14.0
(if not, i highly suggest download NVM to manage your node versions and then installing any version above16.14.0
) - Run
composer install && yarn install
from the theme directory - Run
yarn dev
to start the development host - Begin coding
When you are introducing new code into the repo, there are certain steps you must take before writing your code.
- Checkout to the
main
branch and rungit pull
so your local environment is caught up the the most recent updates in our main branch. - From your
main
branch, checkout into a new branch using a branch name that describes what you're looking to introduce into the codebase. For example, if you're working on a new module called a featured image module, you could checkout to a branch namedmodule/featured-image
(git checkout -b module/featured-image
) - Begin working on your code and as you work, make sure you're testing any styling/js/php thats needed for the new code to work without bugs
- Once your code is in a good place, make sure everything is committed and push your branch to the remote repo.
- Checkout to the staging branch and run
git pull
to ensure your local staging branch is in sync with the remote repo staging branch - Merge your feature branch into
staging
- Run
git push origin staging
so that our remote staging branch is in sync with your latest updates - Head over to our staging website and make sure your updates have not broken anything on the website
- Once you've confirmed your new feature has not broken anything on the website, open your PR and add a descriptive PR name and PR description so we can accurately track what the code does and why its needed in the code base.
- Assign reviewers to the PR
- Address any PR comments
- Once your PR is approved, merge your PR into the
main
branch