Skip to content

Commit 0212b28

Browse files
Add native apps (#318)
2 parents 5c56f61 + 257015a commit 0212b28

File tree

140 files changed

+10042
-153
lines changed

Some content is hidden

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

140 files changed

+10042
-153
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
.nuxt
22
.output
3+
/src-tauri/gen/schemas
4+
/src-tauri/target
35
dev-dist
46
dist
57
node_modules
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Deploy Tauri
2+
description: Build and deploy native Tauri applications
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Checkout
7+
uses: actions/checkout@v4
8+
- name: Setup pnpm
9+
uses: pnpm/action-setup@v4
10+
with:
11+
run_install: false
12+
- name: Setup Node.js
13+
uses: actions/setup-node@v4
14+
with:
15+
node-version: 18
16+
cache: pnpm
17+
- name: Install dependencies
18+
shell: bash
19+
run: pnpm install

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
run: |
6060
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
6161
- name: Setup pnpm cache
62-
uses: actions/cache@v3
62+
uses: actions/cache@v4
6363
with:
6464
key: v1-${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
6565
path: |
@@ -87,7 +87,7 @@ jobs:
8787
run: |
8888
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
8989
- name: Setup pnpm cache
90-
uses: actions/cache@v3
90+
uses: actions/cache@v4
9191
with:
9292
key: v1-${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
9393
path: |
@@ -117,7 +117,7 @@ jobs:
117117
run: |
118118
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
119119
- name: Setup pnpm cache
120-
uses: actions/cache@v3
120+
uses: actions/cache@v4
121121
with:
122122
key: v1-${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
123123
path: |
@@ -127,7 +127,7 @@ jobs:
127127
run: pnpm install --shamefully-hoist
128128
- run: pnpm playwright install --with-deps
129129
- run: pnpm playwright test ./test/e2e
130-
- uses: actions/upload-artifact@v3
130+
- uses: actions/upload-artifact@v4
131131
if: always()
132132
with:
133133
name: playwright-report
@@ -153,7 +153,7 @@ jobs:
153153
run: |
154154
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
155155
- name: Setup pnpm cache
156-
uses: actions/cache@v3
156+
uses: actions/cache@v4
157157
with:
158158
key: v1-${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
159159
path: |
@@ -183,7 +183,7 @@ jobs:
183183
run: |
184184
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
185185
- name: Setup pnpm cache
186-
uses: actions/cache@v3
186+
uses: actions/cache@v4
187187
with:
188188
key: v1-${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
189189
path: |

.github/workflows/deploy-tauri.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: deploy_tauri
2+
3+
on:
4+
push:
5+
branches:
6+
- release
7+
8+
# This workflow will trigger on each push to the `release` branch to create or update a GitHub release, build your app, and upload the artifacts to the release.
9+
10+
jobs:
11+
publish-tauri:
12+
permissions:
13+
contents: write
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
include:
18+
- platform: macos-latest # for Arm based macs (M1 and above).
19+
args: --target aarch64-apple-darwin
20+
- platform: macos-latest # for Intel based macs.
21+
args: --target x86_64-apple-darwin
22+
- platform: ubuntu-22.04 # for Tauri v1 you could replace this with ubuntu-20.04.
23+
args: ''
24+
- platform: windows-latest
25+
args: ''
26+
27+
runs-on: ${{ matrix.platform }}
28+
steps:
29+
- uses: actions/checkout@v4
30+
31+
- name: setup node
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: lts/*
35+
36+
- name: install Rust stable
37+
uses: dtolnay/rust-toolchain@stable
38+
with:
39+
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
40+
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
41+
42+
- name: install dependencies (ubuntu only)
43+
if: matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above.
44+
run: |
45+
sudo apt-get update
46+
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
47+
48+
- name: install frontend dependencies
49+
run: pnpm install
50+
51+
- uses: tauri-apps/tauri-action@v0
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
with:
55+
tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version.
56+
releaseName: App v__VERSION__
57+
releaseBody: See the assets to download this version and install.
58+
releaseDraft: true
59+
prerelease: false
60+
args: ${{ matrix.args }}

app.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ export default defineComponent({
4242
document.body.dataset.isMounted = 'true'
4343
4444
logEvent(appEventTypes.appMounted)
45+
46+
if (import.meta.env.TAURI_DESKTOP) {
47+
const { init } = await import('/src/native')
48+
49+
await init()
50+
}
4551
})
4652
4753
const sizes = computed(() => {

composables/useDevice.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { navigator } from '#helpers/globals'
2-
31
export const useDevice = () => {
42
const mq = useMq()
53

helpers/globals.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

nuxt.config.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,18 @@ export default defineNuxtConfig({
9393
file: '~/pages/index.vue',
9494
})
9595
},
96+
'vite:extend': ({ config }) => {
97+
// https://github.com/nuxt/nuxt/issues/27558#issuecomment-2254471601
98+
if (config.server && config.server.hmr) {
99+
if (typeof config.server.hmr === 'boolean') {
100+
config.server.hmr = {}
101+
}
102+
103+
// This port must match the main dev server in order for Tauri to work.
104+
config.server.hmr.port = 8888
105+
config.server.hmr.protocol = 'ws'
106+
}
107+
},
96108
},
97109

98110
imports: {
@@ -159,6 +171,8 @@ export default defineNuxtConfig({
159171
navigateFallbackDenylist: [
160172
// Necessary for Firebase auth requests.
161173
/^\/__/,
174+
// Necessary for Firebase emulator requests.
175+
/^\/emulator/,
162176
// Keep this around for backward compatibility.
163177
/^\/manifest\.json$/,
164178
// Keep this around for backward compatibility.
@@ -318,6 +332,9 @@ export default defineNuxtConfig({
318332
linkFeedback: '',
319333
openaiApiKey: '',
320334
stripeMonthlyPrice: '',
335+
tauri: {
336+
desktop: '',
337+
},
321338
},
322339
},
323340

@@ -329,6 +346,8 @@ export default defineNuxtConfig({
329346
},
330347

331348
vite: {
349+
clearScreen: false,
350+
envPrefix: ['VITE_', 'TAURI_'],
332351
plugins: [
333352
nodePolyfills({
334353
globals: {
@@ -340,5 +359,14 @@ export default defineNuxtConfig({
340359
}),
341360
svgPlugin(),
342361
],
362+
server: {
363+
// This is currently ignored due to a Nuxt bug.
364+
// https://github.com/nuxt/nuxt/issues/27558#issuecomment-2254471601
365+
hmr: {
366+
port: 8888,
367+
protocol: 'ws',
368+
},
369+
strictPort: true,
370+
},
343371
},
344372
})

package.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,16 @@
77
"funding": "https://github.com/sponsors/davidmyersdev",
88
"scripts": {
99
"build": "nuxt prepare && nuxt typecheck && nuxt generate",
10+
"build:desktop": "TAURI_SIGNING_PRIVATE_KEY=~/.tauri/octo.key TAURI_SIGNING_PRIVATE_KEY_PASSWORD= tauri build",
11+
"build:desktop:debug": "TAURI_SIGNING_PRIVATE_KEY=~/.tauri/octo.key TAURI_SIGNING_PRIVATE_KEY_PASSWORD= tauri build --debug -c ./src-tauri/tauri.dev.conf.json",
1012
"clean": "rimraf .output dev-dist dist",
1113
"dev": "nuxt dev --port 8888",
1214
"dev:full": "run-p dev firebase:start",
1315
"dev:minimal": "DISABLE_SSR=1 DISABLE_PWA=1 NUXT_PUBLIC_FIREBASE_DISABLED=1 run-s dev",
1416
"dev:screenshots": "DISABLE_DEVTOOLS=1 run-s dev:minimal",
17+
"dev:tauri": "tauri dev -c ./src-tauri/tauri.dev.conf.json",
18+
"dev:tauri:android": "tauri android dev -c ./src-tauri/tauri.dev.conf.json",
19+
"dev:tauri:ios": "tauri ios dev --verbose -c ./src-tauri/tauri.dev.conf.json",
1520
"firebase:login": "firebase login",
1621
"firebase:start": "firebase -c ./firebase/firebase.json --project \"${FIREBASE_PROJECT_ID:-demo-octo}\" emulators:start --import ./firebase/data --export-on-exit ./firebase/data",
1722
"lint": "eslint .",
@@ -30,6 +35,7 @@
3035
"@headlessui/vue": "^1.7.22",
3136
"@mermaid-js/mermaid-mindmap": "^9.3.0",
3237
"@tabler/icons-vue": "^3.11.0",
38+
"@tauri-apps/plugin-opener": "^2.2.4",
3339
"codemirror-lang-mermaid": "^0.2.2",
3440
"culori": "^3.3.0",
3541
"deepmerge": "^4.3.1",
@@ -59,9 +65,13 @@
5965
"@csstools/postcss-oklab-function": "^3.0.9",
6066
"@nuxtjs/tailwindcss": "^6.12.1",
6167
"@pinia/nuxt": "^0.4.11",
62-
"@playwright/test": "^1.46.1",
68+
"@playwright/test": "^1.49.1",
6369
"@tailwindcss/container-queries": "^0.1.1",
6470
"@tailwindcss/typography": "^0.5.15",
71+
"@tauri-apps/cli": "^2.1.0",
72+
"@tauri-apps/plugin-dialog": "^2.2.0",
73+
"@tauri-apps/plugin-process": "^2.2.0",
74+
"@tauri-apps/plugin-updater": "~2",
6575
"@types/culori": "^2.0.4",
6676
"@types/file-saver": "^2.0.7",
6777
"@types/lodash-es": "^4.17.12",

0 commit comments

Comments
 (0)