Skip to content

Commit

Permalink
Revert "Migrate a module bundler from webpack to vite"
Browse files Browse the repository at this point in the history
  • Loading branch information
yoichiro authored May 30, 2024
1 parent 8188bad commit 924ea0e
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 1,229 deletions.
3 changes: 1 addition & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"es6": true,
"node": true,
"jest": true,
"jasmine": true,
"browser": true
"jasmine": true
},
"parser": "@typescript-eslint/parser",
"plugins": ["react", "prettier"],
Expand Down
13 changes: 4 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@
"web-vitals": "^1.1.0"
},
"scripts": {
"start": "vite",
"start": "NODE_OPTIONS=--openssl-legacy-provider react-scripts start",
"type-check": "tsc --noEmit",
"lint": "eslint src --ext .ts,.tsx",
"build": "yarn type-check && yarn lint && vite build",
"build": "yarn type-check && NODE_OPTIONS=--openssl-legacy-provider react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"format": "prettier --write './src/**/*.{ts,tsx}'",
Expand Down Expand Up @@ -99,9 +98,7 @@
"@types/wicg-file-system-access": "^2020.9.7",
"@typescript-eslint/eslint-plugin": "^4.10.0",
"@typescript-eslint/parser": "^7.11.0",
"@vitejs/plugin-react": "^4.3.0",
"babel-eslint": "^10.1.0",
"eslint": "8.57.0",
"eslint-config-prettier": "^7.0.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.21.5",
Expand All @@ -110,8 +107,7 @@
"lint-staged": "^10.5.3",
"prettier": "^3.2.5",
"react-scripts": "^4.0.1",
"sinon": "^11.1.2",
"vite": "^5.2.12"
"sinon": "^11.1.2"
},
"husky": {
"hooks": {
Expand All @@ -128,6 +124,5 @@
"git add"
]
},
"packageManager": "[email protected]",
"type": "module"
"packageManager": "[email protected]"
}
17 changes: 10 additions & 7 deletions src/index.html → public/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head prefix="og: http://ogp.me/ns#">
<!-- Global site tag (gtag.js) - Google Analytics -->
Expand All @@ -12,7 +12,7 @@
</script>

<meta charset="utf-8" />
<link rel="icon" href="/favicon.ico" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
Expand Down Expand Up @@ -43,11 +43,15 @@
content="Remap allows you to find, build, set up and customize your keyboard quickly and easily in Web Browser."
data-rh="true"
/>
<meta property="og:url" content="https://remap-keys.app" data-rh="true" />
<meta property="og:image" content="/ogp_image.png" data-rh="true" />
<meta property="og:url" content="%PUBLIC_URL%" data-rh="true" />
<meta
property="og:image"
content="%PUBLIC_URL%/ogp_image.png"
data-rh="true"
/>

<link rel="apple-touch-icon" href="/logo192.png" />
<link rel="manifest" href="/manifest.json" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<script type="application/ld+json">
{
"@context": "https://schema.org",
Expand All @@ -68,7 +72,6 @@
"keywords": "remap,keyboard,keymap,qmk,via,customize,led,diy,webhid"
}
</script>
<script type="module" src="./index.tsx"></script>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
18 changes: 9 additions & 9 deletions src/services/provider/Firebase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ import { IDeviceInformation } from '../hid/Hid';
import * as crypto from 'crypto';
import { IBootloaderType } from '../firmware/Types';

export type IFirebaseConfiguration = {
apiKey: string;
authDomain: string;
projectId: string;
storageBucket: string;
messagingSenderId: string;
appId: string;
measurementId: string;
const config = {
apiKey: process.env.REACT_APP_FIREBASE_API_KEY,
authDomain: process.env.REACT_APP_FIREBASE_AUTH_DOMAIN,
projectId: process.env.REACT_APP_FIREBASE_PROJECT_ID,
storageBucket: process.env.REACT_APP_FIREBASE_STORAGE_BUCKET,
messagingSenderId: process.env.REACT_APP_FIREBASE_MESSAGE_SENDER_ID,
appId: process.env.REACT_APP_FIREBASE_APP_ID,
measurementId: process.env.REACT_APP_FIREBASE_MEASUREMENT_ID,
};

const FUNCTIONS_REGION = 'asia-northeast1';
Expand All @@ -71,7 +71,7 @@ export class FirebaseProvider implements IStorage, IAuth {
private functions: firebase.functions.Functions;
private unsubscribeAuthStateChanged?: firebase.Unsubscribe;

constructor(config: IFirebaseConfiguration) {
constructor() {
firebase.initializeApp(config);
firebase.analytics();
const app = firebase.app();
Expand Down
11 changes: 0 additions & 11 deletions src/services/provider/FirebaseConfiguration.ts

This file was deleted.

5 changes: 2 additions & 3 deletions src/store/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import { IFirmwareWriter } from '../services/firmware/FirmwareWriter';
import { FirmwareWriterWebApiImpl } from '../services/firmware/FirmwareWriterWebApiImpl';
import { IBootloaderType } from '../services/firmware/Types';
import { getLocalAuthenticationUid } from '../utils/AuthUtils';
import { firebaseConfiguration } from '../services/provider/FirebaseConfiguration';

export type ISetupPhase =
| 'init'
Expand Down Expand Up @@ -489,9 +488,9 @@ export type RootState = {

let firebaseProvider;
try {
firebaseProvider = new FirebaseProvider(firebaseConfiguration);
firebaseProvider = new FirebaseProvider();
} catch (cause) {
if (import.meta.env.NODE_ENV === 'production') {
if (process.env.NODE_ENV === 'production') {
throw cause;
} else {
console.warn(
Expand Down
2 changes: 1 addition & 1 deletion src/utils/GoogleAnalytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ let analytics: firebase.analytics.Analytics | null;
try {
analytics = firebase.analytics();
} catch (cause) {
if (import.meta.env.NODE_ENV === 'production') {
if (process.env.NODE_ENV === 'production') {
throw cause;
} else {
analytics = null;
Expand Down
15 changes: 3 additions & 12 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "esnext",
"lib": ["dom", "esnext"],
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
Expand All @@ -15,16 +15,7 @@
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"typeRoots": ["node_modules/@types", "node_modules", "src/@types"],
"types": [
"node",
"@types/jest",
"@types/w3c-web-hid",
"@types/w3c-web-usb",
"@types/w3c-web-serial",
"@types/wicg-file-system-access",
"vite/client"
]
"typeRoots": ["node_modules/@types"]
},
"include": ["src"]
}
35 changes: 0 additions & 35 deletions vite.config.ts

This file was deleted.

Loading

0 comments on commit 924ea0e

Please sign in to comment.