refactor: run on Space

This commit is contained in:
BetaHuhn 2023-08-28 15:38:17 +02:00
parent e8240a7bef
commit 290b0acc93
16 changed files with 5058 additions and 7563 deletions

View file

@ -1,4 +0,0 @@
{
"extends": ["@parcel/config-default"],
"reporters": ["...", "parcel-reporter-static-files-copy"]
}

4
.spaceignore Normal file
View file

@ -0,0 +1,4 @@
docker/
.github/
.parcel-cache
node_modules/

10
Spacefile Normal file
View file

@ -0,0 +1,10 @@
# Spacefile Docs: https://go.deta.dev/docs/spacefile/v0
v: 0
micros:
- name: app
src: .
engine: static
serve: dist
primary: true
commands:
- NODE_OPTIONS="--max-old-space-size=1024" npm run build

View file

@ -11,18 +11,10 @@
name="viewport"
content="width=device-width, height=device-height, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0, interactive-widget=resizes-content"
/>
<link rel="icon" href="./assets/favicon.png" />
<style>
.app-region-drag {
-webkit-app-region: drag;
}
.app-region-no-drag {
-webkit-app-region: no-drag;
}
</style>
<link rel="icon" href="./favicon.png" />
</head>
<body>
<div id="app"></div>
<script type="module" src="index.tsx"></script>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

5075
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,26 +1,23 @@
{
"name": "chatpad",
"private": true,
"source": "src/index.html",
"source": "src/main.tsx",
"browserslist": "> 0.5%, last 2 versions, not dead",
"scripts": {
"start": "parcel",
"build": "parcel build"
},
"staticFiles": {
"staticPath": "src/static"
"dev": "vite",
"build": "vite build",
"serve": "vite preview"
},
"devDependencies": {
"@parcel/transformer-sass": "^2.8.3",
"@types/downloadjs": "^1.4.3",
"@types/lodash": "^4.14.191",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@vitejs/plugin-react": "^4.0.4",
"buffer": "^5.7.1",
"parcel": "^2.8.3",
"path-browserify": "^1.0.1",
"parcel-reporter-static-files-copy": "^1.5.0",
"process": "^0.11.10"
"process": "^0.11.10",
"vite": "^4.4.9"
},
"dependencies": {
"@emotion/react": "^11.10.6",

View file

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

View file

@ -218,10 +218,10 @@
"label": "Explain Like I'm Five"
}
],
"showDownloadLink": true,
"showDownloadLink": false,
"allowDarkModeToggle": true,
"allowSettingsModal": true,
"allowDatabaseModal": true,
"showTwitterLink": true,
"showFeedbackLink": true
"showTwitterLink": false,
"showFeedbackLink": false
}

View file

@ -1,10 +0,0 @@
import React from "react";
import ReactDOM from "react-dom";
import { App } from "./components/App";
import { loadConfig } from "./utils/config";
loadConfig().then(() => {
const container = document.getElementById("app");
const root = ReactDOM.createRoot(container!);
root.render(<App />);
});

13
src/main.tsx Normal file
View file

@ -0,0 +1,13 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import { App } from './components/App'
import './styles/markdown.scss'
import { loadConfig } from './utils/config'
loadConfig().then(() => {
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<App />
</React.StrictMode>,
)
})

View file

@ -35,8 +35,6 @@ interface WritingFormat {
export let config: Config;
export const loadConfig = async () => {
const response = await fetch("config.json");
config = await response.json();
return config;
};
export async function loadConfig() {
config = await import('../config.json') as Config;
}

1
src/vite-env.d.ts vendored Normal file
View file

@ -0,0 +1 @@
/// <reference types="vite/client" />

View file

@ -1,10 +1,25 @@
{
"include": ["src/**/*"],
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"esModuleInterop": true,
"lib": ["es2018", "dom"],
/* Linting */
"strict": true,
"skipLibCheck": true
}
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
}

10
tsconfig.node.json Normal file
View file

@ -0,0 +1,10 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}

7
vite.config.ts Normal file
View file

@ -0,0 +1,7 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
})

7417
yarn.lock

File diff suppressed because it is too large Load diff