Skip to content

Commit 17ed113

Browse files
committed
fmt
1 parent 76632d0 commit 17ed113

File tree

22 files changed

+144
-137
lines changed

22 files changed

+144
-137
lines changed

.github/workflows/deployment.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name: Deploy GitHub Pages
22

33
on:
44
push:
5-
branches: ["main"]
6-
5+
branches: ['main']
6+
77
workflow_dispatch:
88
inputs:
99
page-root-directory:
@@ -17,10 +17,10 @@ permissions:
1717
id-token: write
1818

1919
concurrency:
20-
group: "pages"
20+
group: 'pages'
2121
cancel-in-progress: false
2222

23-
jobs:
23+
jobs:
2424
deploy:
2525
name: Deploy Pages
2626
# Deploy only to Github Pages if repository name ends with .github.io
@@ -38,7 +38,7 @@ jobs:
3838
uses: denoland/setup-deno@v2
3939
with:
4040
deno-version: ${{env.deno-version}}
41-
41+
4242
- name: Build page
4343
run: deno task build
4444

@@ -47,13 +47,13 @@ jobs:
4747
uses: actions/upload-artifact@v4
4848
with:
4949
path: ${{env.page-root-directory}}
50-
50+
5151
- name: Upload build artifact (Workflow Dispatch)
5252
if: (github.event.inputs.page-root-directory)
5353
uses: actions/upload-artifact@v4
5454
with:
5555
path: ${{github.event.inputs.page-root-directory}}
56-
56+
5757
- name: Setup pages
5858
uses: actions/configure-pages@v4
5959

@@ -72,4 +72,3 @@ jobs:
7272
- name: Deploy to GitHub Pages
7373
id: deployment
7474
uses: actions/deploy-pages@v3
75-

.github/workflows/lint.yml

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,31 @@
1-
name: Run Linter
2-
3-
on:
4-
push:
5-
branches: ["main"]
6-
7-
workflow_dispatch:
8-
9-
permissions:
10-
contents: read
11-
pages: write
12-
checks: write
13-
14-
jobs:
15-
lint:
16-
name: Lint
17-
runs-on: ubuntu-latest
18-
env:
19-
deno-version: v2.x
20-
21-
steps:
22-
- name: Setup Repository (${{github.event.repository.name}})
23-
uses: actions/checkout@v4
24-
25-
- name: Setup Deno (${{env.deno-version}})
26-
uses: denoland/setup-deno@v2
27-
with:
28-
deno-version: ${{env.deno-version}}
29-
30-
- name: Run Linter
31-
run: deno task lint
32-
1+
name: Run Linter
2+
3+
on:
4+
push:
5+
branches: ['main']
6+
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
checks: write
13+
14+
jobs:
15+
lint:
16+
name: Lint
17+
runs-on: ubuntu-latest
18+
env:
19+
deno-version: v2.x
20+
21+
steps:
22+
- name: Setup Repository (${{github.event.repository.name}})
23+
uses: actions/checkout@v4
24+
25+
- name: Setup Deno (${{env.deno-version}})
26+
uses: denoland/setup-deno@v2
27+
with:
28+
deno-version: ${{env.deno-version}}
29+
30+
- name: Run Linter
31+
run: deno task lint

.github/workflows/test.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Run Unit Tests
22

33
on:
44
push:
5-
branches: ["main"]
5+
branches: ['main']
66

77
workflow_dispatch:
88

@@ -26,12 +26,11 @@ jobs:
2626
uses: denoland/setup-deno@v2
2727
with:
2828
deno-version: ${{env.deno-version}}
29-
29+
3030
- name: Run Tests
3131
run: deno task test
3232

3333
- name: Generate jUnit Report
3434
uses: mikepenz/action-junit-report@v4
3535
with:
3636
report_paths: 'reports/report.xml'
37-

README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Template
2+
23
<img src="https://github.com/user-attachments/assets/ca0d1fb9-4f77-4b3d-9812-7590c4208193" align="right" width="128">
34

45
Template for Frontend development. Build a web page using [SolidJS](https://solidjs.com) as frontend framework and
56
[Deno](https://deno.land) as your backend. Clean architecture. No NodeJS required.
67

7-
88
[![Run Linter](https://github.com/JavaScriptPlayground/Template/actions/workflows/lint.yml/badge.svg)](https://github.com/JavaScriptPlayground/Template/actions/workflows/lint.yml)
99
[![Run Unit Tests](https://github.com/JavaScriptPlayground/Template/actions/workflows/test.yml/badge.svg)](https://github.com/JavaScriptPlayground/Template/actions/workflows/test.yml)
1010
[![Deploy GitHub Pages](https://github.com/JavaScriptPlayground/Template/actions/workflows/deployment.yml/badge.svg)](https://github.com/JavaScriptPlayground/Template/actions/workflows/deployment.yml)
@@ -41,32 +41,36 @@ Template for Frontend development. Build a web page using [SolidJS](https://soli
4141
- `e_to_e` End to End tests for the page.
4242

4343
## Usage
44+
4445
### Getting started
45-
Checkout the template and run initial [`deno install`](#tasks). This will install all the necessary dependencies.
46-
If you still getting import errors, try reloading the "import registries cache".
46+
47+
Checkout the template and run initial [`deno install`](#tasks). This will install all the necessary dependencies. If you
48+
still getting import errors, try reloading the "import registries cache".
4749

4850
Next you can build your app using [`deno task build`](#tasks).
4951

5052
After that your app is ready to serve by using [`deno task serve`](#tasks).
5153

5254
### Tasks
55+
5356
Use `deno task <name_of_the_task>`:
5457

55-
- `build` Build the page. *(recommended)*
56-
- `build:watch` Build the page with active file watcher. *(recommended)*
58+
- `build` Build the page. _(recommended)_
59+
- `build:watch` Build the page with active file watcher. _(recommended)_
5760
- `build:dev` Build the page for development (without optimization like minification).
5861
- `build:dev:watch` Build the page for development (without optimization like minification) with active file watcher.
5962
- `cache-reload` Cache all dependencies.
60-
- `serve` Serve the build `dist` directory as the page root. *(recommended)*
61-
- `serve:dev` Serve the build `dist` directory as the page root for development (with verbose logging and directory
63+
- `serve` Serve the build `dist` directory as the page root. _(recommended)_
64+
- `serve:dev` Serve the build `dist` directory as the page root for development (with verbose logging and directory
6265
listing enabled).
6366
- `lint` Lint the sourcecode
6467
- `test` Test your sourcecode (all `.test.ts` file will be checked). A junit report gets generated to
6568
`./reports/report.xml`
6669

6770
### GitHub Workflows
68-
- `deployment.yml` Deploys your current app to GitHub Pages if the name of your repository ends with `.github.io`.
69-
(Ex. `github.com/foo/foo.github.io`)
71+
72+
- `deployment.yml` Deploys your current app to GitHub Pages if the name of your repository ends with `.github.io`. (Ex.
73+
`github.com/foo/foo.github.io`)
7074
- `lint.yml` Lints your sourcecode.
7175
- `test.yml` Runs all the unit tests.
7276

build/esbuild.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ import { bold, green, magenta } from '@std/fmt/colors';
44
import { parseArgs } from '@std/cli/parse-args';
55
import { copy as esbuildPluginCopy } from './plugins/copy.ts';
66
import { transformScriptTags as esbuildPluginTransformScriptTags } from './plugins/transform_script_tags.ts';
7-
import { denoPlugin as esbuildPluginDeno } from "@deno/esbuild-plugin";
8-
import { solidPlugin as esbuildPluginSolidJS } from "@esbuild-plugin-solid";
7+
import { denoPlugin as esbuildPluginDeno } from '@deno/esbuild-plugin';
8+
import { solidPlugin as esbuildPluginSolidJS } from '@esbuild-plugin-solid';
99

1010
const args = parseArgs<{
1111
watch: boolean | undefined,
1212
develop: boolean | undefined,
1313
logLevel: esbuild.LogLevel
1414
}>(Deno.args);
1515

16-
const copyConfig : esbuild.BuildOptions = {
16+
const copyConfig: esbuild.BuildOptions = {
1717
allowOverwrite: true,
1818
logLevel: args.logLevel ?? 'info',
1919
color: true,
@@ -26,9 +26,9 @@ const copyConfig : esbuild.BuildOptions = {
2626
plugins: [
2727
esbuildPluginCopy()
2828
]
29-
}
29+
};
3030

31-
const buildConfig : esbuild.BuildOptions = {
31+
const buildConfig: esbuild.BuildOptions = {
3232
allowOverwrite: true,
3333
logLevel: args.logLevel ?? 'info',
3434
legalComments: args.develop ? 'inline' : 'none',
@@ -59,9 +59,11 @@ const buildConfig : esbuild.BuildOptions = {
5959
debug: false
6060
})
6161
]
62-
}
62+
};
6363

64-
console.log(bold(`Build process started. Building and bundling for ${magenta(args.develop ? '[Development]' : '[Production]')}.`));
64+
console.log(
65+
bold(`Build process started. Building and bundling for ${magenta(args.develop ? '[Development]' : '[Production]')}.`)
66+
);
6567

6668
const timestampNow = Date.now();
6769

@@ -75,5 +77,5 @@ if (args.watch) {
7577
]).then(() => {
7678
esbuild.stop();
7779
console.log(green(`esbuild ${esbuild.version} finished build in ${(Date.now() - timestampNow).toString()}ms.`));
78-
})
80+
});
7981
}

build/plugins/copy.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
import type * as esbuild from '@esbuild';
22

3-
43
export function copy() : esbuild.Plugin {
54
return ({
65
name: 'copy',
7-
setup(build) : void {
8-
build.onLoad({filter: /.*/}, (args) => {
6+
setup(build): void {
7+
build.onLoad({ filter: /.*/ }, (args) => {
98
return {
109
contents: Deno.readTextFileSync(args.path),
11-
loader: 'copy',
12-
}
13-
})
10+
loader: 'copy'
11+
};
12+
});
1413
}
15-
})
14+
});
1615
}
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
import type * as esbuild from '@esbuild';
22

3-
43
export function transformScriptTags(options?: {
54
pattern?: RegExp,
65
replaceExtensionWith?: string
76
}) : esbuild.Plugin {
87
return ({
98
name: 'html-script-tags',
10-
setup(build) : void {
11-
build.onLoad({filter: /\.html$/}, (args) => {
9+
setup(build): void {
10+
build.onLoad({ filter: /\.html$/ }, (args) => {
1211
return {
1312
contents: Deno.readTextFileSync(args.path).replace(
1413
options?.pattern ?? /(?<=<script.*src=")(.*)(?=".*>)/gm,
15-
(_, scriptSrcPath : string) => {
16-
return scriptSrcPath.replace(/\.tsx?$/, options?.replaceExtensionWith ?? '.js')
14+
(_, scriptSrcPath: string) => {
15+
return scriptSrcPath.replace(/\.tsx?$/, options?.replaceExtensionWith ?? '.js');
1716
}
1817
),
19-
loader: 'copy',
20-
}
21-
})
18+
loader: 'copy'
19+
};
20+
});
2221
}
23-
})
22+
});
2423
}

deno.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@
1010
"build": {
1111
"description": "Build the app for production.",
1212
"command": "deno run -A ./build/esbuild.ts",
13-
"dependencies": [ "clear-dist" ]
13+
"dependencies": ["clear-dist"]
1414
},
1515
"build:watch": {
1616
"description": "Build the app for production with watcher.",
1717
"command": "deno run -A ./build/esbuild.ts --watch",
18-
"dependencies": [ "clear-dist" ]
18+
"dependencies": ["clear-dist"]
1919
},
2020
"build:dev": {
2121
"description": "Build the app for development.",
2222
"command": "deno run -A ./build/esbuild.ts --develop",
23-
"dependencies": [ "clear-dist" ]
23+
"dependencies": ["clear-dist"]
2424
},
2525
"build:dev:watch": {
2626
"description": "Build the app for development with watcher.",
2727
"command": "deno run -A ./build/esbuild.ts --develop --watch",
28-
"dependencies": [ "clear-dist" ]
28+
"dependencies": ["clear-dist"]
2929
},
3030
"cache-reload": {
3131
"description": "Reload the dependency cache.",
@@ -34,12 +34,12 @@
3434
"serve": {
3535
"description": "Run the server on port 8000 for production.",
3636
"command": "deno run -A ./src/server/index.ts --port=8000",
37-
"dependencies": [ "build" ]
37+
"dependencies": ["build"]
3838
},
3939
"serve:dev": {
4040
"description": "Run the server on port 8000 for development.",
4141
"command": "deno run -A ./src/server/index.ts --develop --port=8000",
42-
"dependencies": [ "build:dev" ]
42+
"dependencies": ["build:dev"]
4343
},
4444
"lint": {
4545
"description": "Run linter.",
@@ -48,7 +48,7 @@
4848
"test": {
4949
"description": "Run unit tests. Junit reports will be saved to \"./reports/report.xml\".",
5050
"command": "deno test -A --check --reload --doc --permit-no-files --junit-path=\"./reports/report.xml\"",
51-
"dependencies": [ "clear-reports" ]
51+
"dependencies": ["clear-reports"]
5252
}
5353
},
5454
"compilerOptions": {
@@ -70,7 +70,6 @@
7070
]
7171
},
7272
"lint": {
73-
"include": [ "./src/components/toggle_switch/" ],
7473
"plugins": [
7574
"./lint/plugins/colon_spacing.ts"
7675
],
@@ -107,7 +106,8 @@
107106
"fmt": {
108107
"trailingCommas": "never",
109108
"singleQuote": true,
110-
"lineWidth": 120
109+
"lineWidth": 120,
110+
"typeLiteral.separatorKind": "comma"
111111
},
112112
"imports": {
113113
"@deno/esbuild-plugin": "jsr:@deno/esbuild-plugin@^1.2.0",

0 commit comments

Comments
 (0)