From 2dfb6de2ff8f687626291ebb425e5ff5c68a0e8f Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Sun, 1 Mar 2026 22:24:01 -0800 Subject: [PATCH] Add versions app and remove from install scripts --- README.md | 2 +- apps/cron/index.tsx | 2 +- apps/versions/.npmrc | 1 - apps/versions/bun.lock | 45 --------- apps/versions/index.tsx | 177 ------------------------------------ apps/versions/package.json | 26 ------ apps/versions/tsconfig.json | 30 ------ install/install.sh | 2 +- scripts/install.sh | 2 +- 9 files changed, 4 insertions(+), 283 deletions(-) delete mode 100644 apps/versions/.npmrc delete mode 100644 apps/versions/bun.lock delete mode 100644 apps/versions/index.tsx delete mode 100644 apps/versions/package.json delete mode 100644 apps/versions/tsconfig.json diff --git a/README.md b/README.md index 4de2fbc..c7cc21e 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ This will: 1. Install system dependencies (git, fish shell, networking tools) 2. Install Bun and grant it network binding capabilities 3. Clone and build the toes server -4. Set up bundled apps (clock, code, cron, env, stats, versions) +4. Set up bundled apps (clock, code, cron, env, stats) 5. Install and enable a systemd service for auto-start Once complete, visit `http://.local` on your local network. diff --git a/apps/cron/index.tsx b/apps/cron/index.tsx index abf5322..99c1dc4 100644 --- a/apps/cron/index.tsx +++ b/apps/cron/index.tsx @@ -15,7 +15,7 @@ const APPS_DIR = process.env.APPS_DIR! const app = new Hype({ prettyHTML: false }) -// Styles (follow versions tool pattern) +// Styles const Container = define('Container', { fontFamily: theme('fonts-sans'), padding: '20px', diff --git a/apps/versions/.npmrc b/apps/versions/.npmrc deleted file mode 100644 index 6c57d5c..0000000 --- a/apps/versions/.npmrc +++ /dev/null @@ -1 +0,0 @@ -registry=https://npm.nose.space diff --git a/apps/versions/bun.lock b/apps/versions/bun.lock deleted file mode 100644 index 4ae0cc8..0000000 --- a/apps/versions/bun.lock +++ /dev/null @@ -1,45 +0,0 @@ -{ - "lockfileVersion": 1, - "configVersion": 1, - "workspaces": { - "": { - "name": "versions", - "dependencies": { - "@because/forge": "^0.0.1", - "@because/hype": "^0.0.2", - "@because/toes": "^0.0.5", - }, - "devDependencies": { - "@types/bun": "latest", - }, - "peerDependencies": { - "typescript": "^5.9.3", - }, - }, - }, - "packages": { - "@because/forge": ["@because/forge@0.0.1", "https://npm.nose.space/@because/forge/-/forge-0.0.1.tgz", { "peerDependencies": { "typescript": "^5" } }, "sha512-QS5CK51gcWma91i4uECWe4HPJeNHcE+Af4SQHOcfEovyzOEa7VOTAjei+jIWr2i+abGWqQCEC9wIuFgPgyr2Bg=="], - - "@because/hype": ["@because/hype@0.0.2", "https://npm.nose.space/@because/hype/-/hype-0.0.2.tgz", { "dependencies": { "hono": "^4.10.4", "kleur": "^4.1.5" }, "peerDependencies": { "typescript": "^5" } }, "sha512-fdKeII6USGC1loVVj+tPz086cKz+Bm+XozNee3NOnK4VP+q4yNPP2Fq1Yujw5xeDYE+ZvJn40gKwlngRvmX2hA=="], - - "@because/toes": ["@because/toes@0.0.5", "https://npm.nose.space/@because/toes/-/toes-0.0.5.tgz", { "dependencies": { "@because/forge": "^0.0.1", "@because/hype": "^0.0.2", "commander": "^14.0.2", "diff": "^8.0.3", "kleur": "^4.1.5" }, "peerDependencies": { "typescript": "^5.9.2" }, "bin": { "toes": "src/cli/index.ts" } }, "sha512-YM1VuR1sym7m7pFcaiqnjg6eJUyhJYUH2ROBb+xi+HEXajq46ZL8KDyyCtz7WiHTfrbxcEWGjqyj20a7UppcJg=="], - - "@types/bun": ["@types/bun@1.3.8", "https://npm.nose.space/@types/bun/-/bun-1.3.8.tgz", { "dependencies": { "bun-types": "1.3.8" } }, "sha512-3LvWJ2q5GerAXYxO2mffLTqOzEu5qnhEAlh48Vnu8WQfnmSwbgagjGZV6BoHKJztENYEDn6QmVd949W4uESRJA=="], - - "@types/node": ["@types/node@25.1.0", "https://npm.nose.space/@types/node/-/node-25.1.0.tgz", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-t7frlewr6+cbx+9Ohpl0NOTKXZNV9xHRmNOvql47BFJKcEG1CxtxlPEEe+gR9uhVWM4DwhnvTF110mIL4yP9RA=="], - - "bun-types": ["bun-types@1.3.8", "https://npm.nose.space/bun-types/-/bun-types-1.3.8.tgz", { "dependencies": { "@types/node": "*" } }, "sha512-fL99nxdOWvV4LqjmC+8Q9kW3M4QTtTR1eePs94v5ctGqU8OeceWrSUaRw3JYb7tU3FkMIAjkueehrHPPPGKi5Q=="], - - "commander": ["commander@14.0.3", "https://npm.nose.space/commander/-/commander-14.0.3.tgz", {}, "sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw=="], - - "diff": ["diff@8.0.3", "https://npm.nose.space/diff/-/diff-8.0.3.tgz", {}, "sha512-qejHi7bcSD4hQAZE0tNAawRK1ZtafHDmMTMkrrIGgSLl7hTnQHmKCeB45xAcbfTqK2zowkM3j3bHt/4b/ARbYQ=="], - - "hono": ["hono@4.11.7", "https://npm.nose.space/hono/-/hono-4.11.7.tgz", {}, "sha512-l7qMiNee7t82bH3SeyUCt9UF15EVmaBvsppY2zQtrbIhl/yzBTny+YUxsVjSjQ6gaqaeVtZmGocom8TzBlA4Yw=="], - - "kleur": ["kleur@4.1.5", "https://npm.nose.space/kleur/-/kleur-4.1.5.tgz", {}, "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ=="], - - "typescript": ["typescript@5.9.3", "https://npm.nose.space/typescript/-/typescript-5.9.3.tgz", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="], - - "undici-types": ["undici-types@7.16.0", "https://npm.nose.space/undici-types/-/undici-types-7.16.0.tgz", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="], - } -} diff --git a/apps/versions/index.tsx b/apps/versions/index.tsx deleted file mode 100644 index 1c7cfda..0000000 --- a/apps/versions/index.tsx +++ /dev/null @@ -1,177 +0,0 @@ -import { Hype } from '@because/hype' -import { define, stylesToCSS } from '@because/forge' -import { baseStyles, ToolScript, theme } from '@because/toes/tools' -import { readdir, readlink, stat } from 'fs/promises' -import { join } from 'path' -import type { Child } from 'hono/jsx' - -const APPS_DIR = process.env.APPS_DIR! -const TOES_URL = process.env.TOES_URL! - -const app = new Hype({ prettyHTML: false }) - -const Container = define('Container', { - fontFamily: theme('fonts-sans'), - padding: '20px', - paddingTop: 0, - maxWidth: '800px', - margin: '0 auto', - color: theme('colors-text'), -}) - -const VersionList = define('VersionList', { - listStyle: 'none', - padding: 0, - margin: '20px 0', - border: `1px solid ${theme('colors-border')}`, - borderRadius: theme('radius-md'), - overflow: 'hidden', -}) - -const VersionItem = define('VersionItem', { - padding: '12px 15px', - borderBottom: `1px solid ${theme('colors-border')}`, - display: 'flex', - alignItems: 'center', - justifyContent: 'space-between', - states: { - ':last-child': { - borderBottom: 'none', - }, - ':hover': { - backgroundColor: theme('colors-bgHover'), - }, - }, -}) - -const VersionLink = define('VersionLink', { - base: 'a', - textDecoration: 'none', - color: theme('colors-link'), - fontFamily: theme('fonts-mono'), - fontSize: '15px', - cursor: 'pointer', - states: { - ':hover': { - textDecoration: 'underline', - }, - }, -}) - -const Badge = define('Badge', { - fontSize: '12px', - padding: '2px 8px', - borderRadius: theme('radius-md'), - backgroundColor: theme('colors-bgElement'), - color: theme('colors-statusRunning'), - fontWeight: 'bold', -}) - -const ErrorBox = define('ErrorBox', { - color: theme('colors-error'), - padding: '20px', - backgroundColor: theme('colors-bgElement'), - borderRadius: theme('radius-md'), - margin: '20px 0', -}) - -interface LayoutProps { - title: string - children: Child -} - -function Layout({ title, children }: LayoutProps) { - return ( - - - - - {title} - - - - - - {children} - - - - ) -} - -app.get('/ok', c => c.text('ok')) - -app.get('/styles.css', c => c.text(baseStyles + stylesToCSS(), 200, { - 'Content-Type': 'text/css; charset=utf-8', -})) - -async function getVersions(appPath: string): Promise<{ name: string; isCurrent: boolean }[]> { - const entries = await readdir(appPath, { withFileTypes: true }) - - let currentTarget = '' - try { - currentTarget = await readlink(join(appPath, 'current')) - } catch { } - - return entries - .filter(e => e.isDirectory() && /^\d{8}-\d{6}$/.test(e.name)) - .map(e => ({ name: e.name, isCurrent: e.name === currentTarget })) - .sort((a, b) => b.name.localeCompare(a.name)) -} - -function formatTimestamp(ts: string): string { - return `${ts.slice(0, 4)}-${ts.slice(4, 6)}-${ts.slice(6, 8)} ${ts.slice(9, 11)}:${ts.slice(11, 13)}:${ts.slice(13, 15)}` -} - -app.get('/', async c => { - const appName = c.req.query('app') - - if (!appName) { - return c.html( - - Please specify an app name with ?app=<name> - - ) - } - - const appPath = join(APPS_DIR, appName) - - try { - await stat(appPath) - } catch { - return c.html( - - App "{appName}" not found - - ) - } - - const versions = await getVersions(appPath) - - if (versions.length === 0) { - return c.html( - - No versions found - - ) - } - - return c.html( - - - {versions.map(v => ( - - - {formatTimestamp(v.name)} - - {v.isCurrent && current} - - ))} - - - ) -}) - -export default app.defaults diff --git a/apps/versions/package.json b/apps/versions/package.json deleted file mode 100644 index fba756d..0000000 --- a/apps/versions/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "versions", - "module": "index.tsx", - "type": "module", - "private": true, - "scripts": { - "toes": "bun run --watch index.tsx", - "start": "bun toes", - "dev": "bun run --hot index.tsx" - }, - "toes": { - "tool": true, - "icon": "📦" - }, - "devDependencies": { - "@types/bun": "latest" - }, - "peerDependencies": { - "typescript": "^5.9.3" - }, - "dependencies": { - "@because/forge": "^0.0.1", - "@because/hype": "^0.0.2", - "@because/toes": "^0.0.5" - } -} diff --git a/apps/versions/tsconfig.json b/apps/versions/tsconfig.json deleted file mode 100644 index 545396c..0000000 --- a/apps/versions/tsconfig.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "compilerOptions": { - // Environment setup & latest features - "lib": ["ESNext"], - "target": "ESNext", - "module": "Preserve", - "moduleDetection": "force", - "jsx": "react-jsx", - "jsxImportSource": "hono/jsx", - "allowJs": true, - - // Bundler mode - "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "verbatimModuleSyntax": true, - "noEmit": true, - - // Best practices - "strict": true, - "skipLibCheck": true, - "noFallthroughCasesInSwitch": true, - "noUncheckedIndexedAccess": true, - "noImplicitOverride": true, - - // Some stricter flags (disabled by default) - "noUnusedLocals": false, - "noUnusedParameters": false, - "noPropertyAccessFromIndexSignature": false - } -} diff --git a/install/install.sh b/install/install.sh index 9d530a3..e666252 100644 --- a/install/install.sh +++ b/install/install.sh @@ -88,7 +88,7 @@ cd "$DEST" && bun run build # -- Bundled apps -- echo ">> Installing bundled apps" -BUNDLED_APPS="clock code cron env stats versions" +BUNDLED_APPS="clock code cron env stats" for app in $BUNDLED_APPS; do if [ -d "$DEST/apps/$app" ]; then if [ -d ~/apps/"$app" ]; then diff --git a/scripts/install.sh b/scripts/install.sh index f0a2b28..4a02b67 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -58,7 +58,7 @@ mkdir -p ~/data mkdir -p ~/apps echo ">> Installing bundled apps" -BUNDLED_APPS="clock code cron env git metrics versions" +BUNDLED_APPS="clock code cron env git metrics" for app in $BUNDLED_APPS; do if [ -d "apps/$app" ]; then echo " Installing $app..."