Cleanup for open-source release.
This commit is contained in:
22
AGENTS.md
22
AGENTS.md
@@ -1,22 +0,0 @@
|
||||
## Development
|
||||
|
||||
When starting the dev server, use background mode:
|
||||
|
||||
```
|
||||
astro dev --background
|
||||
```
|
||||
|
||||
Manage the background server with `astro dev stop`, `astro dev status`, and `astro dev logs`.
|
||||
|
||||
## Documentation
|
||||
|
||||
Full documentation: https://docs.astro.build
|
||||
|
||||
Consult these guides before working on related tasks:
|
||||
|
||||
- [Adding pages, dynamic routes, or middleware](https://docs.astro.build/en/guides/routing/)
|
||||
- [Working with Astro components](https://docs.astro.build/en/basics/astro-components/)
|
||||
- [Using React, Vue, Svelte, or other framework components](https://docs.astro.build/en/guides/framework-components/)
|
||||
- [Adding or managing content](https://docs.astro.build/en/guides/content-collections/)
|
||||
- [Adding styles or using Tailwind](https://docs.astro.build/en/guides/styling/)
|
||||
- [Supporting multiple languages](https://docs.astro.build/en/guides/internationalization/)
|
||||
51
README.md
51
README.md
@@ -1,43 +1,26 @@
|
||||
# Astro Starter Kit: Minimal
|
||||
# TenWholeYears Web
|
||||
|
||||
Landing website for TenWhole Years. Built with Astro and runs on Cloudflare Workers!
|
||||
|
||||
## Getting Started
|
||||
|
||||
Install dependencies:
|
||||
|
||||
```sh
|
||||
npm create astro@latest -- --template minimal
|
||||
npm install
|
||||
```
|
||||
|
||||
> 🧑🚀 **Seasoned astronaut?** Delete this file. Have fun!
|
||||
Create a local `.dev.vars` file:
|
||||
|
||||
## 🚀 Project Structure
|
||||
|
||||
Inside of your Astro project, you'll see the following folders and files:
|
||||
|
||||
```text
|
||||
/
|
||||
├── public/
|
||||
├── src/
|
||||
│ └── pages/
|
||||
│ └── index.astro
|
||||
└── package.json
|
||||
```env
|
||||
TWY_API_URL=https://api.recroom.baby
|
||||
TWY_CDN_URL=https://cdn.recroom.baby
|
||||
```
|
||||
|
||||
Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name.
|
||||
Start the development server:
|
||||
|
||||
There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.
|
||||
```sh
|
||||
npm run dev
|
||||
```
|
||||
|
||||
Any static assets, like images, can be placed in the `public/` directory.
|
||||
|
||||
## 🧞 Commands
|
||||
|
||||
All commands are run from the root of the project, from a terminal:
|
||||
|
||||
| Command | Action |
|
||||
| :------------------------ | :----------------------------------------------- |
|
||||
| `npm install` | Installs dependencies |
|
||||
| `npm run dev` | Starts local dev server at `localhost:4321` |
|
||||
| `npm run build` | Build your production site to `./dist/` |
|
||||
| `npm run preview` | Preview your build locally, before deploying |
|
||||
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
|
||||
| `npm run astro -- --help` | Get help using the Astro CLI |
|
||||
|
||||
## 👀 Want to learn more?
|
||||
|
||||
Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat).
|
||||
Astro will print the local URL, by default at `http://localhost:4321`.
|
||||
@@ -1,56 +0,0 @@
|
||||
# Image Tools
|
||||
|
||||
Use `resize-images.ps1` to make web-sized PNGs for the index page.
|
||||
|
||||
Run commands from the project root.
|
||||
|
||||
## Presets
|
||||
|
||||
| Preset | Size | Use |
|
||||
| --- | --- | --- |
|
||||
| `logo` | 1200px wide | Source logo used in the masthead |
|
||||
| `masthead` | 860px wide | Large feature image or decorative logo |
|
||||
| `feature` | 900x506 | Main "What is TenWholeYears?" image |
|
||||
| `card` | 600x338 | Three-column Explore section images |
|
||||
| `gallery` | 480x270 | Gallery thumbnails |
|
||||
| `banner` | 1920x1080 | Large background or hero screenshots |
|
||||
| `platform-icon` | 256x256 | Square padded platform logos for the downloads page |
|
||||
| `profile` | 512x512 | Square cropped profile pictures for credits |
|
||||
|
||||
## Examples
|
||||
|
||||
Resize one image for the intro feature section:
|
||||
|
||||
```powershell
|
||||
.\tools\resize-images.ps1 -InputPath "C:\Users\Holden\Desktop\screenshot.png" -Preset feature
|
||||
```
|
||||
|
||||
Resize one image and choose the output filename:
|
||||
|
||||
```powershell
|
||||
.\tools\resize-images.ps1 -InputPath "C:\Users\Holden\Desktop\screenshot.png" -Preset gallery -OutputName "gallery-museum.png"
|
||||
```
|
||||
|
||||
Resize every PNG/JPG/BMP in a folder:
|
||||
|
||||
```powershell
|
||||
.\tools\resize-images.ps1 -InputPath "C:\Users\Holden\Desktop\recroom-screenshots" -Preset gallery
|
||||
```
|
||||
|
||||
Resize and crop a profile picture for the credits section:
|
||||
|
||||
```powershell
|
||||
.\tools\resize-images.ps1 -InputPath "C:\Users\Holden\Desktop\person.png" -Preset profile -OutputDir "public/img/profiles" -OutputName "person.png"
|
||||
```
|
||||
|
||||
By default, output files go here:
|
||||
|
||||
```text
|
||||
public/img/generated/
|
||||
```
|
||||
|
||||
Then use them in Astro like this:
|
||||
|
||||
```astro
|
||||
<img src="/img/generated/gallery-museum.png" alt="Describe the screenshot" />
|
||||
```
|
||||
@@ -1,174 +0,0 @@
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$InputPath,
|
||||
|
||||
[ValidateSet("logo", "masthead", "feature", "card", "gallery", "banner", "platform-icon", "profile")]
|
||||
[string]$Preset = "gallery",
|
||||
|
||||
[string]$OutputDir = "public/img/generated",
|
||||
|
||||
[string]$OutputName = ""
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$repoRoot = Resolve-Path (Join-Path $PSScriptRoot "..")
|
||||
$resolvedInput = Resolve-Path $InputPath
|
||||
|
||||
if ([System.IO.Path]::IsPathRooted($OutputDir)) {
|
||||
$resolvedOutputDir = $OutputDir
|
||||
}
|
||||
else {
|
||||
$resolvedOutputDir = Join-Path $repoRoot $OutputDir
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Path $resolvedOutputDir -Force | Out-Null
|
||||
|
||||
$presets = @{
|
||||
logo = @{
|
||||
Width = 1200
|
||||
Height = 0
|
||||
Mode = "fit"
|
||||
Suffix = "logo"
|
||||
}
|
||||
masthead = @{
|
||||
Width = 860
|
||||
Height = 0
|
||||
Mode = "fit"
|
||||
Suffix = "masthead"
|
||||
}
|
||||
feature = @{
|
||||
Width = 900
|
||||
Height = 506
|
||||
Mode = "crop"
|
||||
Suffix = "feature"
|
||||
}
|
||||
card = @{
|
||||
Width = 600
|
||||
Height = 338
|
||||
Mode = "crop"
|
||||
Suffix = "card"
|
||||
}
|
||||
gallery = @{
|
||||
Width = 480
|
||||
Height = 270
|
||||
Mode = "crop"
|
||||
Suffix = "gallery"
|
||||
}
|
||||
banner = @{
|
||||
Width = 1920
|
||||
Height = 1080
|
||||
Mode = "crop"
|
||||
Suffix = "banner"
|
||||
}
|
||||
"platform-icon" = @{
|
||||
Width = 256
|
||||
Height = 256
|
||||
Mode = "pad"
|
||||
Suffix = "platform-icon"
|
||||
}
|
||||
profile = @{
|
||||
Width = 512
|
||||
Height = 512
|
||||
Mode = "crop"
|
||||
Suffix = "profile"
|
||||
}
|
||||
}
|
||||
|
||||
function Get-ImageFiles {
|
||||
param([string]$Path)
|
||||
|
||||
$item = Get-Item -LiteralPath $Path
|
||||
|
||||
if ($item.PSIsContainer) {
|
||||
return Get-ChildItem -LiteralPath $Path -File |
|
||||
Where-Object { $_.Extension -match "^\.(png|jpg|jpeg|bmp)$" }
|
||||
}
|
||||
|
||||
return @($item)
|
||||
}
|
||||
|
||||
function Resize-Image {
|
||||
param(
|
||||
[string]$SourcePath,
|
||||
[string]$DestinationPath,
|
||||
[int]$TargetWidth,
|
||||
[int]$TargetHeight,
|
||||
[string]$Mode
|
||||
)
|
||||
|
||||
Add-Type -AssemblyName System.Drawing
|
||||
|
||||
$image = [System.Drawing.Image]::FromFile($SourcePath)
|
||||
|
||||
if ($TargetHeight -eq 0) {
|
||||
$TargetHeight = [int][Math]::Round($image.Height * $TargetWidth / $image.Width)
|
||||
}
|
||||
|
||||
$bitmap = New-Object System.Drawing.Bitmap $TargetWidth, $TargetHeight
|
||||
$graphics = [System.Drawing.Graphics]::FromImage($bitmap)
|
||||
|
||||
$graphics.InterpolationMode = [System.Drawing.Drawing2D.InterpolationMode]::HighQualityBicubic
|
||||
$graphics.SmoothingMode = [System.Drawing.Drawing2D.SmoothingMode]::HighQuality
|
||||
$graphics.PixelOffsetMode = [System.Drawing.Drawing2D.PixelOffsetMode]::HighQuality
|
||||
$graphics.CompositingQuality = [System.Drawing.Drawing2D.CompositingQuality]::HighQuality
|
||||
$graphics.Clear([System.Drawing.Color]::Transparent)
|
||||
|
||||
if ($Mode -eq "crop") {
|
||||
$scale = [Math]::Max($TargetWidth / $image.Width, $TargetHeight / $image.Height)
|
||||
$sourceWidth = [int][Math]::Round($TargetWidth / $scale)
|
||||
$sourceHeight = [int][Math]::Round($TargetHeight / $scale)
|
||||
$sourceX = [int][Math]::Max(0, [Math]::Round(($image.Width - $sourceWidth) / 2))
|
||||
$sourceY = [int][Math]::Max(0, [Math]::Round(($image.Height - $sourceHeight) / 2))
|
||||
|
||||
$sourceRect = New-Object System.Drawing.Rectangle $sourceX, $sourceY, $sourceWidth, $sourceHeight
|
||||
$destRect = New-Object System.Drawing.Rectangle 0, 0, $TargetWidth, $TargetHeight
|
||||
$graphics.DrawImage($image, $destRect, $sourceRect, [System.Drawing.GraphicsUnit]::Pixel)
|
||||
}
|
||||
elseif ($Mode -eq "pad") {
|
||||
$scale = [Math]::Min($TargetWidth / $image.Width, $TargetHeight / $image.Height)
|
||||
$drawWidth = [int][Math]::Round($image.Width * $scale)
|
||||
$drawHeight = [int][Math]::Round($image.Height * $scale)
|
||||
$drawX = [int][Math]::Round(($TargetWidth - $drawWidth) / 2)
|
||||
$drawY = [int][Math]::Round(($TargetHeight - $drawHeight) / 2)
|
||||
|
||||
$destRect = New-Object System.Drawing.Rectangle $drawX, $drawY, $drawWidth, $drawHeight
|
||||
$graphics.DrawImage($image, $destRect)
|
||||
}
|
||||
else {
|
||||
$graphics.DrawImage($image, 0, 0, $TargetWidth, $TargetHeight)
|
||||
}
|
||||
|
||||
$bitmap.Save($DestinationPath, [System.Drawing.Imaging.ImageFormat]::Png)
|
||||
|
||||
$graphics.Dispose()
|
||||
$bitmap.Dispose()
|
||||
$image.Dispose()
|
||||
}
|
||||
|
||||
$presetConfig = $presets[$Preset]
|
||||
$files = Get-ImageFiles -Path $resolvedInput
|
||||
|
||||
foreach ($file in $files) {
|
||||
$name = if ($OutputName -and $files.Count -eq 1) {
|
||||
$OutputName
|
||||
}
|
||||
else {
|
||||
"{0}-{1}.png" -f $file.BaseName, $presetConfig.Suffix
|
||||
}
|
||||
|
||||
if ([System.IO.Path]::GetExtension($name) -eq "") {
|
||||
$name = "$name.png"
|
||||
}
|
||||
|
||||
$destination = Join-Path $resolvedOutputDir $name
|
||||
|
||||
Resize-Image `
|
||||
-SourcePath $file.FullName `
|
||||
-DestinationPath $destination `
|
||||
-TargetWidth $presetConfig.Width `
|
||||
-TargetHeight $presetConfig.Height `
|
||||
-Mode $presetConfig.Mode
|
||||
|
||||
Write-Output ("{0} -> {1}" -f $file.Name, $destination)
|
||||
}
|
||||
Reference in New Issue
Block a user