Skip to content

Commit

Permalink
remove references of yarn and upgrade parcel/eslint.config
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikelle Wade committed Oct 23, 2024
1 parent 9fcb2e9 commit 0f78174
Show file tree
Hide file tree
Showing 8 changed files with 7,207 additions and 119 deletions.
33 changes: 0 additions & 33 deletions .eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.vscode
.DS_Store
node_modules
.cache
.parcel_cache
46 changes: 23 additions & 23 deletions ada-project-docs/deploy.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# Deploying to GitHub Pages with `parcel-bundler`
# Deploying to GitHub Pages with `parcel`

Follow the steps below to deploy to GitHub Pages using `parcel-bundler`
Follow the steps below to deploy to GitHub Pages using `parcel`

1. Create a new branch called `deployed-version` and switch to it.
1. Install `parcel-bundler`
2. Install `parcel-bundler`
```bash
yarn add --dev parcel[email protected]
npm install parcel -D
```
1. Install `gh-pages`
3. 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`
npm install gh-pages -D
4. Remove `script` tag with `"./node_modules/axios/dist/axios.min.js"` from `index.html`
5. Add `import` statements to `index.js`
```js
import 'regenerator-runtime/runtime';
import axios from 'axios';
```
1. Add a `"scripts"` section to your `package.json`:
6. Add a `"scripts"` section to your `package.json`:
```json
"scripts": {
"predeploy": "rm -rf dist && yarn run build",
"predeploy": "rm -rf dist && np, run build",
"deploy": "gh-pages -d dist",
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "parcel index.html ",
Expand All @@ -30,28 +30,28 @@ Follow the steps below to deploy to GitHub Pages using `parcel-bundler`
<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",
"predeploy": "rm -rf dist && npm 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/"
},
"dependencies": {
"axios": "^1.7.7"
},
"devDependencies": {
"gh-pages": "^6.2.0",
"parcel": "^2.12.0"
}
}
}
```

</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.
7. Run `npm run deploy`
8. Confirm that the GitHub Pages branch is set to `gh-pages` in the GitHub UI by going to **Settings** --> **Pages** --> **Source**
9. 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)
Expand Down
58 changes: 58 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import jest from "eslint-plugin-jest";
import react from "eslint-plugin-react";
import globals from "globals";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [...compat.extends("plugin:react/recommended", "standard"), {
plugins: {
jest,
react,
},

languageOptions: {
globals: {
...globals.browser,
},

ecmaVersion: "latest",
sourceType: "module",

parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},

settings: {
react: {
version: "detect",
},
},

rules: {
"max-len": [1, 120, 2, {
ignoreComments: true,
}],

"no-console": "off",
quotes: ["warn", "single"],

camelcase: ["error", {
properties: "always",
}],

semi: ["warn", "always"],
},
}];
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
<link rel="stylesheet" href="styles/index.css" />
</head>
<body>
<script src="./src/index.js"></script>
<script type="module" src="./src/index.js"></script>
</body>
</html>
Loading

0 comments on commit 0f78174

Please sign in to comment.