Skip to content

Commit 2cd682b

Browse files
author
linyuan.yang
committed
整理结构
1 parent 860e7cd commit 2cd682b

164 files changed

Lines changed: 642 additions & 881 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/deploy-pages.yml‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ on:
88
- 'package.json'
99
- 'pnpm-lock.yaml'
1010
- 'pnpm-workspace.yaml'
11-
- 'packages/player/**'
12-
- 'packages/web/**'
11+
- 'packages/ui/**'
12+
- 'apps/icon/**'
13+
- 'apps/pwa/**'
1314
- '.github/workflows/deploy-pages.yml'
1415
workflow_dispatch:
1516

@@ -41,13 +42,13 @@ jobs:
4142
cache: pnpm
4243

4344
- run: pnpm install --frozen-lockfile
44-
- run: pnpm --filter @nes-emulator/web run build
45+
- run: pnpm --filter @nes-emulator/pwa run build
4546

4647
- uses: actions/configure-pages@v5
4748

4849
- uses: actions/upload-pages-artifact@v3
4950
with:
50-
path: packages/web/dist
51+
path: apps/pwa/dist
5152

5253
deploy:
5354
needs: build

‎.github/workflows/release-app.yml‎

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ jobs:
4545
needs: [check, prepare-release]
4646
uses: while-coder/workflows/.github/workflows/tauri-desktop-release.yml@main
4747
with:
48-
project-path: packages/app
49-
cargo-lock-path: packages/app/src-tauri/Cargo.lock
50-
cargo-target-path: packages/app/src-tauri/target
48+
project-path: apps/app
49+
cargo-lock-path: apps/app/src-tauri/Cargo.lock
50+
cargo-target-path: apps/app/src-tauri/target
5151
tag-name: ${{ needs.check.outputs.tag }}
5252
release-name: nes-emulator v${{ needs.check.outputs.version }}
5353
release-body: ${{ needs.check.outputs.notes }}
@@ -58,12 +58,13 @@ jobs:
5858
if: ${{ !cancelled() && needs.release-desktop.result == 'success' }}
5959
uses: while-coder/workflows/.github/workflows/tauri-android-release.yml@main
6060
with:
61-
project-path: packages/app
62-
cargo-lock-path: packages/app/src-tauri/Cargo.lock
63-
cargo-target-path: packages/app/src-tauri/target
61+
project-path: apps/app
62+
cargo-lock-path: apps/app/src-tauri/Cargo.lock
63+
cargo-target-path: apps/app/src-tauri/target
6464
tag-name: ${{ needs.check.outputs.tag }}
6565
version: ${{ needs.check.outputs.version }}
6666
asset-prefix: nes-emulator
67+
init-command: pnpm android:init
6768
build-command: pnpm run android:build -- --apk --aab
6869
secrets: inherit
6970

@@ -72,13 +73,13 @@ jobs:
7273
if: ${{ !cancelled() && needs.release-desktop.result == 'success' }}
7374
uses: while-coder/workflows/.github/workflows/tauri-ios-unsigned.yml@main
7475
with:
75-
project-path: packages/app
76-
cargo-lock-path: packages/app/src-tauri/Cargo.lock
77-
cargo-target-path: packages/app/src-tauri/target
76+
project-path: apps/app
77+
cargo-lock-path: apps/app/src-tauri/Cargo.lock
78+
cargo-target-path: apps/app/src-tauri/target
7879
tag-name: ${{ needs.check.outputs.tag }}
7980
version: ${{ needs.check.outputs.version }}
8081
asset-prefix: nes-emulator
81-
init-command: if [ ! -d src-tauri/gen/apple ]; then pnpm tauri ios init --ci; fi
82+
init-command: pnpm ios:init
8283
build-command: pnpm run ios:build -- --target aarch64 --no-sign --ci
8384
secrets: inherit
8485

‎.gitignore‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Rust
2-
packages/app/src-tauri/target/
2+
apps/app/src-tauri/target/
33

44
# Node
55
node_modules/
6-
packages/app/node_modules/
7-
packages/player/node_modules/
8-
packages/web/node_modules/
9-
packages/app/dist/
10-
packages/web/dist/
6+
apps/app/node_modules/
7+
packages/ui/node_modules/
8+
apps/pwa/node_modules/
9+
apps/app/dist/
10+
apps/pwa/dist/
1111

1212
# TypeScript 增量构建产物
1313
**/tsconfig.tsbuildinfo
@@ -20,3 +20,8 @@ packages/web/dist/
2020
*.log
2121
roms/
2222
roms_catalog.json
23+
24+
# Generated platform projects, icons and generation cache
25+
apps/app/src-tauri/gen/
26+
apps/app/src-tauri/native/*/icons/
27+
.tmp/

‎README.md‎

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,37 @@
22

33
## Directory structure
44

5-
- `packages/web/`: thin Vue/Vite Web host, deployable on its own.
6-
- `packages/player/`: shared NES player package with the app shell, display, controls, settings, runtime wiring, and the libretro core assets.
7-
- `packages/app/`: thin Tauri app host for desktop, Android, and iOS. Native exit/back handling stays here; shared player UI stays in `packages/player`.
5+
- `apps/pwa/`: thin Vue/Vite PWA host, deployable on its own.
6+
- `packages/ui/`: shared display area with the app shell, display, controls, settings, runtime wiring, and the libretro core assets.
7+
- `apps/app/`: thin Tauri app host for desktop, Android, and iOS. Native exit/back handling stays here; shared player UI stays in `packages/ui`.
8+
- `apps/icon/`: shared icon artwork and Tauri icon generation manifest.
89
- `scripts/`: repository-level helper scripts.
910

1011
## Build
1112

1213
- `pnpm install`: install workspace dependencies.
13-
- `pnpm --filter @nes-emulator/web run build`: build the standalone Web app.
14-
- `pnpm --filter @nes-emulator/app run build:frontend`: build the App frontend into `packages/app/dist`.
15-
- `pnpm --filter @nes-emulator/app run build`: build the Tauri app shell, using `packages/app/dist`.
14+
- `pnpm --filter @nes-emulator/pwa run build`: build the standalone Web app.
15+
- `pnpm --filter @nes-emulator/app run build:frontend`: build the App frontend into `apps/app/dist`.
16+
- `pnpm --filter @nes-emulator/app run build`: build the Tauri app shell, using `apps/app/dist`.
17+
- `pnpm dev:pwa` / `pnpm dev:app`: start the PWA / Tauri app.
18+
19+
## Versions and icons
20+
21+
- Update the root `package.json` version, then run `pnpm sync:versions` to synchronize workspace package versions and the application's Rust version in `Cargo.toml` / `Cargo.lock`. Tauri reads the root version directly.
22+
- Run `pnpm sync:icons` after changing `apps/icon/icon.png`, `icon-fullbleed.png`, or `icons.json`. This refreshes PWA, App frontend, and native icons; macOS Dock generation requires macOS. `pnpm sync:icons --web` refreshes frontend icons only.
23+
- `icon.png` supplies desktop and general browser icons; `icon-fullbleed.png` supplies Android adaptive foreground, iOS, and PWA maskable icons. `icon.svg` preserves the original editable artwork.
24+
- Native icons are generated into `apps/app/src-tauri/native/<platform>/icons/` and cached in `.tmp/native-icons/`. Both are ignored by Git. Tauri hooks and `build.rs` generate the target platform's icons automatically, including direct Cargo builds.
25+
26+
## Native projects
27+
28+
- `pnpm android:init` generates the Android project and applies the maintained customizations from `apps/app/src-tauri/native/android/app/` (signing, back navigation, TV support, and display names).
29+
- `pnpm ios:init` generates the iOS project and synchronizes its icons (requires macOS).
30+
- Mobile dev/build scripts reapply platform preparation. Keep persistent changes in `native/`; generated projects under `src-tauri/gen/` are ignored by Git.
31+
- Android retains its existing `com.wandergame.nesemulator` application ID through `tauri.android.conf.json`. Signing still uses root `secrets/keystore.properties` or `ANDROID_KEYSTORE_*` / `ANDROID_KEY_*` environment variables.
32+
- See [native resources](apps/app/src-tauri/native/README.md) for platform paths.
1633

1734
## ROM catalog
1835

1936
- Web and App load the ROM catalog from the remote GitHub raw URL at runtime, so the large catalog is not bundled into the frontend output.
2037
- ROM download URLs are used exactly as written in the remote catalog.
21-
- To switch ROM hosting, update the catalog URL in `packages/player/src/store/romCatalog.ts`, and provide a catalog whose `download_url` values point at the new CORS-enabled source.
38+
- To switch ROM hosting, update the catalog URL in `packages/ui/src/store/romCatalog.ts`, and provide a catalog whose `download_url` values point at the new CORS-enabled source.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<head>
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<link rel="icon" href="favicon.png" />
67
<title>NES/FC 模拟器</title>
78
</head>
89
<body>
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@
99
"build:frontend": "vue-tsc -b --force && vite build",
1010
"tauri": "tauri",
1111
"preview": "vite preview",
12-
"android:init": "tauri android init",
13-
"android:dev": "tauri android dev",
14-
"android:build": "tauri android build",
15-
"ios:dev": "tauri ios dev",
16-
"ios:build": "tauri ios build"
12+
"android:init": "node src-tauri/native/sync-icons.cjs android && tauri android init --ci && node src-tauri/native/android/prepare.cjs",
13+
"android:dev": "node src-tauri/native/android/prepare.cjs && tauri android dev",
14+
"android:build": "node src-tauri/native/android/prepare.cjs && tauri android build",
15+
"ios:dev": "node src-tauri/native/ios/prepare.cjs && tauri ios dev",
16+
"ios:build": "node src-tauri/native/ios/prepare.cjs && tauri ios build",
17+
"ios:init": "node src-tauri/native/sync-icons.cjs ios && tauri ios init --ci && node src-tauri/native/ios/prepare.cjs"
1718
},
1819
"dependencies": {
19-
"@nes-emulator/player": "workspace:*",
20+
"@nes-emulator/ui": "workspace:*",
2021
"@tauri-apps/api": "^2.11.0",
2122
"@tauri-apps/plugin-process": "^2.3.1",
2223
"@tauri-apps/plugin-updater": "^2.10.1",
@@ -29,5 +30,6 @@
2930
"typescript": "catalog:",
3031
"vite": "catalog:",
3132
"vue-tsc": "catalog:"
32-
}
33+
},
34+
"version": "0.1.0"
3335
}

‎apps/app/public/favicon.png‎

7.1 KB
Loading
Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)