create-basicjs 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/bin/create-basicjs.js +49 -4
- package/package.json +1 -1
- package/payload/projects/tauri/.github/workflows/build.yml +86 -0
- package/payload/projects/tauri/.github/workflows/tests.yml +87 -0
- package/payload/projects/tauri/AGENTS.md +128 -0
- package/payload/projects/tauri/CLAUDE.md +1 -0
- package/payload/projects/tauri/LICENSE +201 -0
- package/payload/projects/tauri/NOTICE +8 -0
- package/payload/projects/tauri/README.md +269 -0
- package/payload/projects/tauri/checks/window-check.js +189 -0
- package/payload/projects/tauri/gitignore +8 -0
- package/payload/projects/tauri/handbook/01-getting-started.md +188 -0
- package/payload/projects/tauri/handbook/02-the-project.md +264 -0
- package/payload/projects/tauri/handbook/03-the-page.md +260 -0
- package/payload/projects/tauri/handbook/04-commands.md +265 -0
- package/payload/projects/tauri/handbook/05-events-and-state.md +275 -0
- package/payload/projects/tauri/handbook/06-plugins.md +282 -0
- package/payload/projects/tauri/handbook/07-the-window-and-the-app.md +431 -0
- package/payload/projects/tauri/handbook/08-security.md +374 -0
- package/payload/projects/tauri/handbook/09-tests-and-checks.md +266 -0
- package/payload/projects/tauri/handbook/10-building-and-releasing.md +238 -0
- package/payload/projects/tauri/handbook/11-troubleshooting.md +259 -0
- package/payload/projects/tauri/handbook/README.md +125 -0
- package/payload/projects/tauri/handbook/turkce/01-getting-started.md +193 -0
- package/payload/projects/tauri/handbook/turkce/02-the-project.md +272 -0
- package/payload/projects/tauri/handbook/turkce/03-the-page.md +272 -0
- package/payload/projects/tauri/handbook/turkce/04-commands.md +271 -0
- package/payload/projects/tauri/handbook/turkce/05-events-and-state.md +284 -0
- package/payload/projects/tauri/handbook/turkce/06-plugins.md +286 -0
- package/payload/projects/tauri/handbook/turkce/07-the-window-and-the-app.md +433 -0
- package/payload/projects/tauri/handbook/turkce/08-security.md +384 -0
- package/payload/projects/tauri/handbook/turkce/09-tests-and-checks.md +275 -0
- package/payload/projects/tauri/handbook/turkce/10-building-and-releasing.md +241 -0
- package/payload/projects/tauri/handbook/turkce/11-troubleshooting.md +264 -0
- package/payload/projects/tauri/handbook/turkce/README.md +128 -0
- package/payload/projects/tauri/images/app.png +0 -0
- package/payload/projects/tauri/src-tauri/Cargo.lock +4389 -0
- package/payload/projects/tauri/src-tauri/Cargo.toml +31 -0
- package/payload/projects/tauri/src-tauri/app-icon.svg +16 -0
- package/payload/projects/tauri/src-tauri/build.rs +15 -0
- package/payload/projects/tauri/src-tauri/capabilities/default.json +7 -0
- package/payload/projects/tauri/src-tauri/gitignore +5 -0
- package/payload/projects/tauri/src-tauri/icons/128x128.png +0 -0
- package/payload/projects/tauri/src-tauri/icons/128x128@2x.png +0 -0
- package/payload/projects/tauri/src-tauri/icons/32x32.png +0 -0
- package/payload/projects/tauri/src-tauri/icons/icon.icns +0 -0
- package/payload/projects/tauri/src-tauri/icons/icon.ico +0 -0
- package/payload/projects/tauri/src-tauri/src/check.rs +144 -0
- package/payload/projects/tauri/src-tauri/src/files.rs +255 -0
- package/payload/projects/tauri/src-tauri/src/main.rs +45 -0
- package/payload/projects/tauri/src-tauri/src/sizes.rs +214 -0
- package/payload/projects/tauri/src-tauri/tauri.conf.json +44 -0
- package/payload/projects/tauri/src-tauri/tests/project.rs +243 -0
- package/payload/projects/tauri/ui/app.js +459 -0
- package/payload/projects/tauri/ui/backend.js +196 -0
- package/payload/projects/tauri/ui/basic/LICENSE +14 -0
- package/payload/projects/tauri/ui/basic/basic.min.css +1 -0
- package/payload/projects/tauri/ui/basic/basic.min.js +78 -0
- package/payload/projects/tauri/ui/basic/font/open-sans/LICENSE.txt +206 -0
- package/payload/projects/tauri/ui/basic/font/open-sans/OpenSans-Bold.ttf +0 -0
- package/payload/projects/tauri/ui/basic/font/open-sans/OpenSans-Regular.ttf +0 -0
- package/payload/projects/tauri/ui/basic/scroll-bar.min.js +3 -0
- package/payload/projects/tauri/ui/comp/_sources.txt +9 -0
- package/payload/projects/tauri/ui/comp/components.min.js +21 -0
- package/payload/projects/tauri/ui/index.html +28 -0
- package/payload/projects/tauri/ui/sizes.js +104 -0
- package/payload/starter/_basic/VERSION +1 -1
- package/payload/starter/_basic/comp/bottom-bar.js +31 -3
- package/payload/starter/_basic/comp/code-editor.js +219 -1
- package/payload/starter/_basic/comp/context-menu.js +6 -1
- package/payload/starter/_basic/comp/markdown-view.js +4 -2
- package/payload/starter/_basic/comp/phone-field.js +13 -5
- package/payload/starter/_basic/comp/property-panel.js +1 -1
- package/payload/starter/_basic/comp/slider.js +27 -12
- package/payload/starter/_basic/comp/smart-button.js +5 -1
- package/payload/starter/_basic/comp/smart-table.js +8 -1
- package/payload/starter/_basic/comp/stepper.js +29 -3
- package/payload/starter/_basic/comp/toggle.js +2 -1
- package/payload/starter/_basic/docs/component-index.md +53 -53
- package/payload/starter/_basic/examples/code-editor.htm +48 -1
- package/payload/starter/_basic/examples/gallery-styled.htm +896 -0
- package/payload/starter/_basic/examples/search-input.htm +1 -1
- package/payload/starter/_basic/examples/select-box-2-item-view.htm +304 -0
- package/payload/starter/_basic/examples/{slider-2-classic.htm → slider-2-split.htm} +36 -2
- package/payload/starter/_basic/examples/stepper-2.htm +22 -6
- package/payload/starter/_basic/min/bottom-bar.min.js +1 -1
- package/payload/starter/_basic/min/code-editor.min.js +1 -1
- package/payload/starter/_basic/min/context-menu.min.js +1 -1
- package/payload/starter/_basic/min/markdown-view.min.js +1 -1
- package/payload/starter/_basic/min/phone-field.min.js +1 -1
- package/payload/starter/_basic/min/slider.min.js +1 -1
- package/payload/starter/_basic/min/smart-button.min.js +1 -1
- package/payload/starter/_basic/min/smart-table.min.js +1 -1
- package/payload/starter/_basic/min/stepper.min.js +1 -1
- package/payload/starter/_basic/min/toggle.min.js +1 -1
- package/payload/starter/_basic/tools/check.js +13 -2
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
# 10. Building and releasing
|
|
2
|
+
|
|
3
|
+
*Türkçe: [10. Derleme ve yayınlama](turkce/10-building-and-releasing.md)*
|
|
4
|
+
|
|
5
|
+
From your project to a file that other people install: the build, the version, the installers of every system, a
|
|
6
|
+
release on GitHub, and what a user sees the first time the app opens.
|
|
7
|
+
|
|
8
|
+
## cargo tauri build
|
|
9
|
+
|
|
10
|
+
In the root of the project:
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
cargo tauri build
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
It compiles the app in release mode and makes the installers of the system it runs on:
|
|
17
|
+
|
|
18
|
+
| System (2026-11-20) | Time | The app | The installers |
|
|
19
|
+
|---|---|---|---|
|
|
20
|
+
| macOS (Apple Silicon) | 2 min 7 s | `Tauri Starter.app` 3.6 MB | `Tauri Starter_0.1.0_aarch64.dmg` 1.7 MB |
|
|
21
|
+
| Windows 11 (x64) | 2 min 14 s | `tauri-starter.exe` 3.6 MB | `..._x64-setup.exe` 1.4 MB, `..._x64_en-US.msi` 1.9 MB |
|
|
22
|
+
| Linux | | | a `.deb`, an `.rpm` and an `.AppImage` (made by the workflow, below) |
|
|
23
|
+
|
|
24
|
+
The names of the Windows installers start with `Tauri Starter_0.1.0` too (`Tauri Starter_0.1.0_x64-setup.exe`).
|
|
25
|
+
|
|
26
|
+
- The files are in `src-tauri/target/release/bundle/`: on macOS in `macos/` (the app) and `dmg/`, on Windows in
|
|
27
|
+
`nsis\` (the `-setup.exe`) and `msi\`.
|
|
28
|
+
- The macOS time is a clean build; a build after a small change takes less, because the crates that did not change
|
|
29
|
+
are kept.
|
|
30
|
+
- Windows gets two installers of the same app: the `-setup.exe` (made with NSIS) and the `.msi`. Give one of them,
|
|
31
|
+
or both.
|
|
32
|
+
|
|
33
|
+
### Why a release build takes longer
|
|
34
|
+
|
|
35
|
+
`cargo tauri dev` makes a debug build: fast to compile, larger and slower to run. `cargo tauri build` makes a release
|
|
36
|
+
build with the settings of `[profile.release]` in `src-tauri/Cargo.toml`, taken from the "App Size" guide of Tauri:
|
|
37
|
+
|
|
38
|
+
```toml
|
|
39
|
+
[profile.release]
|
|
40
|
+
codegen-units = 1
|
|
41
|
+
lto = true
|
|
42
|
+
opt-level = "s"
|
|
43
|
+
panic = "abort"
|
|
44
|
+
strip = true
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
- `codegen-units = 1` and `lto = true`: the compiler looks at the program and its crates as one piece, and leaves out
|
|
48
|
+
the code that nothing calls. It takes more time, and the program is smaller.
|
|
49
|
+
- `opt-level = "s"`: the code is made small rather than as fast as possible.
|
|
50
|
+
- `panic = "abort"`: a panic (a stop of Rust on an error it can not go on from) ends the app at once.
|
|
51
|
+
- `strip = true`: the names that only a debugger needs are taken out of the program.
|
|
52
|
+
|
|
53
|
+
### The page is inside the app
|
|
54
|
+
|
|
55
|
+
The page of `ui/` is put into the program when it is compiled. The built `Tauri Starter.app` holds four files: its
|
|
56
|
+
information (`Info.plist`), the program, the icon and the signature; there is no `ui/` folder in it. A change in
|
|
57
|
+
`ui/` needs a new build; under `cargo tauri dev` the window reloads by itself.
|
|
58
|
+
|
|
59
|
+
## The version
|
|
60
|
+
|
|
61
|
+
The version of the app is written in one place: `version = "0.1.0"` in `src-tauri/Cargo.toml`. `tauri.conf.json` has
|
|
62
|
+
no `version` field, so Tauri takes this one. It goes into:
|
|
63
|
+
|
|
64
|
+
- the app: the built `Info.plist` says `0.1.0`;
|
|
65
|
+
- the names of the installers (`Tauri Starter_0.1.0_aarch64.dmg`);
|
|
66
|
+
- `src-tauri/Cargo.lock`: Cargo writes the new version there at the next build or `cargo test`. Commit the two files
|
|
67
|
+
together;
|
|
68
|
+
- the tag of a release on GitHub: `v0.1.0` (below).
|
|
69
|
+
|
|
70
|
+
## The settings of the bundle
|
|
71
|
+
|
|
72
|
+
The part `bundle` of `src-tauri/tauri.conf.json`, with `productName` and `identifier` at its top:
|
|
73
|
+
|
|
74
|
+
| Field | In the template | What it is |
|
|
75
|
+
|---|---|---|
|
|
76
|
+
| `productName` | `"Tauri Starter"` | the name of the app and of its files |
|
|
77
|
+
| `identifier` | `"io.github.bug7a.tauri-starter"` | the name the system knows the app by: a reversed domain of yours |
|
|
78
|
+
| `active` | `true` | `cargo tauri build` makes the installers (with `false`, only the program) |
|
|
79
|
+
| `targets` | `"all"` | every installer of the system |
|
|
80
|
+
| `publisher`, `copyright`, `license` | the author, `"Apache-2.0"` | who made the app, and its license |
|
|
81
|
+
| `homepage`, `category`, `shortDescription` | the site, `"Utility"`, a sentence | what the installers say of the app |
|
|
82
|
+
| `macOS.signingIdentity` | `"-"` | the signature of the app on macOS (below) |
|
|
83
|
+
| `icon` | five files of `icons/` | the icon: `cargo tauri icon` makes them ([2. The project](02-the-project.md)) |
|
|
84
|
+
|
|
85
|
+
- On a Mac, the name, the version, the identifier, `copyright` and `category` are in the `Info.plist` of the built
|
|
86
|
+
app.
|
|
87
|
+
- Keep the `identifier` the same from one version to the next: the system knows the app by it, and the folders of
|
|
88
|
+
the app are named after it ([7. The window and the app](07-the-window-and-the-app.md)).
|
|
89
|
+
- `cargo tauri build --bundles <kinds>` makes only some of the installers; `cargo tauri build --help` lists the
|
|
90
|
+
kinds of your system under `--bundles` (on a Mac: `ios, app, dmg`).
|
|
91
|
+
|
|
92
|
+
## Every system on its own
|
|
93
|
+
|
|
94
|
+
Build the installers of a system on that system. A Mac makes the macOS files, for Apple Silicon and for Intel (the
|
|
95
|
+
workflow builds the Intel one with `--target x86_64-apple-darwin`); the Windows files are made on Windows and the
|
|
96
|
+
Linux files on Linux. You do not need three computers: the workflow `build.yml` makes all of them on the computers
|
|
97
|
+
of GitHub.
|
|
98
|
+
|
|
99
|
+
## A release on GitHub: build.yml
|
|
100
|
+
|
|
101
|
+
`.github/workflows/build.yml` runs when a tag that starts with `v` is pushed, or from "Run workflow" on the Actions
|
|
102
|
+
page. For a new version:
|
|
103
|
+
|
|
104
|
+
1. Write the version in `src-tauri/Cargo.toml` (Ex: `version = "0.2.0"`), build or test once so that `Cargo.lock`
|
|
105
|
+
follows, and commit both files.
|
|
106
|
+
2. Push the commit, then a tag of the same version:
|
|
107
|
+
|
|
108
|
+
```sh
|
|
109
|
+
git tag v0.2.0
|
|
110
|
+
git push origin v0.2.0
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
3. On the Actions page of the repository, the workflow "Build" runs four builds side by side, each on its own
|
|
114
|
+
computer: macOS (Apple Silicon), macOS (Intel), Linux and Windows. One that fails does not stop the others.
|
|
115
|
+
4. When they end, the Releases page has a **draft** release named `v0.2.0` with the installers of the four builds.
|
|
116
|
+
A draft is seen only by the people who can change the repository. Download the file of each system, open it,
|
|
117
|
+
then publish the draft.
|
|
118
|
+
|
|
119
|
+
What the steps of each build do:
|
|
120
|
+
|
|
121
|
+
- **The tag is the version of Cargo.toml.** The first step reads `version` from `src-tauri/Cargo.toml` and stops the
|
|
122
|
+
build when the tag is not `v` + that version. Its message, with the tag `v0.2.0` and `0.1.0` in `Cargo.toml`:
|
|
123
|
+
|
|
124
|
+
```text
|
|
125
|
+
::error::The tag is v0.2.0, but the version of src-tauri/Cargo.toml is 0.1.0. Write 0.2.0 as the version there and
|
|
126
|
+
commit (or tag the commit of v0.1.0 instead), then delete the tag v0.2.0 and push it again.
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
(one line in the log; GitHub shows `::error::` as an error of the run). No release is made then. The way out is
|
|
130
|
+
in [11. Troubleshooting](11-troubleshooting.md).
|
|
131
|
+
- **The packages of the system (Linux):** what Tauri needs to build on Linux, as in
|
|
132
|
+
[1. Getting started](01-getting-started.md), and two tools of the Linux installers (`patchelf`, `xdg-utils`).
|
|
133
|
+
- **Rust**, with the target of the build, and a cache of the compiled crates for each target.
|
|
134
|
+
- **`tauri-apps/tauri-action@v1`**, the action of Tauri: it brings the Tauri CLI, runs the build
|
|
135
|
+
(`args: --target ...`) and makes the draft (`releaseDraft: true`, named after the tag, with the text of
|
|
136
|
+
`releaseBody` that tells which file is for which system). Edit `releaseBody` for your app.
|
|
137
|
+
|
|
138
|
+
### The first time
|
|
139
|
+
|
|
140
|
+
Nothing to set in the settings of the repository. The workflow asks for `permissions: contents: write`, and GitHub
|
|
141
|
+
gives the run a token (`GITHUB_TOKEN`) that can make the release. The workflow has no secret of yours: the apps are
|
|
142
|
+
not signed with a certificate.
|
|
143
|
+
|
|
144
|
+
### Run workflow
|
|
145
|
+
|
|
146
|
+
"Run workflow" (on the Actions page, the workflow "Build") makes the same four builds without a tag and without a
|
|
147
|
+
release: the files are kept with the run, on its page (`uploadWorkflowArtifacts`). Use it to try a build of a branch
|
|
148
|
+
before you tag it.
|
|
149
|
+
|
|
150
|
+
### Linux
|
|
151
|
+
|
|
152
|
+
The workflow makes a `.deb` (Debian, Ubuntu), an `.rpm` (Fedora and others) and an `.AppImage` (one file that runs
|
|
153
|
+
without an installer). It builds them on a fixed Ubuntu (`ubuntu-24.04`), not on the newest: an app built on a newer
|
|
154
|
+
Linux does not start on an older one. When GitHub retires that Ubuntu, write the oldest one of its list
|
|
155
|
+
(https://github.com/actions/runner-images) in `build.yml`. The Linux files are built and checked by the workflows on
|
|
156
|
+
Linux; try them on the Linux of your users.
|
|
157
|
+
|
|
158
|
+
## Not signed with a certificate: what a user sees
|
|
159
|
+
|
|
160
|
+
The template signs the app with no certificate, so nothing has to be bought. The system of a user asks once, the
|
|
161
|
+
first time a downloaded copy is opened.
|
|
162
|
+
|
|
163
|
+
- **macOS.** `"signingIdentity": "-"` in `tauri.conf.json` signs the app "ad hoc": an app from the internet must have
|
|
164
|
+
a signature to run on Apple Silicon, and this one has one, without a certificate behind it. `codesign` shows it:
|
|
165
|
+
|
|
166
|
+
```sh
|
|
167
|
+
codesign -dv "src-tauri/target/release/bundle/macos/Tauri Starter.app"
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
```text
|
|
171
|
+
Identifier=io.github.bug7a.tauri-starter
|
|
172
|
+
Format=app bundle with Mach-O thin (arm64)
|
|
173
|
+
...
|
|
174
|
+
Signature=adhoc
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
`spctl --assess --type execute -vv` on the same app answers `rejected`: Gatekeeper does not trust an app without
|
|
178
|
+
a certificate, so it stops a downloaded copy once. The user opens it with System Settings > Privacy & Security >
|
|
179
|
+
"Open Anyway" (macOS 15 and newer; on older ones: right click on the app > Open).
|
|
180
|
+
- **Windows.** The app is not signed. SmartScreen says "Windows protected your PC"; the user presses "More info",
|
|
181
|
+
then "Run anyway".
|
|
182
|
+
|
|
183
|
+
A sentence for your download page (change the name):
|
|
184
|
+
|
|
185
|
+
```text
|
|
186
|
+
My App is not signed with a paid certificate, so your system asks once before it opens it.
|
|
187
|
+
macOS: open System Settings > Privacy & Security and press "Open Anyway" (macOS 14 and older: right click > Open).
|
|
188
|
+
Windows: when "Windows protected your PC" appears, press "More info", then "Run anyway".
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Signing with a certificate
|
|
192
|
+
|
|
193
|
+
A certificate removes the question. It is not set up in the template; the guides of Tauri tell every step, and they
|
|
194
|
+
give the names of the values that the build reads from the environment. In the workflow, these values are secrets of
|
|
195
|
+
the repository (Settings > Secrets and variables > Actions), given to the step `tauri-apps/tauri-action` under `env:`,
|
|
196
|
+
as `GITHUB_TOKEN` is.
|
|
197
|
+
|
|
198
|
+
- **macOS** (https://tauri.app/distribute/sign/macos/): a "Developer ID Application" certificate (it needs the paid
|
|
199
|
+
Apple Developer Program) and notarization (Apple checks the app and gives it a ticket). The guide names
|
|
200
|
+
`APPLE_CERTIFICATE`, `APPLE_CERTIFICATE_PASSWORD` and `APPLE_SIGNING_IDENTITY` for the certificate, and for
|
|
201
|
+
notarization either `APPLE_ID`, `APPLE_PASSWORD` (an app-specific password of your Apple Account) and
|
|
202
|
+
`APPLE_TEAM_ID`, or a key of App Store Connect: `APPLE_API_ISSUER`, `APPLE_API_KEY` and `APPLE_API_KEY_PATH`. Its
|
|
203
|
+
sample workflow first puts the certificate into a keychain of the build computer (with a `KEYCHAIN_PASSWORD`).
|
|
204
|
+
`"signingIdentity": "-"` of the template is the ad hoc signature; with a certificate, the guide says what to write.
|
|
205
|
+
- **Windows** (https://tauri.app/distribute/sign/windows/): an OV certificate, Azure Artifact Signing, Azure Key
|
|
206
|
+
Vault, or a sign command of your own (`bundle > windows` in `tauri.conf.json`: `certificateThumbprint`,
|
|
207
|
+
`digestAlgorithm`, `timestampUrl`, or `signCommand`). Its sample for GitHub Actions keeps the certificate in the
|
|
208
|
+
secrets `WINDOWS_CERTIFICATE` and `WINDOWS_CERTIFICATE_PASSWORD`. The guide also says that, since 2024, no kind of
|
|
209
|
+
certificate gives a new app the trust of SmartScreen at once: it comes with time, release after release signed with
|
|
210
|
+
the same certificate.
|
|
211
|
+
- All the ways to give the app to people: https://tauri.app/distribute/
|
|
212
|
+
|
|
213
|
+
## Updates of the app
|
|
214
|
+
|
|
215
|
+
The app does not look for a new version by itself; the updater plugin of Tauri (`tauri-plugin-updater`) does it:
|
|
216
|
+
the app asks an address of yours for the newest version, downloads it and installs it. Every update must be signed
|
|
217
|
+
with a key of your own: `cargo tauri signer generate` makes the pair, the public key goes into `tauri.conf.json`
|
|
218
|
+
(`plugins.updater`, with the addresses to ask), the build reads the private one from `TAURI_SIGNING_PRIVATE_KEY`, and
|
|
219
|
+
the bundle needs `"createUpdaterArtifacts": true`. It is not set up in the template: https://tauri.app/plugin/updater/
|
|
220
|
+
|
|
221
|
+
## Without GitHub
|
|
222
|
+
|
|
223
|
+
The installers are ordinary files: put them on any web page, a shared drive or a USB stick; nothing in them needs
|
|
224
|
+
GitHub. A copy downloaded from a web page is asked about once, as above.
|
|
225
|
+
|
|
226
|
+
## Before a release
|
|
227
|
+
|
|
228
|
+
1. The version in `src-tauri/Cargo.toml`, and `Cargo.lock` with it, are committed.
|
|
229
|
+
2. `cargo fmt --check`, `cargo clippy --all-targets --features window-check`, `cargo test` and the window check pass
|
|
230
|
+
([9. Tests and checks](09-tests-and-checks.md)), and the workflow "Tests" passes on the three systems.
|
|
231
|
+
3. The name, the identifier, the icon and the texts of the bundle are yours ([2. The project](02-the-project.md)).
|
|
232
|
+
4. The security policy and the permissions are the ones the app needs ([8. Security](08-security.md)).
|
|
233
|
+
5. `releaseBody` of `build.yml` speaks of your app.
|
|
234
|
+
6. Before you publish the draft: each file downloaded and opened on its system, the first time as a user would.
|
|
235
|
+
|
|
236
|
+
## Next
|
|
237
|
+
|
|
238
|
+
[11. Troubleshooting](11-troubleshooting.md): what you see when something goes wrong, why, and what to do.
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
# 11. Troubleshooting
|
|
2
|
+
|
|
3
|
+
*Türkçe: [11. Sorun giderme](turkce/11-troubleshooting.md)*
|
|
4
|
+
|
|
5
|
+
Problems by what you see: why each one happens and what to do. The messages in `text` blocks were seen on macOS
|
|
6
|
+
(Apple Silicon, 2026-11-27); Windows says some of them in other words. A message longer than the page is cut into two
|
|
7
|
+
lines here; the program prints it on one.
|
|
8
|
+
|
|
9
|
+
## Setup
|
|
10
|
+
|
|
11
|
+
**`zsh: command not found: cargo`.** Rust is not installed, or the terminal was opened before it was. Install it from
|
|
12
|
+
https://rustup.rs/, then open a new terminal (`rustc --version` answers there).
|
|
13
|
+
|
|
14
|
+
**`cargo tauri` does not run:**
|
|
15
|
+
|
|
16
|
+
```text
|
|
17
|
+
error: no such command: `tauri`
|
|
18
|
+
|
|
19
|
+
help: view all installed commands with `cargo --list`
|
|
20
|
+
help: find a package to install `tauri` with `cargo search cargo-tauri`
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The Tauri CLI is not installed: `cargo install tauri-cli --version "^2" --locked` (it compiles for some minutes).
|
|
24
|
+
|
|
25
|
+
**Rust is too old.** Cargo stops at once with `is not supported by the following packages`, and names the version the
|
|
26
|
+
project needs (`requires rustc 1.90`). `rustup update` brings a new Rust.
|
|
27
|
+
|
|
28
|
+
**`cargo tauri info`** prints what Tauri finds on the computer: the system, Rust, the versions of the crates of
|
|
29
|
+
Tauri, the plugins and the security policy. A `✘ Xcode: not installed!` line on a Mac is not a problem for a desktop
|
|
30
|
+
app: the command line tools (`xcode-select --install`) are enough to build it.
|
|
31
|
+
|
|
32
|
+
**The tools of the system are missing.** The first build stops with an error about a linker or a library of the
|
|
33
|
+
system.
|
|
34
|
+
|
|
35
|
+
- macOS: `xcode-select --install`.
|
|
36
|
+
- Windows: the Microsoft C++ Build Tools with "Desktop development with C++" (Rust needs its linker), and WebView2
|
|
37
|
+
(Windows 11 has it, and Windows 10 from version 1803).
|
|
38
|
+
- Linux: the build names a system library it can not find (Ex: of WebKitGTK). Install the packages of
|
|
39
|
+
[1. Getting started](01-getting-started.md); for another Linux than Debian or Ubuntu:
|
|
40
|
+
https://tauri.app/start/prerequisites/
|
|
41
|
+
|
|
42
|
+
## Running
|
|
43
|
+
|
|
44
|
+
**The first `cargo tauri dev` takes long.** It compiles about 250 to 290 crates: 56 seconds on an Apple Silicon Mac
|
|
45
|
+
(2026-11-20), some minutes on a slower computer. The next runs take seconds.
|
|
46
|
+
|
|
47
|
+
**The window is white, or shows only the color of the page.** The code of the page stopped with an error before it
|
|
48
|
+
drew. Open the inspector (right-click > Inspect Element in `cargo tauri dev`,
|
|
49
|
+
[9. Tests and checks](09-tests-and-checks.md)) and read its console, or open the page in a browser: the same error
|
|
50
|
+
is in the console of the browser. The window check names the first thing the page does not have; with a missing `)`
|
|
51
|
+
in `ui/app.js`:
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
PASS the page runs in the app (window.__TAURI__)
|
|
55
|
+
FAIL the check stopped: ReferenceError: Can't find variable: currentFolder
|
|
56
|
+
WINDOW CHECK: 1 FAILED
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**A new script or component does nothing.** Its `<script>` line in `ui/index.html` names a file that is not there
|
|
60
|
+
(a typo, or a file not copied into `ui/comp/`). Tauri answers a file that is not there with `ui/index.html`, so the
|
|
61
|
+
page reads HTML as a script. The window check says:
|
|
62
|
+
|
|
63
|
+
```text
|
|
64
|
+
FAIL no error in the page: SyntaxError: Unexpected token '<'
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Compare the line with the name and the folder of the file.
|
|
68
|
+
|
|
69
|
+
**The window shows the old page.** Under `cargo tauri dev` a change in `ui/` reloads the window. The built app has
|
|
70
|
+
the page inside its program: build it again ([10. Building and releasing](10-building-and-releasing.md)). In a
|
|
71
|
+
browser, load the page again.
|
|
72
|
+
|
|
73
|
+
**The status bar says "Sample data: run the app with cargo tauri dev".** The page is open in a browser, not in the
|
|
74
|
+
app: `Backend.isInApp()` is false and `ui/backend.js` gives its sample answers. Run `cargo tauri dev`.
|
|
75
|
+
|
|
76
|
+
**`window.__TAURI__` is undefined.** In a browser it always is: keep every call to Tauri in `ui/backend.js`, behind
|
|
77
|
+
`Backend.isInApp()`. In the app, `"withGlobalTauri": true` is missing from `app` in `src-tauri/tauri.conf.json`.
|
|
78
|
+
|
|
79
|
+
## Commands
|
|
80
|
+
|
|
81
|
+
**The page gets `Command read_note not found`.** The command is not in `generate_handler!` of `src-tauri/src/main.rs`,
|
|
82
|
+
or the page writes its name in another way. `cargo test` tells it before the app runs. A command written in Rust but
|
|
83
|
+
not added (the compiler also warns ``function `read_note` is never used``):
|
|
84
|
+
|
|
85
|
+
```text
|
|
86
|
+
read_note is written with #[tauri::command], but it is not in generate_handler! of src/main.rs: the page can not call it
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
A name the page calls that Rust does not have:
|
|
90
|
+
|
|
91
|
+
```text
|
|
92
|
+
the page calls invoke("read_note"), but generate_handler! of src/main.rs has no read_note
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**An argument has the wrong name, or is missing.** The page sent `show_hidden`, or no key at all, where Tauri waits
|
|
96
|
+
for `showHidden`:
|
|
97
|
+
|
|
98
|
+
```text
|
|
99
|
+
invalid args `showHidden` for command `list_folder`: command list_folder missing required key showHidden
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
The keys of the page are the names of the Rust arguments in camelCase: `show_hidden` is `showHidden`. No test sees it
|
|
103
|
+
before the call runs: the window check does, when a step uses the call.
|
|
104
|
+
|
|
105
|
+
**An argument has the wrong type.** A number where Rust waits for a `String`:
|
|
106
|
+
|
|
107
|
+
```text
|
|
108
|
+
invalid args `path` for command `list_folder`: invalid type: integer `5`, expected a string
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**The answer has other names than the page expects** (`entry.isFolder` is `undefined`). The struct of the answer has
|
|
112
|
+
no `#[serde(rename_all = "camelCase")]`, so its fields reach the page as they are written in Rust (`is_folder`). Add
|
|
113
|
+
the line above the struct ([4. Commands](04-commands.md)).
|
|
114
|
+
|
|
115
|
+
**The window stops while a command works.** The command is a plain `#[tauri::command]` and takes long. Write
|
|
116
|
+
`#[tauri::command(async)]`, or start a thread and send events ([5. Events and state](05-events-and-state.md)).
|
|
117
|
+
|
|
118
|
+
An `Err` of Rust is not a problem of Tauri: its text is the error of the promise, and the page shows it. Ex: a folder
|
|
119
|
+
that is not there gives `.../tauri-starter-check-19517-missing: No such file or directory (os error 2)`.
|
|
120
|
+
|
|
121
|
+
## Events
|
|
122
|
+
|
|
123
|
+
**Nothing arrives.** Neither `emit` nor `listen` gives an error for a name nobody uses: compare the two names letter
|
|
124
|
+
by letter. Then: the page must listen before Rust sends (the template listens once, at the start: `Sizes.listen()`),
|
|
125
|
+
and an event of an old job is dropped on purpose (the number of the job). A step of the window check that waits for
|
|
126
|
+
the event says `FAIL waited 10 s for: ...` when it never comes.
|
|
127
|
+
|
|
128
|
+
**A handler runs twice.** `listen` was called twice for the same name: each call adds a handler, so two `listen`
|
|
129
|
+
calls and one `emit` run it two times. Listen once, when the page starts.
|
|
130
|
+
|
|
131
|
+
## Plugins and permissions
|
|
132
|
+
|
|
133
|
+
**`... not allowed. Permissions associated with this command: ...`** The page called a part of Tauri or of a plugin
|
|
134
|
+
that `src-tauri/capabilities/default.json` does not allow. The message names the permissions that allow it:
|
|
135
|
+
|
|
136
|
+
```text
|
|
137
|
+
dialog.open not allowed. Permissions associated with this command: dialog:allow-open, dialog:default
|
|
138
|
+
window.set_title not allowed. Permissions associated with this command: core:window:allow-set-title
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Add one of them to `permissions` (the narrower one, Ex: `dialog:allow-open`, when that is all the page needs). The
|
|
142
|
+
template allows only the folder dialog (`dialog:allow-open`): `ask()`, `confirm()`, `message()` and `save()` need
|
|
143
|
+
their lines ([6. Plugins](06-plugins.md)). `core:default` does not allow everything: changing the window from the
|
|
144
|
+
page needs its own lines ([7. The window and the app](07-the-window-and-the-app.md)). The file is compiled into the
|
|
145
|
+
app: the change is seen when the app is compiled again. For a plugin, `cargo test` tells it first:
|
|
146
|
+
|
|
147
|
+
```text
|
|
148
|
+
the page uses window.__TAURI__.dialog, but capabilities/ gives no "dialog:..." permission
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**The plugin is not on `window.__TAURI__`:**
|
|
152
|
+
|
|
153
|
+
```text
|
|
154
|
+
TypeError: undefined is not an object (evaluating 'window.__TAURI__.opener.openPath')
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
The plugin is not added. Add it with `cargo tauri add <name>`, as [6. Plugins](06-plugins.md) shows. `cargo test`
|
|
158
|
+
tells this one first too:
|
|
159
|
+
|
|
160
|
+
```text
|
|
161
|
+
the page uses window.__TAURI__.opener, but Cargo.toml has no tauri-plugin-opener:
|
|
162
|
+
run "cargo tauri add opener" in src-tauri/
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## The security policy
|
|
166
|
+
|
|
167
|
+
**A picture, a font or a call to an address of the web does not load.** The security policy (`csp` in
|
|
168
|
+
`src-tauri/tauri.conf.json`) stops it. The page sees only that it failed (an `error` event of the picture;
|
|
169
|
+
`TypeError: Load failed` for a `fetch`). The window check keeps the reason from the first line of the page, also
|
|
170
|
+
while it loads, and prints it in its last step. A picture from the web in `ui/index.html`:
|
|
171
|
+
|
|
172
|
+
```text
|
|
173
|
+
FAIL the icons are drawn (img-src of the security policy): 17 pictures, 1 broken
|
|
174
|
+
FAIL no error in the page: a file did not load: https://example.com/picture.png | security policy: img-src
|
|
175
|
+
https://example.com/picture.png
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
A font and a call give `security policy: font-src https://example.com/font.woff2` and
|
|
179
|
+
`security policy: connect-src https://example.com/`. The word after `security policy:` is the part to change for a
|
|
180
|
+
real need: `img-src` for pictures, `font-src` for fonts, `connect-src` for calls. When a call to the web belongs to
|
|
181
|
+
Rust instead: [8. Security](08-security.md).
|
|
182
|
+
|
|
183
|
+
**Scripts.** The policy stops a script that the page makes while it runs: a `<script>` element made by the code, with
|
|
184
|
+
a text in it (`security policy: script-src-elem inline`) or with an address of the web
|
|
185
|
+
(`security policy: script-src-elem https://cdn.jsdelivr.net/npm/dayjs@1.11.13/dayjs.min.js`), and `eval` and
|
|
186
|
+
`new Function`. It did not stop the scripts written into `ui/index.html` (seen on macOS): an inline `<script>` there
|
|
187
|
+
runs (when the app is compiled, Tauri adds its hash to the policy), and a `<script src="https://cdn.jsdelivr.net/...">`
|
|
188
|
+
there loaded from the web while the window check said `ALL PASS`. The project test
|
|
189
|
+
`the_pages_load_scripts_only_from_the_files_of_the_app` stops both (`cargo test`):
|
|
190
|
+
|
|
191
|
+
```text
|
|
192
|
+
<script src="https://cdn.jsdelivr.net/npm/dayjs@1.11.13/dayjs.min.js"> in ui/*.html: a script from the web would run
|
|
193
|
+
in the app with all that the page may do; save a copy of it into ui/ and load that
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Put a copy of the file in `ui/` and load it with its own `<script src>` line ([8. Security](08-security.md)); put the
|
|
197
|
+
code of an inline `<script>` into a `.js` file of `ui/`.
|
|
198
|
+
|
|
199
|
+
## Building
|
|
200
|
+
|
|
201
|
+
**The tag is not the version.** The workflow "Build" stops at its first step:
|
|
202
|
+
|
|
203
|
+
```text
|
|
204
|
+
::error::The tag is v0.2.0, but the version of src-tauri/Cargo.toml is 0.1.0. Write 0.2.0 as the version there and
|
|
205
|
+
commit (or tag the commit of v0.1.0 instead), then delete the tag v0.2.0 and push it again.
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Either the tag is right and `Cargo.toml` was not changed, or the tag has a typo. Delete the tag, on your computer and
|
|
209
|
+
on GitHub, then tag the commit that has the right version:
|
|
210
|
+
|
|
211
|
+
```sh
|
|
212
|
+
git tag -d v0.2.0
|
|
213
|
+
git push --delete origin v0.2.0
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
**A build of the workflow fails on Linux at a crate of the system.** A package is missing from the `apt-get install`
|
|
217
|
+
line: add it to that line in `build.yml` and in `tests.yml`.
|
|
218
|
+
|
|
219
|
+
**The app does not open on another computer.**
|
|
220
|
+
|
|
221
|
+
- A Mac with an Intel processor needs the `.dmg` whose name has `x64` (the `aarch64` one is for Apple Silicon).
|
|
222
|
+
- Windows needs WebView2 (Windows 11 has it, and Windows 10 from version 1803).
|
|
223
|
+
- Linux: the app was built on a newer Linux than the one of the user: build on the oldest one you support (the
|
|
224
|
+
workflow uses `ubuntu-24.04` for that).
|
|
225
|
+
|
|
226
|
+
**macOS stops a downloaded copy.** The app has no certificate (only the ad hoc signature): the user opens it once
|
|
227
|
+
with System Settings > Privacy & Security > "Open Anyway" (on macOS 14 and older: right click > Open). A certificate
|
|
228
|
+
removes the question: [10. Building and releasing](10-building-and-releasing.md).
|
|
229
|
+
|
|
230
|
+
A copy whose files changed after the build no longer matches its signature, and macOS may then say that the app is
|
|
231
|
+
damaged. Send the files as the build made them. `codesign --verify --strict "Tauri Starter.app"` prints nothing when
|
|
232
|
+
the signature is whole, and this when a file changed:
|
|
233
|
+
|
|
234
|
+
```text
|
|
235
|
+
Tauri Starter.app: a sealed resource is missing or invalid
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
**Windows says "Windows protected your PC".** SmartScreen, for an app that is not signed: "More info" >
|
|
239
|
+
"Run anyway".
|
|
240
|
+
|
|
241
|
+
## The disk
|
|
242
|
+
|
|
243
|
+
`src-tauri/target/` is the compiled app: some GB (3.2 GB in the folder of the template with a dev and a release
|
|
244
|
+
build, Apple Silicon, 2026-11-27). It is not in git. `cargo clean` in `src-tauri/` deletes it; the next build is a
|
|
245
|
+
first build again.
|
|
246
|
+
|
|
247
|
+
## Where to ask
|
|
248
|
+
|
|
249
|
+
- **Tauri itself** (the window, the plugins, the permissions, the build): its documents https://tauri.app/ (version 2
|
|
250
|
+
only), its Discord https://discord.com/invite/tauri and https://github.com/tauri-apps/tauri. Give the output of
|
|
251
|
+
`cargo tauri info` with the question.
|
|
252
|
+
- **The template** (its code, the window check, the workflows, this handbook): the issues of
|
|
253
|
+
https://github.com/bug7a/ozdenui-tauri-template
|
|
254
|
+
- **The page** (the objects, the groups, the components): the handbook of basic.js
|
|
255
|
+
https://bug7a.github.io/basic.js-handbook/ and the components https://bug7a.github.io/js-components/
|
|
256
|
+
|
|
257
|
+
## Back to the start
|
|
258
|
+
|
|
259
|
+
[The handbook](README.md): every chapter, from the first run to a release. Tauri: https://tauri.app/
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Tauri Starter — The Handbook
|
|
2
|
+
|
|
3
|
+
Make a desktop app of your own from Tauri Starter, step by step. The window of the app is a page written with
|
|
4
|
+
basic.js in plain JavaScript; the work that a page can not do is written in Rust; Tauri 2 joins the two. The handbook
|
|
5
|
+
starts from the template as it is (a small file browser), changes it chapter by chapter and ends with the installers
|
|
6
|
+
of your app on GitHub. It is written for people who know some JavaScript and have not written Rust or used Tauri.
|
|
7
|
+
|
|
8
|
+
*Türkçe: [Tauri Starter — El Kitabı](turkce/README.md)*
|
|
9
|
+
|
|
10
|
+
A command in Rust (`src-tauri/src/main.rs`; its name also goes into `tauri::generate_handler![...]` there):
|
|
11
|
+
|
|
12
|
+
```rust
|
|
13
|
+
#[tauri::command]
|
|
14
|
+
fn greet(name: String) -> String {
|
|
15
|
+
format!("Hello, {name}! This answer comes from Rust.")
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The page calls it from `ui/backend.js`, and shows the answer (Ex: in `start()` of `ui/app.js`):
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
Backend.greet = function (name) {
|
|
23
|
+
if (!Backend.isInApp()) return Promise.resolve("Hello, " + name + "! (a sample answer)");
|
|
24
|
+
return window.__TAURI__.core.invoke("greet", { name: name });
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
Backend.greet("Ada").then(function (text) {
|
|
28
|
+
Toast.info(text);
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## The chapters
|
|
33
|
+
|
|
34
|
+
| | Chapter | You learn |
|
|
35
|
+
|---|---|---|
|
|
36
|
+
| 1 | [Getting started](01-getting-started.md) | Rust, the Tauri CLI, your copy, a first change on each side |
|
|
37
|
+
| 2 | [The project](02-the-project.md) | every file, how the app starts, the settings, making it your own |
|
|
38
|
+
| 3 | [The page](03-the-page.md) | basic.js in the window, the components, a button and a message of yours |
|
|
39
|
+
| 4 | [Commands](04-commands.md) | the page asks, Rust answers: `invoke`, a new command and its test |
|
|
40
|
+
| 5 | [Events and state](05-events-and-state.md) | Rust tells the page how a long job goes; state kept by Tauri |
|
|
41
|
+
| 6 | [Plugins](06-plugins.md) | a feature of Tauri with no Rust to write; permissions |
|
|
42
|
+
| 7 | [The window and the app](07-the-window-and-the-app.md) | the window from the page, more windows, a menu |
|
|
43
|
+
| 8 | [Security](08-security.md) | the security policy, the capabilities, commands that guard themselves |
|
|
44
|
+
| 9 | [Tests and checks](09-tests-and-checks.md) | `cargo test`, the window check, an AI assistant |
|
|
45
|
+
| 10 | [Building and releasing](10-building-and-releasing.md) | `cargo tauri build`, the version, a release, signing |
|
|
46
|
+
| 11 | [Troubleshooting](11-troubleshooting.md) | what you see, why, and what to do |
|
|
47
|
+
|
|
48
|
+
Read 1 to 6 in order: they are the whole idea (the project, the page and the three ways the page and Rust work
|
|
49
|
+
together). Open 7 to 11 when you need them.
|
|
50
|
+
|
|
51
|
+
## How to read it
|
|
52
|
+
|
|
53
|
+
- A command is run in the root of the project (the folder that holds `ui/` and `src-tauri/`), unless the chapter says
|
|
54
|
+
`src-tauri/`.
|
|
55
|
+
- Every sample is whole and was tried with the template as it is (Tauri Starter v0.1.0, Tauri 2). A sample that
|
|
56
|
+
changes a file of the template names the file and the place.
|
|
57
|
+
- Measured numbers carry their date and the computer they were measured on.
|
|
58
|
+
- `Ex:` gives an example. A name in `code` is a name of the code, a file or a command.
|
|
59
|
+
- The Rust a chapter shows is explained where it is first seen, no more than the chapter needs.
|
|
60
|
+
- The objects of the page (`Box`, `Label`, the groups, the events) are taught by the handbook of basic.js:
|
|
61
|
+
https://bug7a.github.io/basic.js-handbook/. Chapter 3 gives what the template uses.
|
|
62
|
+
|
|
63
|
+
## In one minute
|
|
64
|
+
|
|
65
|
+
**1. The page asks, Rust answers** (a command: chapter 4). Rust, in `src-tauri/src/files.rs`:
|
|
66
|
+
|
|
67
|
+
```rust
|
|
68
|
+
#[tauri::command(async)]
|
|
69
|
+
pub fn list_folder(
|
|
70
|
+
app: tauri::AppHandle,
|
|
71
|
+
path: String,
|
|
72
|
+
show_hidden: bool,
|
|
73
|
+
) -> Result<Folder, String> {
|
|
74
|
+
// reads the folder: Ok(a Folder) or Err(a text)
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The page, in `ui/backend.js` (`show_hidden` in Rust is `showHidden` in JavaScript; an `Err` of Rust is the error of the
|
|
79
|
+
promise):
|
|
80
|
+
|
|
81
|
+
```js
|
|
82
|
+
Backend.listFolder = function (path, showHidden) {
|
|
83
|
+
if (!Backend.isInApp()) return Backend.listSampleFolder(path, showHidden);
|
|
84
|
+
return window.__TAURI__.core.invoke("list_folder", { path: path, showHidden: showHidden });
|
|
85
|
+
};
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**2. Rust tells the page how a job goes** (events: chapter 5). A thread of Rust sends, in `src-tauri/src/sizes.rs`:
|
|
89
|
+
|
|
90
|
+
```rust
|
|
91
|
+
let _ = app.emit("measure-folder", folder_size);
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The page listens once, when it starts (`ui/sizes.js`):
|
|
95
|
+
|
|
96
|
+
```js
|
|
97
|
+
Backend.listen("measure-folder", Sizes.showFolderSize);
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**3. A plugin of Tauri** (chapter 6). `cargo tauri add dialog` added the folder dialog of the system; the page calls
|
|
101
|
+
it with no Rust of its own (`ui/backend.js`):
|
|
102
|
+
|
|
103
|
+
```js
|
|
104
|
+
Backend.chooseFolder = function (startPath) {
|
|
105
|
+
if (!Backend.isInApp()) return Promise.resolve(Backend.SAMPLE_CHOSEN_FOLDER);
|
|
106
|
+
return window.__TAURI__.dialog.open({ directory: true, defaultPath: startPath });
|
|
107
|
+
};
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
`window.__TAURI__` is there because of `"withGlobalTauri": true` in `src-tauri/tauri.conf.json`: the page has no npm
|
|
111
|
+
package to import. `ui/backend.js` is the only file of the page that uses it.
|
|
112
|
+
|
|
113
|
+
## Other documents
|
|
114
|
+
|
|
115
|
+
- The `README.md` of the template: the short version (what you need, run, build, the files, the tests).
|
|
116
|
+
- `AGENTS.md`: the rules for an AI assistant that changes the app (chapter 9). An assistant that can not read the
|
|
117
|
+
files reads the same text on the site: https://bug7a.github.io/ozdenui-tauri-template/llms.txt
|
|
118
|
+
- The site of the template: https://bug7a.github.io/ozdenui-tauri-template/ and this handbook as a web page:
|
|
119
|
+
https://bug7a.github.io/ozdenui-tauri-template/handbook/index.htm
|
|
120
|
+
- Tauri: https://tauri.app/ (its prerequisites: https://tauri.app/start/prerequisites/, its plugins:
|
|
121
|
+
https://tauri.app/plugin/, security: https://tauri.app/security/, distributing an app: https://tauri.app/distribute/).
|
|
122
|
+
Tauri Starter is a community template: it is not an official project of Tauri.
|
|
123
|
+
- basic.js: https://bug7a.github.io/basic.js/ and its handbook https://bug7a.github.io/basic.js-handbook/. The
|
|
124
|
+
components: https://bug7a.github.io/js-components/ (their sources: https://github.com/bug7a/js-components, the folder
|
|
125
|
+
`comp/`).
|