-
Notifications
You must be signed in to change notification settings - Fork 527
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'be/axios' of https://github.com/AdaGold/weather-report …
…into be/axios
- Loading branch information
Showing
5 changed files
with
125 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Deploying to GitHub Pages with `parcel-bundler` | ||
|
||
Follow the steps below to deploy to GitHub Pages using `parcel-bundler` | ||
|
||
1. Create a new branch called `deployed-solution` | ||
1. Install `parcel-bundler` | ||
```bash | ||
yarn add --dev parcel-bundler@1.12.5 | ||
``` | ||
1. Install `gh-pages` | ||
```bash | ||
yarn add --dev gh-pages | ||
1. Remove `script` tag with `"./node_modules/axios/dist/axios.min.js"` from `index.html` | ||
1. Add `import` statements to `index.js` | ||
```js | ||
import 'regenerator-runtime/runtime'; | ||
import axios from 'axios'; | ||
``` | ||
1. Add a `"scripts"` section to your `package.json`: | ||
```json | ||
"scripts": { | ||
"predeploy": "rm -rf dist && yarn run build", | ||
"deploy": "gh-pages -d dist", | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"dev": "parcel index.html ", | ||
"build": "parcel build index.html --public-url /weather-report/" | ||
} | ||
``` | ||
<details> | ||
<summary>Complete <code>package.json</code></summary> | ||
|
||
```json | ||
{ | ||
"dependencies": { | ||
"axios": "^0.27.2" | ||
}, | ||
"devDependencies": { | ||
"gh-pages": "^4.0.0", | ||
"parcel-bundler": "^1.12.5" | ||
}, | ||
"scripts": { | ||
"predeploy": "rm -rf dist && yarn run build", | ||
"deploy": "gh-pages -d dist", | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"dev": "parcel index.html ", | ||
"build": "parcel build index.html --public-url /weather-report/" | ||
} | ||
} | ||
``` | ||
|
||
</details> | ||
1. Run `yarn run deploy` | ||
1. Confirm that the GitHub Pages branch is set to `gh-pages` in the GitHub UI by going to **Settings** --> **Pages** --> **Source** | ||
1. Navigate to `https://{your-user-name}.github.io/weather-report/` to see your deployed site. | ||
|
||
## Resources | ||
- [How to Use Axios with Javascript](https://www.digitalocean.com/community/tutorials/js-axios-vanilla-js) | ||
- [How to publish a single page application at no cost with GitHub Pages (React, Svelte, etc)](https://levelup.gitconnected.com/how-to-publish-a-single-page-application-at-no-cost-with-github-pages-react-svelte-etc-897b8f75a22b) | ||
- [Parcel with gh-pages GitHub issue](https://github.com/parcel-bundler/parcel/issues/505) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
|
||
|
||
asynckit@^0.4.0: | ||
version "0.4.0" | ||
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" | ||
integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== | ||
|
||
axios@^0.27.2: | ||
version "0.27.2" | ||
resolved "https://registry.yarnpkg.com/axios/-/axios-0.27.2.tgz#207658cc8621606e586c85db4b41a750e756d972" | ||
integrity sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ== | ||
dependencies: | ||
follow-redirects "^1.14.9" | ||
form-data "^4.0.0" | ||
|
||
combined-stream@^1.0.8: | ||
version "1.0.8" | ||
resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" | ||
integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== | ||
dependencies: | ||
delayed-stream "~1.0.0" | ||
|
||
delayed-stream@~1.0.0: | ||
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" | ||
integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= | ||
|
||
follow-redirects@^1.14.9: | ||
version "1.15.0" | ||
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.0.tgz#06441868281c86d0dda4ad8bdaead2d02dca89d4" | ||
integrity sha512-aExlJShTV4qOUOL7yF1U5tvLCB0xQuudbf6toyYA0E/acBNw71mvjFTnLaRp50aQaYocMR0a/RMMBIHeZnGyjQ== | ||
|
||
form-data@^4.0.0: | ||
version "4.0.0" | ||
resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" | ||
integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== | ||
dependencies: | ||
asynckit "^0.4.0" | ||
combined-stream "^1.0.8" | ||
mime-types "^2.1.12" | ||
|
||
mime-db@1.52.0: | ||
version "1.52.0" | ||
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" | ||
integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== | ||
|
||
mime-types@^2.1.12: | ||
version "2.1.35" | ||
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" | ||
integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== | ||
dependencies: | ||
mime-db "1.52.0" |