Skip to content

Commit d8feb1c

Browse files
authored
Merge pull request #1841 from hoeck/vite-static-build
Vite static build, fixes #1735
2 parents c204ffb + 781ff49 commit d8feb1c

19 files changed

+4641
-1112
lines changed

.eslintrc.json

+2-9
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"project": "./tsconfig.json",
77
"sourceType": "module"
88
},
9+
"ignorePatterns": ["docs/"],
910
"rules": {
1011
"node/no-unpublished-import": "off",
1112
"@typescript-eslint/consistent-type-imports": [
@@ -17,13 +18,5 @@
1718
],
1819
"@typescript-eslint/consistent-type-exports": "error",
1920
"@typescript-eslint/no-import-type-side-effects": "error"
20-
},
21-
"overrides": [
22-
{
23-
"files": ["docs/**/*.tsx"],
24-
"parserOptions": {
25-
"project": "./tsconfig.docs.json"
26-
}
27-
}
28-
]
21+
}
2922
}

.github/workflows/pages.yml

+9-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ jobs:
2424
deploy:
2525
runs-on: ubuntu-latest
2626

27+
defaults:
28+
run:
29+
working-directory: "./docs"
30+
2731
steps:
2832
- name: Checkout
2933
uses: actions/checkout@v4
@@ -34,16 +38,19 @@ jobs:
3438
- name: Install
3539
run: npm ci
3640

41+
- name: Lint
42+
run: npm run lint
43+
3744
- name: Build docs
38-
run: npm run docs:build
45+
run: npm run build
3946

4047
- name: Setup Pages
4148
uses: actions/configure-pages@v5
4249

4350
- name: Upload artifact
4451
uses: actions/upload-pages-artifact@v3
4552
with:
46-
path: 'docs'
53+
path: "./docs/dist"
4754

4855
- name: Deploy to GitHub Pages
4956
id: deployment

.gitignore

-6
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,6 @@ out
9999
.nuxt
100100
dist
101101

102-
# react / gatsby
103-
public/
104-
105102
# Gatsby files
106103
.cache/
107104
# Comment in the public line in if your project uses Gatsby and not Next.js
@@ -150,9 +147,6 @@ public/
150147

151148
# End of https://www.toptal.com/developers/gitignore/api/node
152149

153-
# docs build artifacts
154-
docs/dist
155-
156150
# spectype build artifacts
157151
cases/spectypes/build
158152

README.md

+17-7
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,21 @@ const res = isMyDataValid(data)
124124
* `npm run test` - run build process and tests for all modules
125125
* `npm run test:build` - run build process for all modules
126126

127-
#### Docs
127+
#### Benchmark Viewer
128128

129-
* `npm run docs:serve` - result viewer
130-
* `npm run docs:build` - build docs
131-
* `npm run docs:watch` - watch docs for changes and rebuild
129+
A basic preact+vite app lives in [`/docs`](/docs).
130+
It is deployed via github pages whenever something has been pushed to the main branch.
131+
132+
```sh
133+
cd docs
134+
135+
npm run dev # develop / view results
136+
npm run build # build
137+
npm run preview # preview the build
138+
```
139+
140+
When viewing results locally, you will need to restart the app whenever the
141+
results are updated.
132142

133143
#### Linting
134144

@@ -163,18 +173,18 @@ const res = isMyDataValid(data)
163173
### Node.js runtime
164174

165175
* update Node.js version matrix in `.github/workflows/pr.yml` and `.github/workflows/release.yml`
166-
* update `NODE_VERSIONS` in `docs/dist/app.tsx` and run `npm run docs:build`
176+
* update `NODE_VERSIONS` in `docs/src/App.tsx`
167177
* optionally set `NODE_VERSION_FOR_PREVIEW` in `benchmarks/helpers/main.ts`
168178

169179
### Bun runtime
170180

171181
* update bun version matrix in `.github/workflows/pr.yml` and `.github/workflows/release.yml`
172-
* update `BUN_VERSIONS` in `docs/dist/app.tsx` and run `npm run docs:build`
182+
* update `BUN_VERSIONS` in `docs/src/App.tsx`
173183

174184
### Deno runtime
175185

176186
* update Deno version matrix in `.github/workflows/pr.yml` and `.github/workflows/release.yml`
177-
* update `DENO_VERSIONS` in `docs/dist/app.tsx` and run `npm run docs:build`
187+
* update `DENO_VERSIONS` in `docs/src/App.tsx`
178188

179189
## Test cases
180190

docs/.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# build artifacts
2+
dist
3+
4+
# copy of results accessible to the viewer app
5+
public/results
6+
public/packagesPopularity.json

docs/eslint.config.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// generated with `npm init @eslint/config@latest`
2+
import js from '@eslint/js';
3+
import globals from 'globals';
4+
import tseslint from 'typescript-eslint';
5+
import { defineConfig, globalIgnores } from 'eslint/config';
6+
7+
export default defineConfig([
8+
globalIgnores(['dist', 'eslint.config.js']),
9+
{
10+
files: ['src/**/*.{ts, tsx}'],
11+
plugins: { js },
12+
extends: ['js/recommended'],
13+
},
14+
{
15+
files: ['src/**/*.{ts, tsx}'],
16+
languageOptions: { globals: globals.browser },
17+
},
18+
tseslint.configs.recommended,
19+
]);

docs/index.html

+27-31
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,29 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
3-
<head>
4-
<meta charset="utf-8">
5-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6-
<meta name="description" content="Benchmark Comparison of Packages with Runtime Validation and TypeScript Support.">
7-
<meta name="color-scheme" content="dark light">
8-
9-
<title>Runtype Benchmarks</title>
10-
11-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.min.css">
12-
<style>
13-
@media (prefers-color-scheme:dark) {
14-
/* fix vega graph labels in dark mode */
15-
svg .mark-text text {
16-
fill: white;
17-
}
18-
}
19-
</style>
20-
</head>
21-
<body>
22-
<script src="https://unpkg.com/samd@0/dist/samd.js" crossorigin></script>
23-
<script src="https://unpkg.com/[email protected]" crossorigin></script>
24-
<script src="https://unpkg.com/[email protected]" crossorigin></script>
25-
<script src="https://unpkg.com/preact@10" crossorigin></script>
26-
<script async defer src="https://buttons.github.io/buttons.js"></script>
27-
<script src="dist/app.js"></script>
28-
<script>
29-
define('preact', () => preact)
30-
require(['app']);
31-
</script>
32-
</body>
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<meta
7+
name="description"
8+
content="Benchmark Comparison of Packages with Runtime Validation and TypeScript Support."
9+
/>
10+
<meta name="color-scheme" content="dark light" />
11+
<title>Runtype Benchmarks</title>
12+
<link
13+
rel="stylesheet"
14+
href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.min.css"
15+
/>
16+
<style>
17+
@media (prefers-color-scheme: dark) {
18+
/* fix vega graph labels in dark mode */
19+
svg .mark-text text {
20+
fill: white;
21+
}
22+
}
23+
</style>
24+
</head>
25+
<body>
26+
<div id="root"></div>
27+
<script type="module" src="/src/main.tsx"></script>
28+
</body>
3329
</html>

0 commit comments

Comments
 (0)