mirror of
https://github.com/carey314/mio-plugin-fund.git
synced 2026-08-10 05:44:31 +00:00
Real-time OTC fund and gold tracker for the macOS notch. Three tabs: - 持仓: live intraday estimates from 天天基金, hero card with total value / today P&L / cumulative P&L, per-row 当日 + 累计. - 黄金: SHFE 沪金 realtime + daily K-line + 伦敦金 reference. - 添加: search 26k+ public funds via 东方财富 suggest API. No API keys, no Python, no servers. All data comes from public endpoints (天天基金, 东方财富, 新浪财经). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
68 lines
2.1 KiB
Bash
Executable File
68 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# Build the 盯基金 plugin as a .bundle for Mio Island.
|
|
#
|
|
# Usage:
|
|
# ./build.sh # produce build/fund.bundle + build/fund.zip
|
|
# ./build.sh install # also copy bundle to ~/.config/codeisland/plugins/
|
|
|
|
set -e
|
|
set -o pipefail
|
|
|
|
PLUGIN_NAME="fund"
|
|
MODULE_NAME="FundPlugin"
|
|
BUNDLE_NAME="${PLUGIN_NAME}.bundle"
|
|
BUILD_DIR="build"
|
|
|
|
SOURCES=$(find Sources -name "*.swift" -type f)
|
|
SOURCE_COUNT=$(echo "$SOURCES" | wc -l | tr -d ' ')
|
|
|
|
echo "Building ${PLUGIN_NAME} plugin (${SOURCE_COUNT} swift files)..."
|
|
|
|
rm -rf "${BUILD_DIR}"
|
|
mkdir -p "${BUILD_DIR}/${BUNDLE_NAME}/Contents/MacOS"
|
|
|
|
# arm64-only is fine for v0.1 — Mio Island host requires macOS 15+
|
|
# which means Apple Silicon dominant, and the Sina/Eastmoney HTTP
|
|
# bits are platform-agnostic. Add x86_64 + lipo if Intel users surface.
|
|
swiftc \
|
|
-emit-library \
|
|
-module-name "${MODULE_NAME}" \
|
|
-target arm64-apple-macos15.0 \
|
|
-sdk "$(xcrun --show-sdk-path)" \
|
|
-O \
|
|
-o "${BUILD_DIR}/${BUNDLE_NAME}/Contents/MacOS/${MODULE_NAME}" \
|
|
${SOURCES}
|
|
|
|
cp Info.plist "${BUILD_DIR}/${BUNDLE_NAME}/Contents/"
|
|
|
|
if [ -d "Resources" ] && [ "$(ls -A Resources 2>/dev/null)" ]; then
|
|
mkdir -p "${BUILD_DIR}/${BUNDLE_NAME}/Contents/Resources"
|
|
cp -R Resources/* "${BUILD_DIR}/${BUNDLE_NAME}/Contents/Resources/"
|
|
fi
|
|
|
|
# Ad-hoc sign the whole bundle. --deep covers any future nested
|
|
# resources without needing the script changed.
|
|
codesign --force --deep --sign - "${BUILD_DIR}/${BUNDLE_NAME}"
|
|
|
|
echo "✓ Built ${BUILD_DIR}/${BUNDLE_NAME}"
|
|
|
|
# zip for marketplace upload (顶层是 .bundle 目录, 没有 ._* 垃圾)
|
|
cd "${BUILD_DIR}"
|
|
rm -f "${PLUGIN_NAME}.zip"
|
|
zip -rq "${PLUGIN_NAME}.zip" "${BUNDLE_NAME}"
|
|
cd ..
|
|
echo "✓ Created ${BUILD_DIR}/${PLUGIN_NAME}.zip"
|
|
|
|
if [ "${1:-}" = "install" ]; then
|
|
PLUGIN_DIR="${HOME}/.config/codeisland/plugins"
|
|
mkdir -p "${PLUGIN_DIR}"
|
|
rm -rf "${PLUGIN_DIR}/${BUNDLE_NAME}"
|
|
cp -R "${BUILD_DIR}/${BUNDLE_NAME}" "${PLUGIN_DIR}/"
|
|
echo "✓ Installed to ${PLUGIN_DIR}/${BUNDLE_NAME}"
|
|
echo " Restart Mio Island (Cmd+Q + reopen) to load the new build."
|
|
else
|
|
echo ""
|
|
echo "Install locally:"
|
|
echo " ./build.sh install"
|
|
fi
|