diff --git a/README.md b/README.md index 5d23d52..e409a6f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Bun React template repository +# React SPA starter template -This is a template repository for `React` and `TypeScript` built with Bun. It uses `bun` instead of Node.js and `biome` instead of `prettier / eslint` for better performance. +This is a starter template for a React single-page application built with `TypeScript` and Bun. It uses `bun` instead of Node.js and `biome` instead of `prettier / eslint` for better performance. ## Start a new project from this template diff --git a/sbx-kits/asdf/files/home/.local/bin/asdf-utils.sh b/sbx-kits/asdf/files/home/.local/bin/asdf-utils.sh deleted file mode 100644 index e91bf43..0000000 --- a/sbx-kits/asdf/files/home/.local/bin/asdf-utils.sh +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env bash - -ASDF_RELEASE_API_URL="${ASDF_RELEASE_API_URL:-https://api.github.com/repos/asdf-vm/asdf/releases/latest}" -ASDF_INSTALL_DIR="${ASDF_INSTALL_DIR:-$HOME/.local/bin}" -ASDF_BIN="$ASDF_INSTALL_DIR/asdf" - -ASDF_RELEASE_JSON="" -ASDF_TARGET_VERSION="" -ASDF_OS="" -ASDF_ARCH="" -ASDF_ASSET_URL="" -ASDF_ASSET_MD5_URL="" - -install_latest() { - mkdir -p "$ASDF_INSTALL_DIR" - - local tmp_dir - tmp_dir="$(mktemp -d)" - trap 'rm -rf "$tmp_dir"' RETURN - - local archive="$tmp_dir/asdf.tar.gz" - local archive_md5="$tmp_dir/asdf.tar.gz.md5" - local expected_md5 - local actual_md5 - - log_info "Installing asdf $ASDF_TARGET_VERSION for $ASDF_OS/$ASDF_ARCH." - log_info "Downloading: $ASDF_ASSET_URL" - - curl -fsSL -o "$archive" "$ASDF_ASSET_URL" - curl -fsSL -o "$archive_md5" "$ASDF_ASSET_MD5_URL" - - expected_md5="$(tr -d '[:space:]' < "$archive_md5")" - - if command -v md5sum >/dev/null 2>&1; then - actual_md5="$(md5sum "$archive" | awk '{print $1}')" - else - actual_md5="$(md5 -q "$archive")" - fi - - if [[ "$expected_md5" != "$actual_md5" ]]; then - fail "MD5 checksum mismatch for downloaded archive." - fi - - log_info "MD5 checksum verified." - - tar -xzf "$archive" -C "$tmp_dir" - - if [[ ! -f "$tmp_dir/asdf" ]]; then - fail "Archive did not contain expected asdf binary." - fi - - install -m 755 "$tmp_dir/asdf" "$ASDF_BIN" - log_info "Installed asdf to $ASDF_BIN." -} - -load_latest_release() { - ASDF_OS="$(normalize_os)" - ASDF_ARCH="$(normalize_arch)" - ASDF_RELEASE_JSON="$(curl -fsSL "$ASDF_RELEASE_API_URL")" - - ASDF_TARGET_VERSION="$(jq -r '.target_name // .tag_name // empty' <<<"$ASDF_RELEASE_JSON")" - - if [[ -z "$ASDF_TARGET_VERSION" || "$ASDF_TARGET_VERSION" == "null" ]]; then - fail "Could not determine latest asdf version from release JSON." - fi - - ASDF_ASSET_URL="$(jq -r \ - --arg os "$ASDF_OS" \ - --arg arch "$ASDF_ARCH" \ - '.assets[] - | select(.name | test($os)) - | select(.name | test($arch)) - | select(.name | endswith(".tar.gz")) - | .browser_download_url' <<<"$ASDF_RELEASE_JSON" | head -n 1)" - - if [[ -z "$ASDF_ASSET_URL" || "$ASDF_ASSET_URL" == "null" ]]; then - fail "Could not find release asset for OS=$ASDF_OS ARCH=$ASDF_ARCH." - fi - - ASDF_ASSET_MD5_URL="${ASDF_ASSET_URL}.md5" -} - -installed_version() { - if [[ -x "$ASDF_BIN" ]]; then - "$ASDF_BIN" version 2>/dev/null | awk '{print $1}' || true - fi -} - -normalize_os() { - case "$(uname -s)" in - Linux) printf '%s\n' "linux" ;; - Darwin) printf '%s\n' "darwin" ;; - *) fail "Unsupported operating system: $(uname -s)" ;; - esac -} - -normalize_arch() { - case "$(uname -m)" in - x86_64|amd64) printf '%s\n' "amd64" ;; - arm64|aarch64) printf '%s\n' "arm64" ;; - *) fail "Unsupported architecture: $(uname -m)" ;; - esac -} - -require_dependencies() { - require_cmd curl - require_cmd jq - require_cmd tar - require_cmd install - require_cmd md5sum -} - -require_cmd() { - if ! command -v "$1" >/dev/null 2>&1; then - fail "Missing required command: $1" - fi -} - -fail() { - log_error "$*" - exit 1 -} - -log_info() { - printf '[info] %s\n' "$*" >&2 -} - -log_error() { - printf '[error] %s\n' "$*" >&2 -} diff --git a/sbx-kits/asdf/files/home/.local/bin/install-asdf b/sbx-kits/asdf/files/home/.local/bin/install-asdf deleted file mode 100755 index c9bb39b..0000000 --- a/sbx-kits/asdf/files/home/.local/bin/install-asdf +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -# shellcheck source=asdf-utils.sh -source "$SCRIPT_DIR/asdf-utils.sh" - -require_dependencies -load_latest_release -install_latest diff --git a/sbx-kits/asdf/files/home/.local/bin/sync-asdf-tools b/sbx-kits/asdf/files/home/.local/bin/sync-asdf-tools deleted file mode 100755 index 1984598..0000000 --- a/sbx-kits/asdf/files/home/.local/bin/sync-asdf-tools +++ /dev/null @@ -1,43 +0,0 @@ -# sync-asdf-tool-versions -#!/usr/bin/env bash -set -euo pipefail - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -# shellcheck source=asdf-utils.sh -source "$SCRIPT_DIR/asdf-utils.sh" - -TOOL_VERSIONS_FILE="$WORKSPACE_DIR/.tool-versions" - -sync_tool_versions() { - local plugin - local version - - [[ -f "$TOOL_VERSIONS_FILE" ]] || fail "Missing file: $TOOL_VERSIONS_FILE" - - while read -r plugin version _; do - [[ -n "${plugin:-}" ]] || continue - [[ "$plugin" == \#* ]] && continue - [[ -n "${version:-}" ]] || fail "Missing version for plugin: $plugin" - - install_tool "$plugin" "$version" - done < "$TOOL_VERSIONS_FILE" -} - -install_tool() { - local plugin="$1" - local version="$2" - - if asdf plugin list | grep -Fxq "$plugin"; then - log_info "Updating plugin: $plugin" - asdf plugin update "$plugin" - else - log_info "Adding plugin: $plugin" - asdf plugin add "$plugin" - fi - - log_info "Installing $plugin $version" - asdf install "$plugin" "$version" -} - -require_cmd asdf -sync_tool_versions diff --git a/sbx-kits/asdf/files/home/.local/bin/update-asdf b/sbx-kits/asdf/files/home/.local/bin/update-asdf deleted file mode 100755 index 4215f7c..0000000 --- a/sbx-kits/asdf/files/home/.local/bin/update-asdf +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -# shellcheck source=asdf-utils.sh -source "$SCRIPT_DIR/asdf-utils.sh" - -require_dependencies -load_latest_release - -INSTALLED_VERSION="$(installed_version)" - -if [[ -n "${INSTALLED_VERSION:-}" && "$INSTALLED_VERSION" == "$ASDF_TARGET_VERSION" ]]; then - log_info "No update needed. asdf is already latest version $ASDF_TARGET_VERSION." - exit 0 -fi - -install_latest diff --git a/sbx-kits/asdf/spec.yml b/sbx-kits/asdf/spec.yml deleted file mode 100644 index be6a741..0000000 --- a/sbx-kits/asdf/spec.yml +++ /dev/null @@ -1,23 +0,0 @@ -schemaVersion: "1" -kind: mixin -name: asdf -displayName: asdf -description: The `asdf` tool version manager. - -commands: - install: - #- command: install-asdf - # user: "1000" - # description: Install asdf - - command: echo 'export PATH="$HOME/.asdf/shims:$PATH"' >> /etc/sandbox-persistent.sh - user: "0" - description: Add asdf shims to $PATH - startup: - - command: [update-asdf] - user: "1000" - description: Update asdf to latest version - background: false - - command: [sync-asdf-tools] - user: "1000" - description: Update asdf tools to specified version - background: false diff --git a/src/App.css b/src/App.css deleted file mode 100644 index 0e5efb1..0000000 --- a/src/App.css +++ /dev/null @@ -1,5 +0,0 @@ -.page { - max-width: 48rem; - margin: 0 auto; - padding: 4rem 1.5rem; -} diff --git a/src/App.tsx b/src/App.tsx index a553bc9..1f4bdb0 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,11 +1,8 @@ -import '@picocss/pico/css/pico.min.css' -import './App.css' - export default function App() { return ( -
-

Bun with React

-

Start building amazing things with Bun.

+
+

React SPA Starter template

+

Build your SPA here...

) } diff --git a/src/index.css b/src/index.css new file mode 100644 index 0000000..4aa5104 --- /dev/null +++ b/src/index.css @@ -0,0 +1 @@ +@import '@picocss/pico/css/pico.min.css'; diff --git a/src/index.html b/src/index.html index f124e26..a92e2ed 100644 --- a/src/index.html +++ b/src/index.html @@ -4,9 +4,10 @@ Prototype + -
- +
+