Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dnature/crwn-clothing-e-commerce
https://github.com/dnature/crwn-clothing-e-commerce
Last synced: 9 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/dnature/crwn-clothing-e-commerce
- Owner: DNature
- Created: 2020-01-08T11:11:41.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T13:53:19.000Z (almost 2 years ago)
- Last Synced: 2023-03-03T14:33:13.972Z (over 1 year ago)
- Language: JavaScript
- Size: 758 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 32
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# How to fork and clone
One quick note about cloning this project. If you wish to make commits and push the code up after cloning this repo, you should fork the project first. In order to own your own copy of this repository, you have to fork it so you get your own copy on your own profile!
You can see the fork button in the top right corner of every GitHub project; click it and a copy of the project will be added to your GitHub profile under the same name as the original project.
![alt text](https://i.ibb.co/1YN7SJ6/Screen-Shot-2019-07-01-at-2-02-40-AM.png 'image to fork button')
After forking the project, simply clone it the way you would from the new forked project in your own GitHub repository and you can commit and push to it freely!
# After you fork and clone:
## Install dependencies
In your terminal after you clone your project down, remember to run either `yarn` or `npm install` to build all the dependencies in the project.
## Set your firebase config
Remember to replace the `config` variable in your `firebase.utils.js` with your own config object from the firebase dashboard! Navigate to the project settings and scroll down to the config code. Copy the object in the code and replace the variable in your cloned code.
![alt text](https://i.ibb.co/6ywMkBf/Screen-Shot-2019-07-01-at-11-35-02-AM.png 'image to firebase config')
## Set your stripe publishable key
Set the `publishableKey` variable in the `stripe-button.component.jsx` with your own publishable key from the stripe dashboard.
![alt text](https://i.ibb.co/djQTmVF/Screen-Shot-2019-07-01-at-2-18-50-AM.png 'image to publishable key')
## Things to set before you deploy
Remember to add a file called `.env` to the root folder! In that `.env` file remember to add a `STRIPE_SECRET_KEY` value equal to your own secret key from your stripe dashboard. You can find it in the same place where you found your publishable key in the developers tab under api keys. You will have to enter the password in to reveal it!
![alt text](https://i.ibb.co/wpLx8Lh/Screen-Shot-2019-07-01-at-2-26-26-AM.png 'image to secret key')
You will also need to connect your existing Heroku app to this new forked and cloned repo, or you have to create a new Heroku app and push to it. A quick refresher on how to do either of these:
## Set to an existing Heroku app
To set to an existing Heroku app you already have deployed, you need to know the name of the app you want to deploy to. To see a list of all the apps you currently have on Heroku:
```
heroku apps
```Copy the name of the app you want to connect the project to, then run:
```
heroku git:remote -a
```And now you'll have your repo connected to the heroku app under the git remote name `heroku`.
If the Heroku app you connected was deploying just a create-react-app project from earlier in the lesson, you will need to remove the `mars/create-react-app-buildpack` buildpack first. You can check if you have this buildpack by running:
```
heroku buildpacks
```Which will list any buildpacks you currently have, if you see `mars/create-react-app-buildpack` in the list, you can remove it by running:
```
heroku buildpacks:remove mars/create-react-app-buildpack
```Then skip to the bottom of this article to see what to do next!
## To create a new Heroku app
Create a new Heroku project by typing in your terminal:
```
heroku create
```This will create a new Heroku project for you. Then run:
```
git remote -v
```You should see heroku `https://git.heroku.com/` in the list. This means you have successfully connected your project to the newly created Heroku app under the git remote of `heroku`.
## Deploying to Heroku
Before we deploy, you also need to set a config variable of `STRIPE_SECRET_KEY` to the same secret key value from your stripe dashboard, the same one in your `.env` file. The `.env` file is only for local development, in order for our heroku production app to have access to this secret key, we add it to our Heroku projects config variables by typing:
```
heroku config:set STRIPE_SECRET_KEY=
```After that, you can deploy to heroku by running:
```
git push heroku master
```You will see this warning message if you are pushing to an existing app:
```
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://git.heroku.com/hasura-crwn-clothing.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
```This is because we are pushing to an existing app that was deploying an entirely different repository from what we have now. Simply run:
```
git push heroku master --force
```This will overwrite the existing Heroku app with our new code.
## Open our Heroku project
After heroku finishes building our project, we can simply run:
```
heroku open
```This will open up our browser and take us to our newly deployed Heroku project!