This commit is contained in:
parent
2552d305da
commit
b998e2a5ee
11 changed files with 56 additions and 25 deletions
|
@ -28,7 +28,8 @@
|
|||
"rules": {
|
||||
"recommended": true,
|
||||
"correctness": {
|
||||
"noUnusedImports": "error"
|
||||
"noUnusedImports": "error",
|
||||
"useJsxKeyInIterable": "off"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"type": "module",
|
||||
"scripts": {
|
||||
"start": "bun run build && bun src/serve.ts",
|
||||
"dev": "bun src/index.ts --dev",
|
||||
"dev": "bun run --hot src/index.ts --dev",
|
||||
"build": "bun run src/build.ts",
|
||||
"lint": "bunx biome check",
|
||||
"lint:fix": "bunx biome check --fix",
|
||||
|
|
14
src/index.ts
14
src/index.ts
|
@ -1,6 +1,8 @@
|
|||
import { resolve } from "node:path";
|
||||
import { environment, verifyRequiredVariables } from "@config";
|
||||
import { logger } from "@creations.works/logger";
|
||||
import { routeFiles } from "@views/manifest";
|
||||
|
||||
import { resolve } from "node:path";
|
||||
import { type PluginOption, createServer } from "vite";
|
||||
import solidPlugin from "vite-plugin-solid";
|
||||
import tsconfigPaths from "vite-tsconfig-paths";
|
||||
|
@ -34,6 +36,12 @@ const server = await createServer({
|
|||
|
||||
await server.listen();
|
||||
|
||||
logger.info(
|
||||
`Server is running at http://${environment.host}:${environment.port}`,
|
||||
logger.info(`Server is running at ${environment.fqdn}`);
|
||||
logger.info("Available routes:");
|
||||
|
||||
const sorted = Object.entries(routeFiles).sort(([a], [b]) =>
|
||||
a.localeCompare(b),
|
||||
);
|
||||
for (const [route, file] of sorted) {
|
||||
logger.info(`Route: ${route}, File: ${file}`);
|
||||
}
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
import { Route } from "@solidjs/router";
|
||||
import { about } from "@views/pages/about";
|
||||
import { error } from "@views/pages/error";
|
||||
import { home } from "@views/pages/home";
|
||||
import { login } from "@views/pages/login";
|
||||
import { routesManifest } from "@views/manifest";
|
||||
|
||||
import { Route } from "@solidjs/router";
|
||||
import { lazy } from "solid-js";
|
||||
import type { Component } from "solid-js";
|
||||
|
||||
const app: Component = () => (
|
||||
<>
|
||||
<Route path="/" component={home} />
|
||||
<Route path="/login" component={login} />
|
||||
<Route path="/about" component={about} />
|
||||
<Route path="*" component={error} />
|
||||
{Object.entries(routesManifest).map(([path, loader]) => (
|
||||
<Route path={path} component={lazy(loader)} />
|
||||
))}
|
||||
</>
|
||||
);
|
||||
|
||||
|
|
|
@ -3,21 +3,26 @@
|
|||
--text: #000;
|
||||
--input-background: #fff;
|
||||
--input-border: #ccc;
|
||||
--input-focus-border: #4f46e5;
|
||||
--button-background: #4f46e5;
|
||||
--button-hover-background: #4338ca;
|
||||
--button-text: #fff;
|
||||
}
|
||||
|
||||
:root[data-theme="dark"] {
|
||||
--background: #18181b;
|
||||
--text: #f9fafb;
|
||||
--input-background: #27272a;
|
||||
--input-border: #3f3f46;
|
||||
--button-background: #6366f1;
|
||||
--button-hover-background: #4f46e5;
|
||||
--button-text: #fff;
|
||||
--background: #000000;
|
||||
--text: #ffffff;
|
||||
|
||||
--input-background: #111111;
|
||||
--input-border: #333333;
|
||||
--input-focus-border: #727272;
|
||||
|
||||
--button-background: rgb(80, 78, 78);
|
||||
--button-hover-background: #3d3c3c;
|
||||
--button-text: #000000;
|
||||
}
|
||||
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
|
|
@ -27,6 +27,13 @@
|
|||
color: var(--text);
|
||||
border: 1px solid var(--input-border);
|
||||
border-radius: 4px;
|
||||
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
|
||||
.input:focus {
|
||||
outline: none;
|
||||
border-color: var(--input-focus-border);
|
||||
}
|
||||
|
||||
.button {
|
||||
|
|
13
src/views/manifest.ts
Normal file
13
src/views/manifest.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
export const routesManifest = {
|
||||
"/": () => import("@views/pages/home"),
|
||||
"/login": () => import("@views/pages/login"),
|
||||
"/about": () => import("@views/pages/about"),
|
||||
"*": () => import("@views/pages/error"),
|
||||
};
|
||||
|
||||
export const routeFiles = {
|
||||
"/": "src/views/pages/home.tsx",
|
||||
"/login": "src/views/pages/login.tsx",
|
||||
"/about": "src/views/pages/about.tsx",
|
||||
"*": "src/views/pages/error.tsx",
|
||||
};
|
|
@ -9,4 +9,4 @@ const about: Component = () => {
|
|||
);
|
||||
};
|
||||
|
||||
export { about };
|
||||
export default about;
|
||||
|
|
|
@ -9,4 +9,4 @@ const error: Component = () => {
|
|||
);
|
||||
};
|
||||
|
||||
export { error };
|
||||
export default error;
|
||||
|
|
|
@ -30,4 +30,4 @@ const home = () => {
|
|||
return null;
|
||||
};
|
||||
|
||||
export { home };
|
||||
export default home;
|
||||
|
|
|
@ -16,4 +16,4 @@ const login: Component = () => {
|
|||
);
|
||||
};
|
||||
|
||||
export { login };
|
||||
export default login;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue