From d0ef0bd99a9a0ace811d2d7c0bf55916111ac8fc Mon Sep 17 00:00:00 2001 From: Teakowa Date: Sun, 27 Sep 2026 19:52:52 +0800 Subject: [PATCH 1/2] fix: use dedicated installer host --- .github/workflows/ci.yml | 2 +- .gitignore | 2 - package.json | 7 ++-- scripts/sync-installer.mjs | 85 -------------------------------------- scripts/verify-build.mjs | 43 ------------------- src/lib/site.ts | 14 +++---- 6 files changed, 11 insertions(+), 142 deletions(-) delete mode 100644 scripts/sync-installer.mjs delete mode 100644 scripts/verify-build.mjs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ce3438a..bd85513 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,5 +41,5 @@ jobs: - name: Svelte check run: pnpm check - - name: Build site and verify installer + - name: Build site run: pnpm build diff --git a/.gitignore b/.gitignore index c86f8f0..59781ea 100644 --- a/.gitignore +++ b/.gitignore @@ -10,5 +10,3 @@ vite.config.js.timestamp-* vite.config.ts.timestamp-* /test-results/ /playwright-report/ -/static/install.sh -/static/install.ps1 diff --git a/package.json b/package.json index a85a4b3..79116ad 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,10 @@ "private": true, "type": "module", "scripts": { - "sync:installer": "node scripts/sync-installer.mjs", - "dev": "node scripts/sync-installer.mjs && vite dev", - "build": "node scripts/sync-installer.mjs && vite build && node scripts/verify-build.mjs", + "dev": "vite dev", + "build": "vite build", "preview": "vite preview", - "check": "node scripts/sync-installer.mjs && svelte-kit sync && svelte-check --tsconfig ./tsconfig.json" + "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json" }, "devDependencies": { "@sveltejs/adapter-static": "^3.0.10", diff --git a/scripts/sync-installer.mjs b/scripts/sync-installer.mjs deleted file mode 100644 index 560d239..0000000 --- a/scripts/sync-installer.mjs +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env node -import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs'; -import { resolve, dirname } from 'node:path'; -import { fileURLToPath } from 'node:url'; - -const __dirname = dirname(fileURLToPath(import.meta.url)); -const ROOT_DIR = resolve(__dirname, '..'); -const STATIC_DIR = resolve(ROOT_DIR, 'static'); - -const installers = [ - { - name: 'install.sh', - targetFile: resolve(STATIC_DIR, 'install.sh'), - localPath: resolve(ROOT_DIR, '../wright/install.sh'), - pathEnv: 'WRIGHT_INSTALLER_PATH', - urlEnv: 'WRIGHT_INSTALLER_URL', - remoteUrl: 'https://raw.githubusercontent.com/wrightkit/wright/main/install.sh', - validate(content) { - if (!content.startsWith('#!/usr/bin/env bash') && !content.startsWith('#!/bin/bash')) { - throw new Error('install.sh must start with a bash shebang.'); - } - } - }, - { - name: 'install.ps1', - targetFile: resolve(STATIC_DIR, 'install.ps1'), - localPath: resolve(ROOT_DIR, '../wright/install.ps1'), - pathEnv: 'WRIGHT_WINDOWS_INSTALLER_PATH', - urlEnv: 'WRIGHT_WINDOWS_INSTALLER_URL', - remoteUrl: 'https://raw.githubusercontent.com/wrightkit/wright/main/install.ps1', - validate(content) { - if (!content.includes('[CmdletBinding()]') || !content.includes('x86_64-pc-windows-msvc')) { - throw new Error('install.ps1 is missing the expected PowerShell installer contract.'); - } - } - } -]; - -async function getInstallerContent(installer) { - const envPath = process.env[installer.pathEnv]; - if (envPath && existsSync(envPath)) { - return readFileSync(envPath, 'utf8'); - } - - if (existsSync(installer.localPath)) { - return readFileSync(installer.localPath, 'utf8'); - } - - const remoteUrl = process.env[installer.urlEnv] || installer.remoteUrl; - const response = await fetch(remoteUrl); - if (!response.ok) { - throw new Error(`Failed to fetch ${installer.name} from ${remoteUrl}: ${response.status} ${response.statusText}`); - } - return await response.text(); -} - -function validateInstaller(installer, content) { - if (!content || typeof content !== 'string') { - throw new Error(`${installer.name} content is empty or invalid.`); - } - installer.validate(content); - if (!content.includes('wright') || !content.includes('wright-lsp')) { - throw new Error(`${installer.name} is missing expected binary definitions (wright / wright-lsp).`); - } - if (content.length < 500) { - throw new Error(`${installer.name} is suspiciously short (${content.length} bytes).`); - } -} - -async function main() { - if (!existsSync(STATIC_DIR)) { - mkdirSync(STATIC_DIR, { recursive: true }); - } - - for (const installer of installers) { - const content = await getInstallerContent(installer); - validateInstaller(installer, content); - writeFileSync(installer.targetFile, content, 'utf8'); - } -} - -main().catch((err) => { - console.error('[sync-installer] Error:', err.message); - process.exit(1); -}); diff --git a/scripts/verify-build.mjs b/scripts/verify-build.mjs deleted file mode 100644 index d9e503b..0000000 --- a/scripts/verify-build.mjs +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env node -import { existsSync, readFileSync } from 'node:fs'; -import { resolve, dirname } from 'node:path'; -import { fileURLToPath } from 'node:url'; - -const __dirname = dirname(fileURLToPath(import.meta.url)); -const ROOT_DIR = resolve(__dirname, '..'); - -const installers = [ - { - name: 'install.sh', - path: resolve(ROOT_DIR, 'build/install.sh'), - validate(content) { - return content.startsWith('#!/usr/bin/env bash') || content.startsWith('#!/bin/bash'); - }, - error: 'build/install.sh has an invalid shebang.' - }, - { - name: 'install.ps1', - path: resolve(ROOT_DIR, 'build/install.ps1'), - validate(content) { - return content.includes('[CmdletBinding()]') && content.includes('x86_64-pc-windows-msvc'); - }, - error: 'build/install.ps1 is missing the expected PowerShell installer contract.' - } -]; - -for (const installer of installers) { - if (!existsSync(installer.path)) { - console.error(`[verify-build] Error: build/${installer.name} does not exist.`); - process.exit(1); - } - - const content = readFileSync(installer.path, 'utf8'); - if (!installer.validate(content)) { - console.error(`[verify-build] Error: ${installer.error}`); - process.exit(1); - } - if (!content.includes('wright') || !content.includes('wright-lsp')) { - console.error(`[verify-build] Error: build/${installer.name} is missing wright binary references.`); - process.exit(1); - } -} diff --git a/src/lib/site.ts b/src/lib/site.ts index d96da22..dd162f8 100644 --- a/src/lib/site.ts +++ b/src/lib/site.ts @@ -43,7 +43,7 @@ export const hero = { lead: 'Wright checks, lints, and analyzes raw Workshop and OverPy projects. Every finding points to the exact line and says how sure it is, and the same results come as structured data for your editor, your CI, and your coding agent.', primaryCta: { label: 'Install Wright', href: '#install' }, secondaryCta: { label: 'View on GitHub', href: site.github }, - quickInstall: 'curl -fsSL https://wrightkit.dev/install.sh | bash' + quickInstall: 'curl -fsSL https://install.wrightkit.dev/wright/install.sh | bash' } as const; export type TerminalLineKind = 'prompt' | 'error' | 'warning' | 'dim' | 'blank'; @@ -217,7 +217,7 @@ export const install = { method: 'Homebrew', command: 'brew install wrightkit/tap/wright', altMethod: 'Installer script', - altCommand: 'curl -fsSL https://wrightkit.dev/install.sh | bash', + altCommand: 'curl -fsSL https://install.wrightkit.dev/wright/install.sh | bash', note: 'Installs the released wright and wright-lsp binaries.' }, { @@ -225,9 +225,9 @@ export const install = { label: 'Linux', badge: 'x86_64', method: 'Installer script', - command: 'curl -fsSL https://wrightkit.dev/install.sh | bash', + command: 'curl -fsSL https://install.wrightkit.dev/wright/install.sh | bash', altMethod: 'Custom install directory', - altCommand: 'curl -fsSL https://wrightkit.dev/install.sh | bash -s -- --dir ~/.local/bin', + altCommand: 'curl -fsSL https://install.wrightkit.dev/wright/install.sh | bash -s -- --dir ~/.local/bin', note: 'Downloads the matching release archive and verifies its checksum.' }, { @@ -235,10 +235,10 @@ export const install = { label: 'Windows', badge: 'x86_64', method: 'PowerShell installer', - command: 'irm https://wrightkit.dev/install.ps1 | iex', + command: 'irm https://install.wrightkit.dev/wright/install.ps1 | iex', altMethod: 'Custom install directory', altCommand: - '$script = irm https://wrightkit.dev/install.ps1; & ([scriptblock]::Create($script)) -InstallDir "$HOME\\bin"', + '$script = irm https://install.wrightkit.dev/wright/install.ps1; & ([scriptblock]::Create($script)) -InstallDir "$HOME\\bin"', note: 'Downloads the matching Windows release and verifies its checksum.' }, { @@ -247,7 +247,7 @@ export const install = { badge: 'Pinned', method: 'Pinned version', command: - 'curl -fsSL https://wrightkit.dev/install.sh | bash -s -- --version "$WRIGHT_VERSION"', + 'curl -fsSL https://install.wrightkit.dev/wright/install.sh | bash -s -- --version "$WRIGHT_VERSION"', altMethod: 'Machine-readable output', altCommand: 'wright lint src/main.opy --format json', note: 'Set WRIGHT_VERSION to a tag from GitHub Releases so every run uses the same build.' From 8eb3986dee34f912d35dc72c23b955faeeca1e8e Mon Sep 17 00:00:00 2001 From: Teakowa Date: Mon, 28 Sep 2026 02:03:42 +0800 Subject: [PATCH 2/2] test: verify only rendered localized commands --- scripts/verify-build.mjs | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/verify-build.mjs b/scripts/verify-build.mjs index 272249d..591fc3e 100644 --- a/scripts/verify-build.mjs +++ b/scripts/verify-build.mjs @@ -15,7 +15,6 @@ const pages = [ ]; const literals = [ 'curl -fsSL https://install.wrightkit.dev/wright/install.sh | bash', - 'irm https://install.wrightkit.dev/wright/install.ps1 | iex', 'brew install wrightkit/tap/wright', 'wright lint rules.txt', 'warning[min-wait-loop]: loop body waits at the workshop minimum rate',