mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-25 19:41:17 -08:00
feat: label mobile preview icons
This commit is contained in:
8 files changed
+54
-4
No files matched your search
@@ -113,6 +113,7 @@ jobs:
|
||||
- name: Build Android APK
|
||||
shell: bash
|
||||
run: |
|
||||
export SABLE_LAUNCHER_ICON=dev
|
||||
if [ -n "${ANDROID_KEY_BASE64:-}" ]; then
|
||||
pnpm tauri android build --config src-tauri/tauri.pr.conf.json --apk --target aarch64 armv7
|
||||
else
|
||||
@@ -177,6 +178,7 @@ jobs:
|
||||
- name: Build unsigned IPA
|
||||
shell: bash
|
||||
run: |
|
||||
export SABLE_LAUNCHER_ICON=dev
|
||||
pnpm tauri ios build --config src-tauri/tauri.pr.conf.json --no-sign --ci
|
||||
IPA=$(find src-tauri/gen/apple/build -name '*.ipa' -type f | head -1)
|
||||
[ -n "$IPA" ] || { echo "IPA not found"; exit 1; }
|
||||
|
||||
@@ -330,6 +330,7 @@ jobs:
|
||||
run: |
|
||||
if [ "$IS_NIGHTLY" = "true" ]; then
|
||||
export SABLE_BUILD_FLAVOR=dev
|
||||
export SABLE_LAUNCHER_ICON=nightly
|
||||
fi
|
||||
CONFIG_ARGS=""
|
||||
[ "$IS_NIGHTLY" = "true" ] && CONFIG_ARGS="--config src-tauri/tauri.nightly.conf.json"
|
||||
@@ -471,6 +472,7 @@ jobs:
|
||||
run: |
|
||||
if [ "$IS_NIGHTLY" = "true" ]; then
|
||||
export SABLE_BUILD_FLAVOR=dev
|
||||
export SABLE_LAUNCHER_ICON=nightly
|
||||
fi
|
||||
CONFIG_ARGS=""
|
||||
[ "$IS_NIGHTLY" = "true" ] && CONFIG_ARGS="--config src-tauri/tauri.nightly.conf.json"
|
||||
|
||||
@@ -69,3 +69,4 @@ result
|
||||
.direnv
|
||||
## auto-generated pre-commit config
|
||||
.pre-commit-config.yaml
|
||||
src-tauri/icons/generated/
|
||||
+2
-2
@@ -37,8 +37,8 @@
|
||||
"postinstall": "node scripts/install-knope.js",
|
||||
"setup:knope": "node scripts/install-knope.js",
|
||||
"setup:tauri-icons": "node scripts/icons/symlink.js",
|
||||
"generate:app-icons:android": "node node_modules/tauri-plugin-app-icon-api/scripts/generate-android.mjs --config src-tauri/app-icons.json && pnpm setup:tauri-icons --write --force",
|
||||
"generate:app-icons:ios": "node node_modules/tauri-plugin-app-icon-api/scripts/generate-ios.mjs --config src-tauri/app-icons.json",
|
||||
"generate:app-icons:android": "node scripts/icons/prepare-launcher-icon.js && node node_modules/tauri-plugin-app-icon-api/scripts/generate-android.mjs --config src-tauri/app-icons.json && pnpm setup:tauri-icons --write --force",
|
||||
"generate:app-icons:ios": "node scripts/icons/prepare-launcher-icon.js && node node_modules/tauri-plugin-app-icon-api/scripts/generate-ios.mjs --config src-tauri/app-icons.json",
|
||||
"lint:normalize-imports": "node scripts/normalize-imports.js"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import { existsSync, mkdirSync, rmSync } from 'node:fs';
|
||||
import { spawnSync } from 'node:child_process';
|
||||
import path from 'node:path';
|
||||
|
||||
const flavor = process.env.SABLE_LAUNCHER_ICON;
|
||||
|
||||
if (!flavor) process.exit(0);
|
||||
if (!['dev', 'nightly'].includes(flavor)) {
|
||||
console.error(`Unknown launcher icon flavor: ${flavor}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const root = process.cwd();
|
||||
const output = path.join(root, 'src-tauri', 'icons', 'generated', flavor);
|
||||
const source = path.join(root, 'src-tauri', 'icons', 'build-icons', `${flavor}.svg`);
|
||||
|
||||
if (!existsSync(source)) {
|
||||
console.error(`Launcher icon source not found: ${source}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
rmSync(output, { recursive: true, force: true });
|
||||
mkdirSync(output, { recursive: true });
|
||||
|
||||
const result = spawnSync('pnpm', ['tauri', 'icon', source, '--output', output], {
|
||||
cwd: root,
|
||||
stdio: 'inherit',
|
||||
});
|
||||
|
||||
if (result.status !== 0) process.exit(result.status ?? 1);
|
||||
@@ -9,6 +9,9 @@ import process from 'node:process';
|
||||
import { createTextHelpers } from '../utils/console-style.js';
|
||||
|
||||
const ROOT = process.cwd();
|
||||
const launcherIconDirectory = process.env.SABLE_LAUNCHER_ICON
|
||||
? path.join(ROOT, 'src-tauri', 'icons', 'generated', process.env.SABLE_LAUNCHER_ICON)
|
||||
: path.join(ROOT, 'src-tauri', 'icons');
|
||||
const appIconsPath = path.join(ROOT, 'src-tauri', 'app-icons.json');
|
||||
const appIcons = fs.existsSync(appIconsPath)
|
||||
? JSON.parse(fs.readFileSync(appIconsPath, 'utf8')).icons
|
||||
@@ -156,7 +159,7 @@ function main() {
|
||||
|
||||
processGroup(
|
||||
'Android',
|
||||
path.join(ROOT, 'src-tauri', 'icons', 'android'),
|
||||
path.join(launcherIconDirectory, 'android'),
|
||||
path.join(ROOT, 'src-tauri', 'gen', 'android', 'app', 'src', 'main', 'res'),
|
||||
ANDROID_ICONS,
|
||||
write,
|
||||
@@ -166,7 +169,7 @@ function main() {
|
||||
|
||||
processGroup(
|
||||
'iOS',
|
||||
path.join(ROOT, 'src-tauri', 'icons', 'ios'),
|
||||
path.join(launcherIconDirectory, 'ios'),
|
||||
path.join(ROOT, 'src-tauri', 'gen', 'apple', 'Assets.xcassets', 'AppIcon.appiconset'),
|
||||
IOS_ICONS,
|
||||
write,
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
|
||||
<image href="../icon.png" width="512" height="512" />
|
||||
<rect x="0" y="400" width="512" height="112" fill="#000000" />
|
||||
<text x="256" y="474" fill="#ffffff" font-family="sans-serif" font-size="72" font-weight="700" text-anchor="middle">DEV</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 320 B |
@@ -0,0 +1,5 @@
|
||||
<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
|
||||
<image href="../icon.png" width="512" height="512" />
|
||||
<rect x="0" y="400" width="512" height="112" fill="#000000" />
|
||||
<text x="256" y="474" fill="#ffffff" font-family="sans-serif" font-size="64" font-weight="700" text-anchor="middle">NIGHTLY</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 324 B |
Reference in new issue
Block a user