mirror of
https://github.com/kuhyx/todo-app.git
synced 2026-11-28 23:29:07 +01:00
Compare commits
No commits in common. "a494843d0a3fe2c23c61fed69caa77cf6e1b9fc8" and "1ef60fa186c4cb5da3ea93e89c593355d75521b2" have entirely different histories.
a494843d0a
...
1ef60fa186
@ -1,90 +0,0 @@
|
|||||||
# Maintainer: Krzysztof Rudnicki <krzysztofrudnicki0@gmail.com>
|
|
||||||
pkgname=todo-flutter
|
|
||||||
pkgver=1.0.0
|
|
||||||
pkgrel=1
|
|
||||||
pkgdesc='Offline-first, CRDT-synced notes app (Flutter web in a Chrome app window)'
|
|
||||||
arch=('x86_64')
|
|
||||||
url='https://github.com/kuhyx/todo-app'
|
|
||||||
license=('MIT')
|
|
||||||
# A Chrome-family browser renders the UI, but none is a hard dependency: the
|
|
||||||
# wrapper discovers whichever is installed at run time (Chrome, Chromium,
|
|
||||||
# Thorium, Brave) and reports clearly if none is present. The deps below are
|
|
||||||
# the ones actually linked/executed: the Dart AOT binary and the bundled
|
|
||||||
# libsqlite3.so need glibc, /usr/bin/todo is a bash script, and the icons are
|
|
||||||
# installed into the hicolor theme hierarchy.
|
|
||||||
depends=('glibc' 'bash' 'hicolor-icon-theme')
|
|
||||||
optdepends=('google-chrome: renders the app window'
|
|
||||||
'chromium: renders the app window')
|
|
||||||
makedepends=('flutter') # flutter-bin provides `flutter`; either satisfies this
|
|
||||||
# The AUR already ships an unrelated package literally named 'todo' (a todo.txt
|
|
||||||
# CLI) which also owns /usr/bin/todo, so the two genuinely cannot coexist.
|
|
||||||
conflicts=('todo')
|
|
||||||
# !strip is LOAD-BEARING: the wrapper is a Dart AOT executable with its snapshot
|
|
||||||
# embedded in the ELF. Stripping discards the snapshot and the binary degrades
|
|
||||||
# to a bare dartaotruntime that refuses to run ("is not an AOT snapshot").
|
|
||||||
# !debug because Flutter/Dart AOT release binaries carry no extractable DWARF.
|
|
||||||
options=('!strip' '!debug')
|
|
||||||
source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz")
|
|
||||||
sha256sums=('SKIP') # placeholder: run updpkgsums in the AUR checkout after tagging
|
|
||||||
|
|
||||||
_srcdir="todo-app-$pkgver"
|
|
||||||
|
|
||||||
build() {
|
|
||||||
cd "$_srcdir"
|
|
||||||
# makepkg builds as an unprivileged user with no writable default pub cache;
|
|
||||||
# keep it inside $srcdir so the build is self-contained and leaves no trace.
|
|
||||||
export PUB_CACHE="$srcdir/.pub-cache"
|
|
||||||
flutter build web --release
|
|
||||||
# `dart build cli`, NOT `dart compile exe`: dependencies (sqlite3,
|
|
||||||
# objective_c) have native build hooks that `dart compile` refuses to handle.
|
|
||||||
dart build cli -o build/cli
|
|
||||||
}
|
|
||||||
|
|
||||||
package() {
|
|
||||||
cd "$_srcdir"
|
|
||||||
local bundle="build/cli/bundle"
|
|
||||||
|
|
||||||
# Preserve the bundle's bin/ + lib/ layout: the executable resolves its
|
|
||||||
# native libraries from ../lib and the web assets from ../web.
|
|
||||||
install -dm755 "$pkgdir/opt/todo"
|
|
||||||
cp -r "$bundle/bin" "$pkgdir/opt/todo/bin"
|
|
||||||
# lib/ exists only when a dependency ships native code (here: libsqlite3.so).
|
|
||||||
if [[ -d "$bundle/lib" ]]; then
|
|
||||||
cp -r "$bundle/lib" "$pkgdir/opt/todo/lib"
|
|
||||||
fi
|
|
||||||
chmod 755 "$pkgdir/opt/todo/bin/todo_desktop"
|
|
||||||
|
|
||||||
install -dm755 "$pkgdir/opt/todo/web"
|
|
||||||
cp -r build/web/. "$pkgdir/opt/todo/web/"
|
|
||||||
|
|
||||||
install -dm755 "$pkgdir/usr/bin"
|
|
||||||
cat > "$pkgdir/usr/bin/todo" <<'WRAPPER'
|
|
||||||
#!/bin/bash
|
|
||||||
exec /opt/todo/bin/todo_desktop "$@"
|
|
||||||
WRAPPER
|
|
||||||
chmod 755 "$pkgdir/usr/bin/todo"
|
|
||||||
|
|
||||||
# Desktop entry written inline. Do NOT call install_desktop_entry.sh: it
|
|
||||||
# targets ~/.local/share and its dev fallback points Exec at the repo's run.sh.
|
|
||||||
install -Dm644 /dev/stdin "$pkgdir/usr/share/applications/todo.desktop" <<'DESKTOP'
|
|
||||||
[Desktop Entry]
|
|
||||||
Type=Application
|
|
||||||
Name=todo
|
|
||||||
Comment=Offline-first, CRDT-synced notes
|
|
||||||
Exec=/usr/bin/todo
|
|
||||||
Icon=todo
|
|
||||||
Terminal=false
|
|
||||||
Categories=Utility;TextEditor;
|
|
||||||
StartupWMClass=todo
|
|
||||||
DESKTOP
|
|
||||||
|
|
||||||
local size
|
|
||||||
for size in 16 24 32 48 64 128 256 512; do
|
|
||||||
install -Dm644 "desktop/icons/$size/todo.png" \
|
|
||||||
"$pkgdir/usr/share/icons/hicolor/${size}x${size}/apps/todo.png"
|
|
||||||
done
|
|
||||||
# No gtk-update-icon-cache / update-desktop-database here: pacman hooks own
|
|
||||||
# that, and namcap flags calling them from package().
|
|
||||||
|
|
||||||
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
|
|
||||||
}
|
|
||||||
@ -1,44 +0,0 @@
|
|||||||
# AUR packaging
|
|
||||||
|
|
||||||
`PKGBUILD` here is the source of truth for the `todo-flutter` AUR package. The
|
|
||||||
AUR checkout (`~/aur/todo-flutter`) is a copy of this file plus a generated
|
|
||||||
`.SRCINFO`.
|
|
||||||
|
|
||||||
## Why the checksum can go stale
|
|
||||||
|
|
||||||
`source=` points at the GitHub tarball for tag `v$pkgver`, and `sha256sums`
|
|
||||||
is the hash of that tarball. A tarball contains this very file, so the
|
|
||||||
checksum for tag vX cannot be committed *before* vX is tagged. The copy here
|
|
||||||
is therefore a **template**: after pushing a new tag, run `updpkgsums` in the
|
|
||||||
AUR checkout to fill in the real hash, and copy the result back here.
|
|
||||||
|
|
||||||
## Release flow
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# 1. bump `version:` in pubspec.yaml, commit, push
|
|
||||||
# 2. tag and push the SINGLE tag (never `git push --tags`)
|
|
||||||
git tag v1.2.3 && git push origin v1.2.3
|
|
||||||
|
|
||||||
# 3. sync + checksum + build + verify
|
|
||||||
cp packaging/aur/PKGBUILD ~/aur/todo-flutter/PKGBUILD
|
|
||||||
cd ~/aur/todo-flutter
|
|
||||||
# bump pkgver to match the tag, then:
|
|
||||||
updpkgsums
|
|
||||||
makepkg -Cf
|
|
||||||
namcap ./*.pkg.tar.zst
|
|
||||||
sudo pacman -U ./todo-flutter-*.pkg.tar.zst
|
|
||||||
todo # must print: todo desktop serving on http://localhost:8730
|
|
||||||
|
|
||||||
# 4. publish
|
|
||||||
makepkg --printsrcinfo > .SRCINFO
|
|
||||||
git add PKGBUILD .SRCINFO && git commit && git push # branch is `master`
|
|
||||||
```
|
|
||||||
|
|
||||||
## Notes
|
|
||||||
|
|
||||||
- `install_arch.sh` is deliberately **not** wired to this PKGBUILD. That script
|
|
||||||
builds the working tree for local development; this one builds a downloaded
|
|
||||||
release tarball. Merging them would destroy the dev loop.
|
|
||||||
- `options=('!strip')` is load-bearing — see the comment in the PKGBUILD.
|
|
||||||
- Building requires network access (`pub get`, plus a git fetch of the shared
|
|
||||||
`crdt_sync` dependency). The tracked `pubspec.lock` pins what gets resolved.
|
|
||||||
@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
# In Windows, build-name is used as the major, minor, and patch parts
|
# In Windows, build-name is used as the major, minor, and patch parts
|
||||||
# of the product and file versions while build-number is used as the build suffix.
|
# of the product and file versions while build-number is used as the build suffix.
|
||||||
version: 1.0.1+1
|
version: 1.0.0+1
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.12.2
|
sdk: ^3.12.2
|
||||||
|
|||||||
@ -1,122 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# ============================================================================
|
|
||||||
# Bump the patch version in pubspec.yaml on every commit.
|
|
||||||
#
|
|
||||||
# `version: X.Y.Z+B` -> `version: X.Y.(Z+1)+B`. The +build suffix is left
|
|
||||||
# alone: CI replaces it with the commit count, so it is not ours to manage.
|
|
||||||
#
|
|
||||||
# Wired as a pre-commit hook so each commit ships its own bump. That keeps the
|
|
||||||
# release-apk workflow's clean `vX.Y.Z` tag moving with HEAD instead of
|
|
||||||
# sitting on whatever version was last hand-edited, which is what left the AUR
|
|
||||||
# package advertising a tag 8 commits behind.
|
|
||||||
#
|
|
||||||
# Deliberately NOT bumping minor: minor/major are the "how much broke" signal.
|
|
||||||
# Auto-incrementing them on every commit throws that signal away and reaches
|
|
||||||
# absurd numbers within a year.
|
|
||||||
# ============================================================================
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
SCRIPT_NAME="$(basename "$0")"
|
|
||||||
readonly SCRIPT_NAME
|
|
||||||
PUBSPEC=""
|
|
||||||
|
|
||||||
usage() {
|
|
||||||
echo "Usage: $SCRIPT_NAME [--pubspec PATH]"
|
|
||||||
echo "Options:"
|
|
||||||
echo " --pubspec PATH pubspec.yaml to bump (default: repo root's)"
|
|
||||||
echo " -h, --help Show this help"
|
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
|
|
||||||
# Bumping while a rebase/merge/amend is replaying commits would inflate the
|
|
||||||
# version once per replayed commit, so skip those states entirely.
|
|
||||||
in_replay_state() {
|
|
||||||
local git_dir
|
|
||||||
git_dir="$(git rev-parse --git-dir)"
|
|
||||||
[[ -d "$git_dir/rebase-merge" || -d "$git_dir/rebase-apply" \
|
|
||||||
|| -f "$git_dir/MERGE_HEAD" || -f "$git_dir/CHERRY_PICK_HEAD" ]]
|
|
||||||
}
|
|
||||||
|
|
||||||
# Only bump when something other than pubspec.yaml is staged. A commit that
|
|
||||||
# only touches the version (or only docs the hook itself rewrote) must not
|
|
||||||
# trigger another bump, or `git commit --amend` would climb a version per
|
|
||||||
# amend.
|
|
||||||
has_non_pubspec_changes() {
|
|
||||||
local staged
|
|
||||||
staged="$(git diff --cached --name-only)"
|
|
||||||
[[ -n "$(grep -v -e '^$' -e 'pubspec\.yaml$' <<<"$staged")" ]]
|
|
||||||
}
|
|
||||||
|
|
||||||
main() {
|
|
||||||
if [[ -z "$PUBSPEC" ]]; then
|
|
||||||
PUBSPEC="$(git rev-parse --show-toplevel)/pubspec.yaml"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -f "$PUBSPEC" ]]; then
|
|
||||||
echo "Error: no pubspec.yaml at $PUBSPEC" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if in_replay_state; then
|
|
||||||
echo "bump-version: rebase/merge in progress; leaving version alone"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! has_non_pubspec_changes; then
|
|
||||||
echo "bump-version: nothing staged but the version itself; not bumping"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
local raw semver build major minor patch next committed rel_path
|
|
||||||
raw="$(sed -nE 's/^version:[[:space:]]*(.*)$/\1/p' "$PUBSPEC" | head -1)"
|
|
||||||
if [[ -z "$raw" ]]; then
|
|
||||||
echo "Error: no 'version:' line in $PUBSPEC" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Bump relative to the LAST COMMITTED version, not the working-tree one.
|
|
||||||
# Otherwise re-running the hook over the same staged change (a hook that
|
|
||||||
# failed, got fixed, and was retried) climbs a patch per attempt instead
|
|
||||||
# of per commit.
|
|
||||||
rel_path="${PUBSPEC#"$(git rev-parse --show-toplevel)/"}"
|
|
||||||
committed="$(git show "HEAD:$rel_path" 2>/dev/null \
|
|
||||||
| sed -nE 's/^version:[[:space:]]*(.*)$/\1/p' | head -1 || true)"
|
|
||||||
[[ -n "$committed" ]] && raw="$committed"
|
|
||||||
|
|
||||||
semver="${raw%%+*}"
|
|
||||||
build=""
|
|
||||||
[[ "$raw" == *+* ]] && build="+${raw#*+}"
|
|
||||||
|
|
||||||
if [[ ! "$semver" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
|
|
||||||
echo "Error: version '$raw' is not X.Y.Z[+B]" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
major="${BASH_REMATCH[1]}"
|
|
||||||
minor="${BASH_REMATCH[2]}"
|
|
||||||
patch="${BASH_REMATCH[3]}"
|
|
||||||
|
|
||||||
next="$major.$minor.$((patch + 1))"
|
|
||||||
sed -i -E "s/^version:[[:space:]]*.*$/version: $next$build/" "$PUBSPEC"
|
|
||||||
git add "$PUBSPEC"
|
|
||||||
echo "bump-version: $semver -> $next"
|
|
||||||
}
|
|
||||||
|
|
||||||
while [[ $# -gt 0 ]]; do
|
|
||||||
case $1 in
|
|
||||||
--pubspec)
|
|
||||||
PUBSPEC="$2"
|
|
||||||
shift 2
|
|
||||||
;;
|
|
||||||
-h|--help)
|
|
||||||
usage
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Unknown option: $1" >&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
main "$@"
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# ============================================================================
|
|
||||||
# Install this repo's git hooks.
|
|
||||||
#
|
|
||||||
# .git/hooks/ is not tracked, so a fresh clone has no hooks. Run this once
|
|
||||||
# after cloning. Unlike habit_stack and diet-guard, this repo does not use the
|
|
||||||
# pre-commit framework (its quality gate is CI), so the hook is a plain script.
|
|
||||||
# ============================================================================
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
REPO_ROOT="$(git rev-parse --show-toplevel)"
|
|
||||||
readonly REPO_ROOT
|
|
||||||
readonly HOOK="$REPO_ROOT/.git/hooks/pre-commit"
|
|
||||||
|
|
||||||
main() {
|
|
||||||
if [[ -e "$HOOK" ]] && ! grep -q 'bump_patch_version.sh' "$HOOK"; then
|
|
||||||
echo "Error: $HOOK exists and is not ours; refusing to clobber it." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
cat > "$HOOK" <<'HOOK_BODY'
|
|
||||||
#!/bin/bash
|
|
||||||
# Installed by scripts/install_hooks.sh — see that file.
|
|
||||||
set -euo pipefail
|
|
||||||
exec bash "$(git rev-parse --show-toplevel)/scripts/bump_patch_version.sh"
|
|
||||||
HOOK_BODY
|
|
||||||
|
|
||||||
chmod 755 "$HOOK"
|
|
||||||
echo "Installed pre-commit hook: $HOOK"
|
|
||||||
}
|
|
||||||
|
|
||||||
main "$@"
|
|
||||||
Loading…
Reference in New Issue
Block a user