Skip to content

Add full Windows support (new targets, install.ps1, build flags, ICO, metadata)#108

Merged
shouze merged 3 commits intomainfrom
feat/windows-install-ps1
Mar 11, 2026
Merged

Add full Windows support (new targets, install.ps1, build flags, ICO, metadata)#108
shouze merged 3 commits intomainfrom
feat/windows-install-ps1

Conversation

@shouze
Copy link
Contributor

@shouze shouze commented Mar 10, 2026

Closes #92

Root cause / motivation

Several gaps prevented github-code-search from working correctly on Windows:

  • bytecode: true in Bun.build() caused the compiled binary to crash at startup on Windows.
  • The single bun-windows-x64 target left ARM64 and CPU-variant users without a compatible binary.
  • The install.ps1 script only handled AMD64 and had no fallback logic.
  • No Windows-specific EXE metadata (icon, title, publisher, …) was set, so the binary was misidentified as "bun" by the OS.

What changed

build.ts

  • Removed bytecode: true (fixes Windows crash).
  • Added Windows-specific compile flags: icon, hideConsole, title, publisher, version, description, copyright (populated from package.json).
  • Icon path passed as an absolute path (import.meta.dir-based) to avoid CWD-relative resolution failures.
  • New targets recognised by parseTarget: bun-windows-x64-baseline, bun-windows-x64-modern, bun-windows-arm64.
  • Pure helpers (parseTarget, isWindowsTarget, getOutfile, getBuildCompileOptions) exported for unit testing.

build.test.ts (new)

35 unit tests covering all pure helpers.

install.ps1

  • ARM64 (PROCESSOR_ARCHITECTURE=ARM64) now resolved to the arm64 binary.
  • AMD64 now prefers x64-modern (AVX2, ~99 % of x86-64 hardware since 2013) with automatic fallback to x64-baseline if the asset is absent in the target release.

.github/workflows/cd.yaml

Three new matrix entries (all cross-compiled from ubuntu-latest):

  • bun-windows-x64-baselinegithub-code-search-windows-x64-baseline.exe
  • bun-windows-x64-moderngithub-code-search-windows-x64-modern.exe
  • bun-windows-arm64github-code-search-windows-arm64.exe

scripts/generate-ico.ts + docs/public/icons/favicon.ico (new)

Multi-resolution ICO (16×16, 32×32, 48×48, 256×256, PNG-compressed) generated from docs/public/logo.svg via sharp. Regenerate with bun run generate-ico.

README.md

Quick-start section now includes the Windows / PowerShell install block.

package.json

  • generate-ico script added.
  • sharp added as dev dependency.

How to verify

# Build a Windows binary from macOS / Linux
bun run build --target=bun-windows-x64-modern
bun run build --target=bun-windows-x64-baseline
bun run build --target=bun-windows-arm64

# Unit tests
bun test build.test.ts   # 35 pass

# Full suite
bun test && bun run lint && bun run format:check && bun run knip

On Windows, right-click the .exe → Properties → Details: you should see the title, publisher, version, description and copyright fields populated correctly, and the app icon should display instead of the default "bun" icon.

… metadata)

- build.ts: remove bytecode (breaks Windows), add Windows-specific flags
  (icon, hideConsole, title, publisher, version, description, copyright),
  support bun-windows-x64-baseline / bun-windows-x64-modern / bun-windows-arm64
- build.test.ts: unit tests for parseTarget, isWindowsTarget, getOutfile,
  getBuildCompileOptions (35 cases)
- install.ps1: detect ARM64, prefer x64-modern with auto-fallback to
  x64-baseline when asset is absent in the release
- cd.yaml: add bun-windows-x64-baseline, bun-windows-x64-modern,
  bun-windows-arm64 to the build matrix
- scripts/generate-ico.ts: generate multi-resolution ICO (16/32/48/256)
  from docs/public/logo.svg via sharp
- docs/public/icons/favicon.ico: generated Windows icon asset
- README.md: add Windows PowerShell quick-start block
- package.json: add generate-ico script, add sharp dev dependency
Copilot AI review requested due to automatic review settings March 10, 2026 08:59
@github-actions
Copy link

Coverage after merging feat/windows-install-ps1 into main will be

95.26%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
build.ts76.27%100%100%75.22%185–203, 205–213
src
   aggregate.ts100%100%100%100%
   api-utils.ts93.20%100%93.75%93.13%101–103, 65, 73, 86–87, 91–92
   api.ts94.55%100%100%93.86%318–322, 383, 400, 63–69
   cache.ts98.08%100%100%97.87%28
   completions.ts99.35%100%100%99.29%252
   group.ts100%100%100%100%
   output.ts99.12%100%94.74%99.52%58
   render.ts94.26%100%89.47%94.49%158, 182–187, 189–191, 193–194, 245–246, 267, 440–441, 523–527
   upgrade.ts88.46%100%94.44%87.89%127–128, 148–155, 158–164, 169, 174, 210–213
src/render
   filter-match.ts97.44%100%92.31%100%
   filter.ts100%100%100%100%
   highlight.ts96.63%100%90.40%99.31%284–285
   rows.ts97.58%100%100%97.44%168, 54–55
   selection.ts100%100%100%100%
   summary.ts100%100%100%100%

@github-actions
Copy link

github-actions bot commented Mar 10, 2026

🔦 Lighthouse Report

Page ⚡ Perf ♿ A11y 🛡️ BP 🔍 SEO Report
/github-code-search/ 🟢 98 (≥97) 🟢 100 (≥99) 🟢 100 (≥99) 🟢 100 (≥99) 🔗 view
/github-code-search/getting-started/ 🟢 99 (≥97) 🟢 100 (≥99) 🟢 100 (≥99) 🟢 100 (≥99) 🔗 view

Thresholds: Perf ≥ 97 · A11y ≥ 99 · BP ≥ 99 · SEO ≥ 99
commit 8008df0 · full workflow run

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds end-to-end Windows support for github-code-search, covering build-time EXE metadata (icon/details), expanded Windows targets, a native PowerShell installer, and updated docs/CI to ship and document the new artifacts.

Changes:

  • Updated build.ts to support additional Windows targets and to emit Windows-specific executable metadata (icon/title/publisher/etc.), plus exported helper functions with new unit tests.
  • Added install.ps1 with architecture detection, minimum Windows build guard, download + fallback logic, PATH update, and verification.
  • Updated docs/README and the docs homepage install section to include PowerShell installation; added an ICO generator and committed the generated icon.

Reviewed changes

Copilot reviewed 9 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
build.ts Adds Windows targets/metadata + exports helpers used by tests
build.test.ts New unit tests for build helper functions
install.ps1 New PowerShell installer with arch/version checks, download, PATH update, verification
.github/workflows/cd.yaml Publishes additional Windows build variants as release artifacts
docs/getting-started/installation.md Documents Windows installation via PowerShell
docs/.vitepress/theme/InstallSection.vue Adds a Windows tab with PowerShell install command on the homepage
scripts/generate-ico.ts Generates a multi-resolution Windows ICO from the SVG logo
docs/public/icons/favicon.ico Adds generated ICO used for Windows executable icon metadata
README.md Adds Windows PowerShell quick-start snippet
package.json Adds generate-ico script and sharp dev dependency
bun.lock Lockfile updates for the new dependency graph (sharp + transitive deps)

…roles, win32 normalization

- install.ps1: replace all 'return 1' with 'exit 1' so the process exits
  with a non-zero code when invoked via irm | iex
- install.ps1: add -Target param so callers can force a specific variant
  (x64-modern, x64-baseline, arm64); arch detection only sets a default
  when -Target is omitted
- install.ps1: remove -UseBasicParsing from Invoke-WebRequest (deprecated
  and removed in PowerShell 6+/pwsh)
- InstallSection.vue: replace role=tablist/tab + aria-selected with
  role=group + aria-pressed on plain buttons (no incomplete tab semantics)
- build.ts: normalize process.platform 'win32' to 'windows' in parseTarget()
  so native Windows builds (no --target) correctly add .exe and Windows metadata
- build.test.ts: add regression test documenting the win32 normalization contract
@github-actions
Copy link

Coverage after merging feat/windows-install-ps1 into main will be

95.26%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
build.ts76.27%100%100%75.22%188–206, 208–216
src
   aggregate.ts100%100%100%100%
   api-utils.ts93.20%100%93.75%93.13%101–103, 65, 73, 86–87, 91–92
   api.ts94.55%100%100%93.86%318–322, 383, 400, 63–69
   cache.ts98.08%100%100%97.87%28
   completions.ts99.35%100%100%99.29%252
   group.ts100%100%100%100%
   output.ts99.12%100%94.74%99.52%58
   render.ts94.26%100%89.47%94.49%158, 182–187, 189–191, 193–194, 245–246, 267, 440–441, 523–527
   upgrade.ts88.46%100%94.44%87.89%127–128, 148–155, 158–164, 169, 174, 210–213
src/render
   filter-match.ts97.44%100%92.31%100%
   filter.ts100%100%100%100%
   highlight.ts96.63%100%90.40%99.31%284–285
   rows.ts97.58%100%100%97.44%168, 54–55
   selection.ts100%100%100%100%
   summary.ts100%100%100%100%

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 11 changed files in this pull request and generated 6 comments.

…rd, x64 fallback, focus-visible, ico paths, coverage
@github-actions
Copy link

Coverage after merging feat/windows-install-ps1 into main will be

96.35%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   aggregate.ts100%100%100%100%
   api-utils.ts93.20%100%93.75%93.13%101–103, 65, 73, 86–87, 91–92
   api.ts94.55%100%100%93.86%318–322, 383, 400, 63–69
   cache.ts98.08%100%100%97.87%28
   completions.ts99.35%100%100%99.29%252
   group.ts100%100%100%100%
   output.ts99.12%100%94.74%99.52%58
   render.ts94.26%100%89.47%94.49%158, 182–187, 189–191, 193–194, 245–246, 267, 440–441, 523–527
   upgrade.ts88.46%100%94.44%87.89%127–128, 148–155, 158–164, 169, 174, 210–213
src/render
   filter-match.ts97.44%100%92.31%100%
   filter.ts100%100%100%100%
   highlight.ts96.63%100%90.40%99.31%284–285
   rows.ts97.58%100%100%97.44%168, 54–55
   selection.ts100%100%100%100%
   summary.ts100%100%100%100%

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 12 changed files in this pull request and generated 3 comments.

# Installation

## Via `curl` (recommended)
## Linux / macOS via `curl` (recommended)
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The section is now titled “Linux / macOS via curl”, but the following sentence still states the curl script supports Windows (MINGW/MSYS/Cygwin). Either broaden the heading (e.g., “Via curl (bash)”) or update the sentence to match the Linux/macOS-only heading to avoid confusing Windows users about which installer to use.

Suggested change
## Linux / macOS via `curl` (recommended)
## Via `curl` (bash, recommended)

Copilot uses AI. Check for mistakes.
* Sizes embedded: 16×16, 32×32, 48×48, 256×256 (PNG-compressed, Vista+).
*
* Usage:
* bun run scripts/generate-ico.ts
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The usage comment suggests bun run scripts/generate-ico.ts, but the repo’s documented invocation is bun run generate-ico (package.json script) or bun scripts/generate-ico.ts. Consider updating the usage block to match the supported command to prevent copy/paste failures.

Suggested change
* bun run scripts/generate-ico.ts
* bun run generate-ico
* # or:
* bun scripts/generate-ico.ts

Copilot uses AI. Check for mistakes.
*/

import sharp from "sharp";
import { mkdirSync, writeFileSync } from "fs";
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script imports from "fs" while other scripts in this repo use the explicit "node:fs" form (e.g. scripts/generate-og.ts). Switching to "node:fs" keeps imports consistent and avoids any bundler/runtime ambiguity.

Suggested change
import { mkdirSync, writeFileSync } from "fs";
import { mkdirSync, writeFileSync } from "node:fs";

Copilot uses AI. Check for mistakes.
@shouze shouze merged commit 199912e into main Mar 11, 2026
13 checks passed
@shouze shouze deleted the feat/windows-install-ps1 branch March 11, 2026 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add native PowerShell installation script for Windows (install.ps1)

2 participants