diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..9875200 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,7 @@ +{ + "extends": "@react-native-community", + "rules": { + "quotes": [2, "single"], + "prettier/prettier": ["error", { "singleQuote": true }] + } +} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1037651..8aa71c0 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,12 +9,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout 🛎️ - uses: actions/checkout@v2.3.1 # If you're using actions/checkout@v2 you must set persist-credentials to false in most cases for the deployment to work correctly. + uses: actions/checkout@v2.3.1 with: persist-credentials: false - - name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built. + - name: Install and Build 🔧 run: | + corepack enable yarn install NODE_ENV=production yarn build @@ -22,5 +23,5 @@ jobs: uses: JamesIves/github-pages-deploy-action@4.0.0 with: token: ${{ secrets.GITHUB_TOKEN }} - branch: gh-pages # The branch the action should deploy to. - folder: dist # The folder the action should deploy. + branch: gh-pages + folder: dist diff --git a/.github/workflows/qa.yml b/.github/workflows/qa.yml index 331c64b..eba08ea 100644 --- a/.github/workflows/qa.yml +++ b/.github/workflows/qa.yml @@ -7,14 +7,15 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout 🛎️ - uses: actions/checkout@v2.3.1 # If you're using actions/checkout@v2 you must set persist-credentials to false in most cases for the deployment to work correctly. + uses: actions/checkout@v2.3.1 with: persist-credentials: false - name: Install 🔧 run: | + corepack enable yarn install - name: Test run: | - yarn test + NODE_ENV=production yarn test diff --git a/.gitignore b/.gitignore index 0a58597..0bb2435 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ /.cache /.env /.tmp +/.yarn *.log diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..544138b --- /dev/null +++ b/.prettierrc @@ -0,0 +1,3 @@ +{ + "singleQuote": true +} diff --git a/.yarnrc.yml b/.yarnrc.yml new file mode 100644 index 0000000..3186f3f --- /dev/null +++ b/.yarnrc.yml @@ -0,0 +1 @@ +nodeLinker: node-modules diff --git a/babel.config.js b/babel.config.js index 2e28727..8849859 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,3 +1,5 @@ +const isDevelopment = process.env.NODE_ENV !== 'production'; + const config = (api) => { api.cache(false); return { @@ -12,8 +14,8 @@ const config = (api) => { 'GITHUB_REPOSITORY', ], }], - [require.resolve('react-hot-loader/babel')], - ], + isDevelopment && require.resolve('react-refresh/babel'), + ].filter(Boolean), }; }; diff --git a/jest.config.js b/jest.config.js index f1239ad..3b49afd 100644 --- a/jest.config.js +++ b/jest.config.js @@ -2,6 +2,5 @@ const path = require('path'); module.exports = { preset: 'ts-jest', - //testEnvironment: 'node', - testEnvironment: path.join(__dirname, 'tests', 'env-ts.js'), + testEnvironment: path.join(__dirname, 'tests', 'env.js'), }; diff --git a/package.json b/package.json index f951820..0c7849b 100644 --- a/package.json +++ b/package.json @@ -1,47 +1,49 @@ { - "name": "dropbox", + "name": "@morten-olsen/parcel", "version": "1.0.0", - "main": "index.js", "license": "MIT", + "packageManager": "yarn@3.1.0", "scripts": { + "dev": "webpack-dev-server", "build": "webpack", "test": "jest" }, "devDependencies": { - "@ant-design/icons": "^4.7.0", "@babel/core": "^7.17.9", "@babel/preset-env": "^7.16.11", "@babel/preset-react": "^7.16.7", "@babel/preset-typescript": "^7.16.7", - "@hot-loader/react-dom": "^17.0.2", + "@commitlint/cli": "^16.2.3", + "@commitlint/config-conventional": "^16.2.1", + "@pmmmwh/react-refresh-webpack-plugin": "^0.5.5", + "@react-native-community/eslint-config": "^3.0.1", "@types/express": "^4.17.13", "@types/fs-extra": "^9.0.13", - "@types/get-port": "^4.2.0", "@types/html-webpack-plugin": "^3.2.6", "@types/jest": "^27.4.1", - "@types/jszip": "^3.4.1", - "@types/react": "^18.0.3", + "@types/react": "^18.0.4", "@types/react-dom": "^18.0.0", "@types/react-router": "^5.1.18", "@types/react-router-dom": "^5.3.3", "@types/styled-components": "^5.1.25", - "@types/webpack-subresource-integrity": "^5.0.0", "@types/workbox-webpack-plugin": "^5.1.8", - "antd": "^4.19.5", + "@typescript-eslint/eslint-plugin": "^5.19.0", "axios": "^0.26.1", "babel-loader": "^8.2.4", "babel-plugin-transform-inline-environment-variables": "^0.4.3", "css-loader": "^6.7.1", "dotenv": "^16.0.0", + "eslint": "^8.13.0", "express": "^4.17.3", "fs-extra": "^10.0.1", - "get-port": "^5", + "get-port": "^6.1.2", "html-webpack-plugin": "^5.5.0", + "husky": "^7.0.4", "jest": "^27.5.1", "offline-plugin": "^5.0.7", - "parcel-bundler": "^1.12.5", + "prettier": "^2.6.2", "puppeteer": "^13.5.2", - "react-hot-loader": "^4.13.0", + "react-refresh": "^0.12.0", "style-loader": "^3.3.1", "ts-jest": "^27.1.4", "ts-node": "^10.7.0", @@ -54,6 +56,8 @@ "workbox-webpack-plugin": "^6.5.3" }, "dependencies": { + "@ant-design/icons": "^4.7.0", + "antd": "^4.19.5", "jszip": "^3.9.1", "nanoid": "^3.3.2", "openpgp": "^5.2.1", diff --git a/src/App.tsx b/src/App.tsx index ca2026b..bf302e8 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import { hot } from 'react-hot-loader/root'; import { Layout } from 'antd'; import { HashRouter as Router } from 'react-router-dom'; import { GithubProvider } from './contexts/Github'; @@ -12,9 +11,9 @@ const App: React.FC = () => { - + - + @@ -23,4 +22,4 @@ const App: React.FC = () => { ); }; -export default hot(App); +export default App; diff --git a/src/Router.tsx b/src/Router.tsx index 60a8633..76216cc 100644 --- a/src/Router.tsx +++ b/src/Router.tsx @@ -1,10 +1,6 @@ import React from 'react'; -import { - Routes, - Route, - useNavigate, -} from 'react-router-dom'; -import { HomeFilled } from '@ant-design/icons'; +import { Routes, Route, useNavigate } from 'react-router-dom'; +import { HomeFilled } from '@ant-design/icons'; import { Layout, Button, Space } from 'antd'; import Intro from './screens/Intro'; @@ -19,14 +15,18 @@ const AppRouter: React.FC = () => { return ( <> - - + } /> } /> @@ -38,6 +38,6 @@ const AppRouter: React.FC = () => { ); -} +}; export default AppRouter; diff --git a/src/components/File.tsx b/src/components/File.tsx index ff44fd3..66ef8be 100644 --- a/src/components/File.tsx +++ b/src/components/File.tsx @@ -1,9 +1,5 @@ import React from 'react'; -import { - List, - Button, - Popconfirm, -} from 'antd'; +import { List, Button, Popconfirm } from 'antd'; import { DeleteOutlined, SyncOutlined, @@ -25,24 +21,17 @@ const iconStyle = { }, }; -const icons: {[name: string]: any} = { +const icons: { [name: string]: any } = { processing: , failed: , success: , }; const IconText = ({ icon, text, ...props }) => ( -