Seed default config on install; share defaults JSON with runtime
The defaults now live in a single file, scripts/config.default.json:
- src/config.ts imports it via 'with { type: "json" }' and derives
DEFAULT_CONFIG (with seconds->ms conversion at the boundary), so the
CLI help text always matches what the seeded user config contains.
- scripts/install.sh copies the same file to
$XDG_CONFIG_HOME/move/config.json only if no file is already there.
Existing configs (yours or from a previous install) are never
overwritten.
- scripts/uninstall.sh does not touch the user config file at all,
following the strict Unix convention. It does print a one-line
notice pointing at the path so the user can rm -rf the dir
themselves if they want a fully-clean removal.
- tsconfig.json gains resolveJsonModule:true so tsc accepts the JSON
import.
- A small runtime assertion in src/config.ts (assertSeedShape) fails
loudly if the seed file is missing keys or has wrong types.
- README Configuration section documents the seed behavior; Uninstall
section documents the leave-config-behind policy with the rm-it-
yourself command; Files table gains scripts/config.default.json.
This commit is contained in:
+18
-2
@@ -8,10 +8,15 @@
|
||||
#
|
||||
# Removes the `move` wrapper from $XDG_BIN_HOME and the install tree from
|
||||
# $XDG_DATA_HOME/move. Does NOT remove Bun — that's your runtime, not ours.
|
||||
# Also leaves the user config file at $XDG_CONFIG_HOME/move/config.json
|
||||
# intact (Unix convention; user customizations are not ours to delete).
|
||||
# A notice is printed pointing at the file so you can remove it yourself
|
||||
# if desired.
|
||||
#
|
||||
# Env vars (must match what install.sh used):
|
||||
# XDG_DATA_HOME Source install root (default $HOME/.local/share).
|
||||
# XDG_BIN_HOME Wrapper install root (default $HOME/.local/bin).
|
||||
# XDG_DATA_HOME Source install root (default $HOME/.local/share).
|
||||
# XDG_BIN_HOME Wrapper install root (default $HOME/.local/bin).
|
||||
# XDG_CONFIG_HOME User config root (default $HOME/.config).
|
||||
#
|
||||
# POSIX sh; no bashisms.
|
||||
|
||||
@@ -19,6 +24,8 @@ set -eu
|
||||
|
||||
INSTALL_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/move"
|
||||
BIN_DIR="${XDG_BIN_HOME:-$HOME/.local/bin}"
|
||||
CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/move"
|
||||
CONFIG_FILE="$CONFIG_DIR/config.json"
|
||||
WRAPPER="$BIN_DIR/move"
|
||||
|
||||
die() {
|
||||
@@ -50,7 +57,16 @@ fi
|
||||
|
||||
if [ "$REMOVED_SOMETHING" = "0" ]; then
|
||||
printf 'Nothing to remove. Checked %s and %s.\n' "$WRAPPER" "$INSTALL_DIR"
|
||||
if [ -e "$CONFIG_FILE" ]; then
|
||||
printf 'Note: config file at %s was left in place.\n' "$CONFIG_FILE"
|
||||
printf ' Remove it manually with: rm -rf %s\n' "$CONFIG_DIR"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -e "$CONFIG_FILE" ]; then
|
||||
printf '\nNote: your config file at %s was left in place.\n' "$CONFIG_FILE"
|
||||
printf ' Remove it manually with: rm -rf %s\n' "$CONFIG_DIR"
|
||||
fi
|
||||
|
||||
printf '\nUninstalled. (Bun was not touched.)\n'
|
||||
|
||||
Reference in New Issue
Block a user