Skip to content

Commit

Permalink
Revive project with vite (#252) (MAJOR)
Browse files Browse the repository at this point in the history
  • Loading branch information
will-molloy committed Jun 25, 2024
1 parent 3eb5d5e commit 87aa7f7
Show file tree
Hide file tree
Showing 47 changed files with 5,618 additions and 36,198 deletions.
10 changes: 0 additions & 10 deletions .babelrc.json

This file was deleted.

9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

54 changes: 54 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
ignorePatterns: ['dist', 'node_modules'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: __dirname,
},
settings: {
'react': {
'version': 'detect'
},
'import/resolver': {
'typescript': {}
}
},
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
'plugin:prettier/recommended',
'plugin:import/recommended',
'plugin:jsx-a11y/recommended',
'plugin:@typescript-eslint/recommended-type-checked',
],
plugins: [
'react',
'react-hooks',
'react-refresh',
'prettier',
'import',
'jsx-a11y',
'@typescript-eslint',
],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
'prettier/prettier': 'error',
'no-console': 'warn',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'import/first': 'error',
'import/newline-after-import': 'error',
'import/no-duplicates': 'error',
'import/no-namespace': 'error',
'import/order': 'error',
},
}
48 changes: 0 additions & 48 deletions .eslintrc.json

This file was deleted.

24 changes: 0 additions & 24 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,25 +1 @@
* text=auto eol=lf

*package-lock.json binary

*.ico binary
*.jpg binary
*.jpeg binary
*.png binary
*.gif binary
*.eot binary
*.otf binary
*.webp binary
*.svg binary
*.ttf binary
*.woff binary
*.woff2 binary
*.mp4 binary
*.webm binary
*.wav binary
*.mp3 binary
*.m4a binary
*.aac binary
*.oga binary
*.pdf binary
*.zip binary
89 changes: 36 additions & 53 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ on:
push:
branches: [ main ]

permissions:
contents: write

jobs:
build:
runs-on: ${{ matrix.os }}
Expand All @@ -16,100 +13,86 @@ jobs:
os: [ ubuntu-latest, macos-latest, windows-latest ]
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
node-version: 18

- name: Check package.json is sorted
run: npx sort-package-json --check
version: 9

- name: Restore npm dependencies cache
id: npm-cache
uses: actions/cache@v3
- name: Setup Node
uses: actions/setup-node@v4
with:
path: ./node_modules
key: ${{ runner.os }}-npm-cache-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }}

- name: Install npm dependencies
if: steps.npm-cache.outputs.cache-hit != 'true'
run: npm ci
node-version: 20
cache: 'pnpm'

- name: ESLint analysis
run: npm run eslint
- name: Install dependencies
run: pnpm install

- name: Stylelint analysis
run: npm run stylelint
- name: Lint
run: |
npx sort-package-json --check
pnpm lint
pnpm lint:css
- name: Build
run: npm run build
run: pnpm build

- name: Test
run: npm run test
run: pnpm test:coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
flags: unit-tests-${{ matrix.os }}
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Upload build artifact
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@master
uses: actions/upload-artifact@v4
with:
name: build
path: ./build
name: dist
path: ./dist

deploy:
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Restore npm dependencies cache
id: npm-cache
uses: actions/cache@v3
with:
path: ./node_modules
key: ${{ runner.os }}-npm-cache-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }}

- name: Install npm dependencies
if: steps.npm-cache.outputs.cache-hit != 'true'
run: npm ci

- name: Download build artifact
uses: actions/download-artifact@master
uses: actions/download-artifact@v4
with:
name: build
path: ./build
name: dist
path: ./dist

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: ./build
publish_dir: ./dist
github_token: ${{ secrets.GITHUB_TOKEN }}

release:
needs: deploy
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Bump version
id: version
uses: paulhatch/semantic-version@v5.0.2
uses: paulhatch/semantic-version@v5.4.0

- name: Create GitHub tag and release
uses: softprops/action-gh-release@v0.1.15
uses: softprops/action-gh-release@v2.0.5
with:
tag_name: ${{ steps.version.outputs.version_tag }}
generate_release_notes: true
generate_release_notes: true
43 changes: 21 additions & 22 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
# 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*

# IntelliJ IDEA
.idea/
node_modules
dist
dist-ssr
*.local
coverage

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
11 changes: 0 additions & 11 deletions .prettierrc.json

This file was deleted.

9 changes: 9 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
endOfLine: lf
printWidth: 100
tabWidth: 2
useTabs: false
trailingComma: es5
semi: true
singleQuote: true
jsxSingleQuote: false
arrowParens: always
3 changes: 0 additions & 3 deletions .stylelintrc.json

This file was deleted.

3 changes: 3 additions & 0 deletions .stylelintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
extends:
- stylelint-config-standard
- stylelint-prettier/recommended
Loading

0 comments on commit 87aa7f7

Please sign in to comment.