Skip to content
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
3 changes: 2 additions & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"description": "Documentation site for Funcio, with runnable examples, deployed to GitHub Pages.",
"scripts": {
"dev": "vite",
"prebuild": "npm --prefix .. run build",
"predev": "tsx scripts/generate-version.ts",
"prebuild": "tsx scripts/generate-version.ts && npm --prefix .. run build",
"pretypecheck": "npm --prefix .. run build",
"build": "npm run verify && tsc --noEmit -p tsconfig.json && npm run lint && vite build",
"postbuild": "tsx scripts/generate-sitemap.ts && tsx scripts/update-version.ts",
Expand Down
6 changes: 6 additions & 0 deletions web/scripts/generate-version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { readFileSync, writeFileSync } from 'fs'
import { resolve } from 'path'

const pkg = JSON.parse(readFileSync(resolve('../package.json'), 'utf-8'))
writeFileSync(resolve('src/version.ts'), `export const VERSION = "${pkg.version}"`)
console.log(`Generated version.ts with ${pkg.version}`)
3 changes: 2 additions & 1 deletion web/src/components/Header/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useEffect, useState } from 'react'
import { useTheme } from '../../hooks/useTheme'
import { VERSION } from '@/version'

import { Button } from '../Button'
import { Logo } from '../Logo'
Expand Down Expand Up @@ -29,7 +30,7 @@ export const Header = () => {
<a className={styles.brand} href="#top">
<Logo size={24} />
<span>Funcio</span>
<span className={styles.version}>0.0.32</span>
<span className={styles.version}>{VERSION}</span>
</a>

<nav className={`${styles.nav} ${open ? styles.open : ''}`} aria-label="Sections">
Expand Down
3 changes: 2 additions & 1 deletion web/src/components/Hero/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { heroExample } from '../../content'
import { VERSION } from '@/version'

import { Button } from '../Button'
import { Install } from '../Install'
Expand All @@ -11,7 +12,7 @@ export const Hero = () => (

<p className={styles.eyebrow}>
<span className={styles.dot} aria-hidden="true" />
v0.0.32 · MIT · 0 dependencies
v{VERSION} · MIT · 0 dependencies
</p>

<h1 className={styles.title}>
Expand Down
1 change: 1 addition & 0 deletions web/src/version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const VERSION = "0.1.0"
4 changes: 3 additions & 1 deletion web/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"target": "ES2020",
"baseUrl": ".",
"lib": ["ES2021", "DOM", "DOM.Iterable", "WebWorker"],
"module": "ESNext",
"moduleResolution": "Bundler",
Expand All @@ -21,7 +22,8 @@
"noEmit": true,

"paths": {
"funcio": ["../lib/main.d.ts"]
"funcio": ["../lib/main.d.ts"],
"@/*": ["src/*"]
}
},
"include": ["src", "scripts", "vite.config.ts"]
Expand Down
5 changes: 5 additions & 0 deletions web/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ const cssModule = (): Plugin => ({
export default defineConfig({
base: process.env.BASE_PATH ?? '/funcio/',
plugins: [cssModule(), react()],
resolve: {
alias: {
'@': resolve(__dirname, 'src')
}
},
build: {
outDir: 'dist',
target: 'es2020',
Expand Down
Loading