chore: clean up

This commit is contained in:
2024-02-06 09:15:20 +07:00
parent a21da11a91
commit a4069dae99
16 changed files with 148 additions and 352 deletions

View File

@@ -1,6 +0,0 @@
node_modules
/.cache
/build
/public/build
.env

View File

@@ -1,37 +0,0 @@
# templates/spa
This template leverages [Remix SPA Mode](https://remix.run/docs/en/main/future/spa-mode) to build your app as a Single-Page Application using [Client Data](https://remix.run/docs/en/main/guides/client-data) for all of you data loads and mutations.
⚠️ This is built on top of the Remix Vite template. Remix support for Vite is currently unstable and not recommended for production.
📖 See the [Remix Vite docs][remix-vite-docs] for details on supported features.
## Setup
```shellscript
npx create-remix@latest --template remix-run/remix/templates/spa
```
## Development
You can develop your SPA app just like you would a normal Remix app, via:
```shellscript
npm run dev
```
## Production
When you are ready yo build a production version of your app, `npm run build` will generate your assets and an `index.html` for the SPA.
```shellscript
npm run build
```
You can serve this from any server of your choosing, for a simple example, you could use [http-server](https://www.npmjs.com/package/http-server):
```shellscript
npx http-server build/client/
```
[remix-vite-docs]: https://remix.run/docs/en/main/future/vite

View File

@@ -1,12 +0,0 @@
import { RemixBrowser } from "@remix-run/react";
import { startTransition, StrictMode } from "react";
import { hydrateRoot } from "react-dom/client";
startTransition(() => {
hydrateRoot(
document,
<StrictMode>
<RemixBrowser />
</StrictMode>
);
});

View File

@@ -1,21 +0,0 @@
import type { EntryContext } from "@remix-run/node";
import { RemixServer } from "@remix-run/react";
import { renderToString } from "react-dom/server";
export default function handleRequest(
request: Request,
responseStatusCode: number,
responseHeaders: Headers,
remixContext: EntryContext
) {
let html = renderToString(
<RemixServer context={remixContext} url={request.url} />
);
if (html.startsWith("<html")) {
html = "<!DOCTYPE html>\n" + html;
}
return new Response(html, {
headers: { "Content-Type": "text/html" },
status: responseStatusCode,
});
}

View File

@@ -1,42 +0,0 @@
import {
Links,
Meta,
Outlet,
Scripts,
ScrollRestoration,
} from "@remix-run/react";
export default function App() {
return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<Meta />
<Links />
</head>
<body>
<Outlet />
<ScrollRestoration />
<Scripts />
</body>
</html>
);
}
export function HydrateFallback() {
return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<Meta />
<Links />
</head>
<body>
<p>Loading...</p>
<Scripts />
</body>
</html>
);
}

View File

@@ -1,32 +0,0 @@
import type { MetaFunction } from "@remix-run/node";
export const meta: MetaFunction = () => {
return [
{ title: "New Remix SPA" },
{ name: "description", content: "Welcome to Remix (SPA Mode)!" },
];
};
export default function Index() {
return (
<div style={{ fontFamily: "system-ui, sans-serif", lineHeight: "1.8" }}>
<h1>Welcome to Remix (SPA Mode)</h1>
<ul>
<li>
<a
target="_blank"
href="https://remix.run/future/spa-mode"
rel="noreferrer"
>
SPA Mode Guide
</a>
</li>
<li>
<a target="_blank" href="https://remix.run/docs" rel="noreferrer">
Remix Docs
</a>
</li>
</ul>
</div>
);
}

View File

@@ -1,2 +0,0 @@
/// <reference types="@remix-run/node" />
/// <reference types="vite/client" />

View File

@@ -1,30 +0,0 @@
{
"name": "@lume/desktop2",
"private": true,
"sideEffects": false,
"type": "module",
"scripts": {
"build": "remix vite:build",
"dev": "remix vite:dev",
"start": "http-server build/client/",
"typecheck": "tsc"
},
"dependencies": {
"@remix-run/node": "^2.6.0",
"@remix-run/react": "^2.6.0",
"http-server": "^14.1.1",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@remix-run/dev": "^2.6.0",
"@types/react": "^18.2.20",
"@types/react-dom": "^18.2.7",
"typescript": "^5.1.6",
"vite": "^5.0.0",
"vite-tsconfig-paths": "^4.2.1"
},
"engines": {
"node": ">=18.0.0"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -1,24 +0,0 @@
{
"include": ["env.d.ts", "**/*.ts", "**/*.tsx"],
"compilerOptions": {
"lib": ["DOM", "DOM.Iterable", "ES2022"],
"isolatedModules": true,
"esModuleInterop": true,
"jsx": "react-jsx",
"module": "ESNext",
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"target": "ES2022",
"strict": true,
"allowJs": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": ".",
"paths": {
"~/*": ["./app/*"]
},
// Remix takes care of building everything in `remix build`.
"noEmit": true
}
}

View File

@@ -1,10 +0,0 @@
import { unstable_vitePlugin as remix } from "@remix-run/dev";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";
export default defineConfig({
plugins: [
remix({ unstable_ssr: false, buildDirectory: "../../dist" }),
tsconfigPaths(),
],
});