diff --git a/.github/workflows/site.yml b/.github/workflows/site.yml new file mode 100644 index 0000000..1a86abd --- /dev/null +++ b/.github/workflows/site.yml @@ -0,0 +1,43 @@ +name: Site + +on: + pull_request: + paths: + - "site/**" + - ".github/workflows/site.yml" + push: + branches: [ main ] + paths: + - "site/**" + - ".github/workflows/site.yml" + +permissions: + contents: read + +defaults: + run: + working-directory: site + +jobs: + build-site: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + with: + persist-credentials: false + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 + with: + node-version: 24 + cache: npm + cache-dependency-path: site/package-lock.json + - name: Install dependencies + run: npm ci + - name: Format + run: npm run format:check + - name: Lint + run: npm run check + - name: Test + run: npm test --if-present + - name: Build + run: npm run build diff --git a/site/.prettierignore b/site/.prettierignore new file mode 100644 index 0000000..f27f5f7 --- /dev/null +++ b/site/.prettierignore @@ -0,0 +1,6 @@ +dist +node_modules +.astro +package-lock.json +public/install.sh +public/install.ps1 diff --git a/site/.prettierrc.json b/site/.prettierrc.json new file mode 100644 index 0000000..d87faa5 --- /dev/null +++ b/site/.prettierrc.json @@ -0,0 +1,11 @@ +{ + "plugins": ["prettier-plugin-astro"], + "overrides": [ + { + "files": "*.astro", + "options": { + "parser": "astro" + } + } + ] +} diff --git a/site/package-lock.json b/site/package-lock.json index 2a96606..41375b1 100644 --- a/site/package-lock.json +++ b/site/package-lock.json @@ -14,6 +14,8 @@ "devDependencies": { "@astrojs/check": "^0.9.9", "@tailwindcss/vite": "^4.0.0", + "prettier": "3.8.3", + "prettier-plugin-astro": "0.14.1", "tailwindcss": "^4.0.0", "typescript": "^5.6.0" } @@ -5717,6 +5719,21 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, + "node_modules/prettier-plugin-astro": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/prettier-plugin-astro/-/prettier-plugin-astro-0.14.1.tgz", + "integrity": "sha512-RiBETaaP9veVstE4vUwSIcdATj6dKmXljouXc/DDNwBSPTp8FRkLGDSGFClKsAFeeg+13SB0Z1JZvbD76bigJw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@astrojs/compiler": "^2.9.1", + "prettier": "^3.0.0", + "sass-formatter": "^0.7.6" + }, + "engines": { + "node": "^14.15.0 || >=16.0.0" + } + }, "node_modules/prismjs": { "version": "1.30.0", "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.30.0.tgz", @@ -6066,6 +6083,23 @@ "fsevents": "~2.3.2" } }, + "node_modules/s.color": { + "version": "0.0.15", + "resolved": "https://registry.npmjs.org/s.color/-/s.color-0.0.15.tgz", + "integrity": "sha512-AUNrbEUHeKY8XsYr/DYpl+qk5+aM+DChopnWOPEzn8YKzOhv4l2zH6LzZms3tOZP3wwdOyc0RmTciyi46HLIuA==", + "dev": true, + "license": "MIT" + }, + "node_modules/sass-formatter": { + "version": "0.7.9", + "resolved": "https://registry.npmjs.org/sass-formatter/-/sass-formatter-0.7.9.tgz", + "integrity": "sha512-CWZ8XiSim+fJVG0cFLStwDvft1VI7uvXdCNJYXhDvowiv+DsbD1nXLiQ4zrE5UBvj5DWZJ93cwN0NX5PMsr1Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "suf-log": "^2.5.3" + } + }, "node_modules/sax": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/sax/-/sax-1.6.0.tgz", @@ -6256,6 +6290,16 @@ "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, + "node_modules/suf-log": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/suf-log/-/suf-log-2.5.3.tgz", + "integrity": "sha512-KvC8OPjzdNOe+xQ4XWJV2whQA0aM1kGVczMQ8+dStAO6KfEB140JEVQ9dE76ONZ0/Ylf67ni4tILPJB41U0eow==", + "dev": true, + "license": "MIT", + "dependencies": { + "s.color": "0.0.15" + } + }, "node_modules/svgo": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/svgo/-/svgo-4.0.1.tgz", diff --git a/site/package.json b/site/package.json index be90f7e..ef6938c 100644 --- a/site/package.json +++ b/site/package.json @@ -9,7 +9,9 @@ "prebuild": "node scripts/copy-install.mjs", "build": "astro build", "preview": "astro preview", - "check": "astro check" + "check": "astro check", + "format": "prettier --write .", + "format:check": "prettier --check ." }, "dependencies": { "@astrojs/sitemap": "^3.2.0", @@ -18,6 +20,8 @@ "devDependencies": { "@astrojs/check": "^0.9.9", "@tailwindcss/vite": "^4.0.0", + "prettier": "3.8.3", + "prettier-plugin-astro": "0.14.1", "tailwindcss": "^4.0.0", "typescript": "^5.6.0" } diff --git a/site/scripts/copy-install.mjs b/site/scripts/copy-install.mjs index d5c4d44..a3d7ff6 100644 --- a/site/scripts/copy-install.mjs +++ b/site/scripts/copy-install.mjs @@ -1,22 +1,24 @@ -import { copyFile, access } from 'node:fs/promises'; -import { dirname, join } from 'node:path'; -import { fileURLToPath } from 'node:url'; +import { copyFile, access } from "node:fs/promises"; +import { dirname, join } from "node:path"; +import { fileURLToPath } from "node:url"; const here = dirname(fileURLToPath(import.meta.url)); // repo-root install scripts (single source of truth) -const scripts = ['install.sh', 'install.ps1']; +const scripts = ["install.sh", "install.ps1"]; await Promise.all( scripts.map(async (name) => { - const src = join(here, '..', '..', name); - const dest = join(here, '..', 'public', name); + const src = join(here, "..", "..", name); + const dest = join(here, "..", "public", name); try { await access(src); } catch { console.error(`[copy-install] source not found: ${src}`); - console.error(`[copy-install] the repo-root ${name} must be available at build time.`); + console.error( + `[copy-install] the repo-root ${name} must be available at build time.`, + ); process.exit(1); } diff --git a/site/src/components/CopyButton.astro b/site/src/components/CopyButton.astro index 21064b5..61e5446 100644 --- a/site/src/components/CopyButton.astro +++ b/site/src/components/CopyButton.astro @@ -5,6 +5,7 @@ interface Props { } const { text, class: className } = Astro.props; --- + @@ -46,7 +65,9 @@ const { text, class: className } = Astro.props; }; document.addEventListener("click", (event) => { - const button = (event.target as HTMLElement)?.closest(".copy-btn"); + const button = (event.target as HTMLElement)?.closest( + ".copy-btn", + ); if (button) { handleCopy(button); } diff --git a/site/src/components/ExplorerHero.astro b/site/src/components/ExplorerHero.astro index f375008..374dcc3 100644 --- a/site/src/components/ExplorerHero.astro +++ b/site/src/components/ExplorerHero.astro @@ -17,44 +17,98 @@ const remote = [ ]; const status = "↹ switch · ↑↓ move · ↵ open · SPACE transfer"; --- +
-

// terminal file transfer

-
+

+ // terminal file transfer +

+
termscp — 192.168.1.10 (sftp) connected
-
/home/veeso (local)
- {local.map((r) => ( -
- {r.name}{r.size} -
- ))} +
+ /home/veeso (local) +
+ { + local.map((r) => ( +
+ <> + {r.name} + {r.size} + +
+ )) + }
-
/var/www (remote)
- {remote.map((r) => ( -
- {r.name} - {r.size} -
- ))} +
+ /var/www (remote) +
+ { + remote.map((r) => ( +
+ {r.name} + + {r.size} + +
+ )) + }
- {/* set:html is safe: status is a static author-controlled string, never user input. */} -
- $1')}> + { + /* set:html is safe: status is a static author-controlled string, never user input. */ + } +
+ $1', + )} + /> 4 files · 1.2 GB
-

The dual-pane explorer for your terminal

-

Local left, remote right. Transfer, sync, edit — never leave the keyboard.

+

+ The dual-pane explorer for your terminal +

+

+ Local left, remote right. Transfer, sync, edit — never leave the + keyboard. +

diff --git a/site/src/components/FeatureCard.astro b/site/src/components/FeatureCard.astro index 4ffea46..d983e61 100644 --- a/site/src/components/FeatureCard.astro +++ b/site/src/components/FeatureCard.astro @@ -1,7 +1,11 @@ --- -interface Props { title: string; body: string; } +interface Props { + title: string; + body: string; +} const { title, body } = Astro.props; --- +

{title}

{body}

diff --git a/site/src/components/Footer.astro b/site/src/components/Footer.astro index 375ddae..9a64903 100644 --- a/site/src/components/Footer.astro +++ b/site/src/components/Footer.astro @@ -2,13 +2,20 @@ import { DOCS_URL, GITHUB_URL, VERSION } from "../consts"; const year = new Date().getFullYear(); --- +
-
+
-

termscp v{VERSION} · © {year} Christian Visintin · Released under the MIT license.

+

+ termscp v{VERSION} · © {year} Christian Visintin · Released under the MIT license. +

diff --git a/site/src/components/InstallTabs.astro b/site/src/components/InstallTabs.astro index 04001b4..61fe21d 100644 --- a/site/src/components/InstallTabs.astro +++ b/site/src/components/InstallTabs.astro @@ -1,35 +1,52 @@ --- import CopyButton from "./CopyButton.astro"; -interface Method { id: string; label: string; cmd: string; } -interface Props { methods: Method[]; } +interface Method { + id: string; + label: string; + cmd: string; +} +interface Props { + methods: Method[]; +} const { methods } = Astro.props; --- +
- {methods.map((m, i) => ( - - ))} + { + methods.map((m, i) => ( + + )) + }
- {methods.map((m, i) => ( - - ))} + { + methods.map((m, i) => ( + + )) + }
diff --git a/site/src/components/Nav.astro b/site/src/components/Nav.astro index aec88e4..4f9fa30 100644 --- a/site/src/components/Nav.astro +++ b/site/src/components/Nav.astro @@ -2,7 +2,10 @@ import ThemeToggle from "./ThemeToggle.astro"; import { DOCS_URL, GITHUB_URL } from "../consts"; --- -
+ +
diff --git a/site/src/pages/install.astro b/site/src/pages/install.astro index 59adc5a..621f76a 100644 --- a/site/src/pages/install.astro +++ b/site/src/pages/install.astro @@ -6,7 +6,8 @@ import InstallTabs from "../components/InstallTabs.astro"; import CopyButton from "../components/CopyButton.astro"; import { DOCS_URL } from "../consts"; -const script = "curl --proto '=https' --tlsv1.2 -sSLf https://termscp.rs/install.sh | sh"; +const script = + "curl --proto '=https' --tlsv1.2 -sSLf https://termscp.rs/install.sh | sh"; const psScript = "irm https://termscp.rs/install.ps1 | iex"; const methods = [ @@ -16,6 +17,7 @@ const methods = [ { id: "choco", label: "Windows (Chocolatey)", cmd: "choco install termscp" }, ]; --- +

Install termscp

-

Pick your platform. One command and you're in.

+

+ Pick your platform. One command and you're in. +

-
+
$ Linux · macOS · BSD
-
{script}
+
{script}
-

Requires curl. macOS uses Homebrew if available, otherwise builds from source.

+

+ Requires curl. macOS uses Homebrew if + available, otherwise builds from source. +

-
+
> Windows (PowerShell)
-
{psScript}
+
{psScript}
-

Downloads the latest release and adds termscp to your user PATH.

+

+ Downloads the latest release and adds termscp to your user PATH. +

Package managers

-

Update anytime with termscp --update.

+

+ Update anytime with termscp --update. +

- Linux build deps: libdbus-1, pkg-config, libsmbclient. - More details in the docs. + Linux build deps: libdbus-1, pkg-config, libsmbclient. More details in the docs.