Skip to content

Commit

Permalink
Migrate from create-react-app to vite (#56)
Browse files Browse the repository at this point in the history
* Rename `*.js` -> `*.jsx`

* Delete `create-react-app` files and add `vite` files

* Move images to assets

* Transfer details from old `index.html` to new `index.html`

* Move `items.yml`

* Remove `/auction-website` from paths

* Remove old manifest

* Move items back and enable dynamic image loading

* Run deploy action on PR

* Add linux version of @rollup to `package-lock.json`

* Update build dist

* Revert "Add linux version of @rollup to `package-lock.json`"

This reverts commit 0aec0cc.

* Install missing package in CI

* Updage base in CI build

* Add base to build script

* Move base to `vite.config.js`

* Tidy workflow

* Add `BASE_URL` to all absolute paths

* Update Item.jsx

* Update Modal.jsx
  • Loading branch information
hmellor authored Dec 18, 2023
1 parent 2b606f1 commit ddd8e1c
Show file tree
Hide file tree
Showing 41 changed files with 2,939 additions and 17,078 deletions.
20 changes: 20 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
settings: { react: { version: '18.2' } },
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}
23 changes: 17 additions & 6 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -13,15 +14,25 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '21'
- run: npm install
- run: npm run build
- uses: actions/upload-pages-artifact@v2
cache: 'npm'
- name: Install dependencies
run: |
npm install
npm install @rollup/rollup-linux-x64-gnu
- name: Build
run: npm run build
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: 'build/'
path: './dist'

deploy:
needs: build
Expand Down
41 changes: 21 additions & 20 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
19 changes: 9 additions & 10 deletions public/index.html → index.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<!-- Meta tags -->
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="theme-color" content="#000000" />
<meta name="title" content="Markatplace" />
<meta name="description" content="An auction website" />
<meta name="image" content="%PUBLIC_URL%/social-preview.png" />
<meta name="image" content="/social-preview.png" />
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website" />
<meta property="og:url" content="%PUBLIC_URL%/index.html" />
<meta property="og:url" content="/index.html" />
<meta property="og:title" content="Markatplace" />
<meta property="og:description" content="An auction website" />
<meta property="og:image" content="%PUBLIC_URL%/social-preview.png" />
<meta property="og:image" content="/social-preview.png" />

<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo.png" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="apple-touch-icon" href="/logo.png" />
<title>Markatplace</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
Loading

0 comments on commit ddd8e1c

Please sign in to comment.