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