Skip to content

Commit 33ab61d

Browse files
committed
Refactor client structure and simplify server routing
Moved client files from 'src/client/app' to 'src/client', consolidated assets and pages, and added a global CSS file. Removed unused settings page and related assets. Replaced custom server routing and page handler with direct use of 'serveDir' for static file serving. Updated build scripts and configuration to reflect new structure and removed obsolete build files.
1 parent a863dec commit 33ab61d

File tree

18 files changed

+41
-158
lines changed

18 files changed

+41
-158
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
.vscode/
22
dist/
33
reports/
4-
5-
*.css

config/build/index.ts renamed to build/esbuild.ts

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import { solidPlugin as esbuildPluginSolidJs } from '@esbuild-plugin-solid';
44
import { green } from '@std/fmt/colors';
55
import { parseArgs } from '@std/cli/parse-args';
66

7-
import denoJson from '../../deno.json' with {type: 'json'}
8-
import filesToCopy from './copy_files_extension_filter.json' with {type: 'json'}
7+
import denoJson from '../deno.json' with {type: 'json'}
98

109
const args = parseArgs<{
1110
watch: boolean | undefined,
@@ -14,11 +13,19 @@ const args = parseArgs<{
1413
}>(Deno.args);
1514

1615
// convert array to esbuild copy loader object
17-
const loaders = filesToCopy.reduce((
18-
previouseExtension,
16+
const loaders = [
17+
".html",
18+
".css",
19+
".svg",
20+
".png",
21+
".jpg",
22+
".jpeg",
23+
".ico"
24+
].reduce((
25+
previousExtension,
1926
extension
2027
) => ({
21-
...previouseExtension,
28+
...previousExtension,
2229
[extension]: 'copy' as esbuild.Loader
2330
}), {})
2431

@@ -30,8 +37,9 @@ const copyConfig : esbuild.BuildOptions = {
3037
outdir: './dist',
3138
outbase: './src/client',
3239
entryPoints: [
33-
'./src/client/app/**/index.html',
34-
'./src/client/app/**/assets/*',
40+
'./src/client/**/index.html',
41+
'./src/client/**/index.css',
42+
'./src/client/**/assets/*',
3543
'./src/client/static/**/*'
3644
]
3745
}
@@ -45,13 +53,13 @@ const filesConfig : esbuild.BuildOptions = {
4553
bundle: true,
4654
format: 'esm',
4755
target: 'esnext',
48-
sourcemap: true,
56+
sourcemap: args.develop ? 'linked' : false,
4957
sourcesContent: true,
5058
tsconfig: './deno.json',
51-
outdir: './dist/app',
52-
outbase: './src/client/app',
59+
outdir: './dist',
60+
outbase: './src/client',
5361
entryPoints: [
54-
'./src/client/app/index.tsx'
62+
'./src/client/index.tsx'
5563
],
5664
supported: {
5765
'import-attributes': true,

config/build/bundle.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.

config/build/copy_files_extension_filter.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

deno.json

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,24 @@
77
"description": "Install all dependencies specified in the \"deno.lock\" file.",
88
"command": "deno install"
99
},
10-
"build-deno": {
11-
"description": "Build the app for production.",
12-
"command": "deno run -A ./config/build/bundle.ts",
13-
"dependencies": [ "clear-dist" ]
14-
},
1510
"build": {
1611
"description": "Build the app for production.",
17-
"command": "deno run -A ./config/build/index.ts",
12+
"command": "deno run -A ./build/esbuild.ts",
1813
"dependencies": [ "clear-dist" ]
1914
},
2015
"build:watch": {
2116
"description": "Build the app for production with watcher.",
22-
"command": "deno run -A ./config/build/index.ts --watch",
17+
"command": "deno run -A ./build/esbuild.ts --watch",
2318
"dependencies": [ "clear-dist" ]
2419
},
2520
"build:dev": {
2621
"description": "Build the app for development.",
27-
"command": "deno run -A ./config/build/index.ts --develop",
22+
"command": "deno run -A ./build/esbuild.ts --develop",
2823
"dependencies": [ "clear-dist" ]
2924
},
3025
"build:dev:watch": {
3126
"description": "Build the app for development with watcher.",
32-
"command": "deno run -A ./config/build/index.ts --develop --watch",
27+
"command": "deno run -A ./build/esbuild.ts --develop --watch",
3328
"dependencies": [ "clear-dist" ]
3429
},
3530
"cache-reload": {
@@ -44,7 +39,7 @@
4439
"serve:dev": {
4540
"description": "Run the server on port 8000 for development.",
4641
"command": "deno run -A ./src/server/index.ts --develop --port=8000",
47-
"dependencies": [ "build" ]
42+
"dependencies": [ "build:dev" ]
4843
},
4944
"lint": {
5045
"description": "Run linter.",

deno.lock

Lines changed: 4 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/client/app/pages/settings/assets/favicon.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/client/app/pages/settings/index.tsx

Lines changed: 0 additions & 12 deletions
This file was deleted.
File renamed without changes.

src/client/index.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
*,
2+
*::before,
3+
*::after {
4+
margin: 0;
5+
padding: 0;
6+
color-scheme: dark;
7+
}

0 commit comments

Comments
 (0)