Skip to content

Vite static build #1841

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
May 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"project": "./tsconfig.json",
"sourceType": "module"
},
"ignorePatterns": ["docs/"],
"rules": {
"node/no-unpublished-import": "off",
"@typescript-eslint/consistent-type-imports": [
Expand All @@ -17,13 +18,5 @@
],
"@typescript-eslint/consistent-type-exports": "error",
"@typescript-eslint/no-import-type-side-effects": "error"
},
"overrides": [
{
"files": ["docs/**/*.tsx"],
"parserOptions": {
"project": "./tsconfig.docs.json"
}
}
]
}
}
11 changes: 9 additions & 2 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ jobs:
deploy:
runs-on: ubuntu-latest

defaults:
run:
working-directory: "./docs"

steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -34,16 +38,19 @@ jobs:
- name: Install
run: npm ci

- name: Lint
run: npm run lint

- name: Build docs
run: npm run docs:build
run: npm run build

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

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'docs'
path: "./docs/dist"

- name: Deploy to GitHub Pages
id: deployment
Expand Down
6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,6 @@ out
.nuxt
dist

# react / gatsby
public/

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
Expand Down Expand Up @@ -150,9 +147,6 @@ public/

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

# docs build artifacts
docs/dist

# spectype build artifacts
cases/spectypes/build

Expand Down
24 changes: 17 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,21 @@ const res = isMyDataValid(data)
* `npm run test` - run build process and tests for all modules
* `npm run test:build` - run build process for all modules

#### Docs
#### Benchmark Viewer

* `npm run docs:serve` - result viewer
* `npm run docs:build` - build docs
* `npm run docs:watch` - watch docs for changes and rebuild
A basic preact+vite app lives in [`/docs`](/docs).
It is deployed via github pages whenever something has been pushed to the main branch.

```sh
cd docs

npm run dev # develop / view results
npm run build # build
npm run preview # preview the build
```

When viewing results locally, you will need to restart the app whenever the
results are updated.

#### Linting

Expand Down Expand Up @@ -163,18 +173,18 @@ const res = isMyDataValid(data)
### Node.js runtime

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

### Bun runtime

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

### Deno runtime

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

## Test cases

Expand Down
6 changes: 6 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# build artifacts
dist

# copy of results accessible to the viewer app
public/results
public/packagesPopularity.json
19 changes: 19 additions & 0 deletions docs/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// generated with `npm init @eslint/config@latest`
import js from '@eslint/js';
import globals from 'globals';
import tseslint from 'typescript-eslint';
import { defineConfig, globalIgnores } from 'eslint/config';

export default defineConfig([
globalIgnores(['dist', 'eslint.config.js']),
{
files: ['src/**/*.{ts, tsx}'],
plugins: { js },
extends: ['js/recommended'],
},
{
files: ['src/**/*.{ts, tsx}'],
languageOptions: { globals: globals.browser },
},
tseslint.configs.recommended,
]);
58 changes: 27 additions & 31 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -1,33 +1,29 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Benchmark Comparison of Packages with Runtime Validation and TypeScript Support.">
<meta name="color-scheme" content="dark light">

<title>Runtype Benchmarks</title>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.min.css">
<style>
@media (prefers-color-scheme:dark) {
/* fix vega graph labels in dark mode */
svg .mark-text text {
fill: white;
}
}
</style>
</head>
<body>
<script src="https://unpkg.com/samd@0/dist/samd.js" crossorigin></script>
<script src="https://unpkg.com/[email protected]" crossorigin></script>
<script src="https://unpkg.com/[email protected]" crossorigin></script>
<script src="https://unpkg.com/preact@10" crossorigin></script>
<script async defer src="https://buttons.github.io/buttons.js"></script>
<script src="dist/app.js"></script>
<script>
define('preact', () => preact)
require(['app']);
</script>
</body>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta
name="description"
content="Benchmark Comparison of Packages with Runtime Validation and TypeScript Support."
/>
<meta name="color-scheme" content="dark light" />
<title>Runtype Benchmarks</title>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.min.css"
/>
<style>
@media (prefers-color-scheme: dark) {
/* fix vega graph labels in dark mode */
svg .mark-text text {
fill: white;
}
}
</style>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading