feat: adding pre-commit and formatting stuff (#2196)

This commit is contained in:
Simon Hyll
2024-05-24 01:54:41 +02:00
committed by GitHub
parent 4aa157bd5a
commit 5a417a0c49
84 changed files with 1136 additions and 1078 deletions

1
.github/labeler.yml vendored
View File

@@ -4,4 +4,3 @@ i18n:
- src/content/docs/es/**/*
- src/content/docs/fr/**/*
- src/content/docs/zh-cn/**/*

View File

@@ -9,4 +9,3 @@ jobs:
uses: tauri-apps/automation/.github/workflows/congrats.yml@main
secrets:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}

View File

@@ -19,4 +19,3 @@ jobs:
- name: Rebuild i18n Dashboard
if: contains(steps.label-pr.outputs.all-labels, 'i18n')
run: curl -X POST -d {} https://api.netlify.com/build_hooks/$NETLIFY_BUILD_KEY

9
.pre-commit-config.yaml Normal file
View File

@@ -0,0 +1,9 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-json
- id: check-added-large-files

View File

@@ -15,3 +15,6 @@ pnpm-lock.yaml
# Configs
.github
!.github/**.md
# TODO: Figure out why this format isn't acceptable
src/components/overrides/Header.astro

View File

@@ -1,23 +1,29 @@
{
"printWidth": 100,
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": true,
"plugins": ["prettier-plugin-astro"],
"overrides": [
{
"files": [".*", "*.json", "*.md", "*.toml", "*.yml"],
"options": {
"useTabs": false
}
},
{
"files": ["*.md", "*.mdx"],
"options": {
"printWidth": 80
}
}
]
"printWidth": 100,
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": true,
"plugins": ["prettier-plugin-astro"],
"overrides": [
{
"files": "*.astro",
"options": {
"parser": "astro"
}
},
{
"files": ["*.json", "*.md", "*.toml", "*.yml"],
"options": {
"useTabs": false
}
},
{
"files": ["*.md", "*.mdx"],
"options": {
"printWidth": 80
}
}
]
}

7
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,7 @@
{
"files.encoding": "utf8",
"prettier.documentSelectors": ["**/*.astro"],
"[astro]": {
"editor.defaultFormatter": "astro-build.astro-vscode"
}
}

View File

@@ -5,7 +5,7 @@ import rehypeAutolinkHeadings from 'rehype-autolink-headings';
import locales from './locales.json';
import starlightLinksValidator from 'starlight-links-validator';
import starlightBlog from 'starlight-blog';
import serviceWorker from "astrojs-service-worker";
import serviceWorker from 'astrojs-service-worker';
const authors = {
nothingismagick: {
@@ -81,8 +81,8 @@ export default defineConfig({
rss: `${site}/rss`,
},
components: {
Sidebar: "./src/components/overrides/Sidebar.astro",
Header: "./src/components/overrides/Header.astro",
Sidebar: './src/components/overrides/Sidebar.astro',
Header: './src/components/overrides/Header.astro',
Footer: 'src/components/overrides/Footer.astro',
ThemeSelect: 'src/components/overrides/ThemeSelect.astro',
PageFrame: 'src/components/overrides/PageFrame.astro',
@@ -106,7 +106,7 @@ export default defineConfig({
tag: 'link',
attrs: {
rel: 'manifest',
href: '/manifest.json'
href: '/manifest.json',
},
},
{
@@ -129,19 +129,19 @@ export default defineConfig({
items: [
{
label: 'What is Tauri?',
link: '/start/'
link: '/start/',
},
{
label: 'Prerequisites',
link: '/start/prerequisites/'
link: '/start/prerequisites/',
},
{
label: 'Create a Project',
link: '/start/create-project/',
badge: {
text: 'WIP',
variant: 'caution'
}
variant: 'caution',
},
},
{
label: 'Frontend Configuration',
@@ -153,7 +153,7 @@ export default defineConfig({
collapsed: true,
autogenerate: { directory: 'start/migrate' },
},
]
],
},
{
label: 'Core Concepts',
@@ -190,7 +190,7 @@ export default defineConfig({
collapsed: true,
autogenerate: { directory: 'about' },
},
]
],
},
{
label: 'References',
@@ -198,23 +198,23 @@ export default defineConfig({
items: [
{
label: 'Access Control List',
link: '/reference/acl/'
link: '/reference/acl/',
},
{
label: 'Command Line Interface (CLI)',
link: '/reference/cli/'
link: '/reference/cli/',
},
{
label: 'Configuration',
link: '/reference/config/'
link: '/reference/config/',
},
{
label: 'Environment Variables',
link: '/reference/environment-variables/'
link: '/reference/environment-variables/',
},
{
label: 'Webview Versions',
link: '/reference/webview-versions/'
link: '/reference/webview-versions/',
},
{
label: 'Releases',
@@ -228,9 +228,9 @@ export default defineConfig({
},
{
label: 'Rust (docs.rs)',
link: 'https://docs.rs/tauri/2.0.0-beta.19/tauri/index.html'
link: 'https://docs.rs/tauri/2.0.0-beta.19/tauri/index.html',
},
]
],
},
{
label: 'Blog',
@@ -238,14 +238,14 @@ export default defineConfig({
items: [
{
label: 'All posts',
link: '/blog/'
link: '/blog/',
},
{
label: 'Recent posts',
collapsed: false,
autogenerate: { directory: 'blog' }, // TODO: Manually construct `items` to sort by dates
},
]
],
},
],
locales,
@@ -257,19 +257,21 @@ export default defineConfig({
clientsClaim: true,
inlineWorkboxRuntime: true,
skipWaiting: true,
globIgnores: ["**_redirects**", "**_headers**"],
globPatterns: ["**/*.js", "**/*.css"],
runtimeCaching: [{
urlPattern: new RegExp('.*'),
handler: 'CacheFirst',
options: {
cacheName: 'tauri-runtime',
expiration: {
maxAgeSeconds: 30 * 60 // 30 minutes
globIgnores: ['**_redirects**', '**_headers**'],
globPatterns: ['**/*.js', '**/*.css'],
runtimeCaching: [
{
urlPattern: new RegExp('.*'),
handler: 'CacheFirst',
options: {
cacheName: 'tauri-runtime',
expiration: {
maxAgeSeconds: 30 * 60, // 30 minutes
},
},
},
}]
}
],
},
}),
],
markdown: {
@@ -376,9 +378,9 @@ function i18nRedirect(from, to) {
locale === 'root'
? (routes[from] = to)
: (routes[`/${locale}/${from.replaceAll(/^\/*/g, '')}`] = `/${locale}/${to.replaceAll(
/^\/*/g,
''
)}`)
/^\/*/g,
''
)}`)
);
return routes;
}

View File

@@ -249,9 +249,9 @@
<p>
If you're interested in helping us translate
<a href="https://v2.tauri.app/">v2.tauri.app</a> into one of the languages listed
below, you've come to the right place! This auto-updating page always lists all the
content that could use your help right now.
<a href="https://v2.tauri.app/">v2.tauri.app</a> into one of the languages listed below,
you've come to the right place! This auto-updating page always lists all the content that
could use your help right now.
</p>
<p>

View File

@@ -1,24 +1,24 @@
{
"name": "Tauri",
"short_name": "Tauri",
"description": "The cross-platform app building toolkit",
"start_url": "/index.html",
"display": "standalone",
"background_color": "#181818",
"theme_color": "#181818",
"icons": [
{
"src": "/logo.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/logo.png",
"sizes": "512x512",
"type": "image/png"
}
],
"lang": "en-US",
"orientation": "portrait",
"scope": "/"
"name": "Tauri",
"short_name": "Tauri",
"description": "The cross-platform app building toolkit",
"start_url": "/index.html",
"display": "standalone",
"background_color": "#181818",
"theme_color": "#181818",
"icons": [
{
"src": "/logo.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/logo.png",
"sizes": "512x512",
"type": "image/png"
}
],
"lang": "en-US",
"orientation": "portrait",
"scope": "/"
}

View File

@@ -161,7 +161,8 @@ body[data-mobile-menu-expanded] header {
}
</style>
{Astro.props.entry.slug === '' || Astro.props.locale === Astro.props.entry.slug ?
{
Astro.props.entry.slug === '' || Astro.props.locale === Astro.props.entry.slug ?
<style>
.header {
background-color: transparent;

View File

@@ -1,20 +1,25 @@
---
import MobileMenuToggle from 'virtual:starlight/components/MobileMenuToggle';
import type { Props } from '@astrojs/starlight/props';
import Sidebar from './Sidebar.astro'
import Sidebar from './Sidebar.astro';
const { labels } = Astro.props;
---
<div class="page sl-flex">
<header class="header"><slot name="header" /></header>
<nav class="sidebar" aria-label={labels['sidebarNav.accessibleLabel']}>
<MobileMenuToggle {...Astro.props} />
<div id="starlight__sidebar" class={Astro.props.entry.slug === '' || Astro.props.locale === Astro.props.entry.slug ? "sidebar-pane lp-hide" : 'sidebar-pane'}>
<div class="sidebar-content sl-flex">
<Sidebar {...Astro.props} />
</div>
<nav class="sidebar" aria-label={labels['sidebarNav.accessibleLabel']}>
<MobileMenuToggle {...Astro.props} />
<div
id="starlight__sidebar"
class={Astro.props.entry.slug === '' || Astro.props.locale === Astro.props.entry.slug
? 'sidebar-pane lp-hide'
: 'sidebar-pane'}
>
<div class="sidebar-content sl-flex">
<Sidebar {...Astro.props} />
</div>
</nav>
</div>
</nav>
<div class="main-frame"><slot /></div>
</div>

View File

@@ -1,7 +1,7 @@
---
import type { Props } from "@astrojs/starlight/props";
import Default from "@astrojs/starlight/components/Sidebar.astro";
import { AstroError } from "astro/errors";
import type { Props } from '@astrojs/starlight/props';
import Default from '@astrojs/starlight/components/Sidebar.astro';
import { AstroError } from 'astro/errors';
// Styles and CSS logic derived from https://daisyui.com/components/collapse/
@@ -11,124 +11,108 @@ import { AstroError } from "astro/errors";
// 1. Validate the config is set up correctly
// 2. Create a new derived set of `Astro.props` that only contains one set of sidebar entries
// 3. Check if the current page being rendered is current page to determine if this sidebar group should be selected
const multiSidebarConfig: [string, boolean, Props][] = Astro.props.sidebar.map(
(entry) => {
if (entry.type !== "group") {
throw new AstroError(
`\`${entry.label}\` cannot be used with multiple Starlight sidebars.
const multiSidebarConfig: [string, boolean, Props][] = Astro.props.sidebar.map((entry) => {
if (entry.type !== 'group') {
throw new AstroError(
`\`${entry.label}\` cannot be used with multiple Starlight sidebars.
Each top-level \`sidebar\` item in the Starlight config must be either a group or autogenerated.
See https://starlight.astro.build/guides/sidebar/#groups and https://starlight.astro.build/guides/sidebar/#autogenerated-groups`
);
}
);
}
// Recursively check if a group of sidebar entries contains the current page
const findIfIsCurrent = (
entry: (typeof Astro.props.sidebar)[number]
): boolean => {
if (entry.type === "link") {
return entry.isCurrent;
}
return entry.entries.some((item) => findIfIsCurrent(item));
};
// Recursively check if a group of sidebar entries contains the current page
const findIfIsCurrent = (entry: (typeof Astro.props.sidebar)[number]): boolean => {
if (entry.type === 'link') {
return entry.isCurrent;
}
return entry.entries.some((item) => findIfIsCurrent(item));
};
const isCurrentPage = findIfIsCurrent(entry);
const isCurrentPage = findIfIsCurrent(entry);
return [
entry.label,
isCurrentPage,
{ ...Astro.props, sidebar: [...entry.entries] },
];
}
);
return [entry.label, isCurrentPage, { ...Astro.props, sidebar: [...entry.entries] }];
});
let foundCurrentPage = false;
for (const page of multiSidebarConfig) {
if (page[1]) {
foundCurrentPage = true;
break;
}
if (page[1]) {
foundCurrentPage = true;
break;
}
}
if (!foundCurrentPage && multiSidebarConfig.length > 0) {
multiSidebarConfig[0][1] = true;
multiSidebarConfig[0][1] = true;
}
if (
!multiSidebarConfig.some(([_label, isCurrentPage, _config]) => isCurrentPage)
) {
multiSidebarConfig[0][1] = true;
if (!multiSidebarConfig.some(([_label, isCurrentPage, _config]) => isCurrentPage)) {
multiSidebarConfig[0][1] = true;
}
---
<div class="__collapse">
{
multiSidebarConfig.map(([label, isCurrentPage, config]) => (
<>
<input
type="radio"
name="sidebar"
role="tab"
aria-label={label}
checked={isCurrentPage}
/>
<div class="__collapse-content">
<Default {...config}>
<slot />
</Default>
</div>
</>
))
}
{
multiSidebarConfig.map(([label, isCurrentPage, config]) => (
<>
<input type="radio" name="sidebar" role="tab" aria-label={label} checked={isCurrentPage} />
<div class="__collapse-content">
<Default {...config}>
<slot />
</Default>
</div>
</>
))
}
</div>
<style>
.__collapse {
display: grid;
}
.__collapse > input {
/* Layout */
position: relative;
display: inline-flex;
grid-row-start: 1;
appearance: none;
width: 100%;
min-height: fit-content;
.__collapse {
display: grid;
}
.__collapse > input {
/* Layout */
position: relative;
display: inline-flex;
grid-row-start: 1;
appearance: none;
width: 100%;
min-height: fit-content;
/* Styles */
border-radius: 0.25rem;
padding: 0.2em 0.5rem;
line-height: 1.4;
font-size: var(--sl-text-lg);
font-weight: 600;
cursor: pointer;
user-select: none;
margin-bottom: var(--sl-nav-pad-y);
}
/* Styles */
border-radius: 0.25rem;
padding: 0.2em 0.5rem;
line-height: 1.4;
font-size: var(--sl-text-lg);
font-weight: 600;
cursor: pointer;
user-select: none;
margin-bottom: var(--sl-nav-pad-y);
}
.__collapse > input::after {
content: attr(aria-label);
}
.__collapse > input::after {
content: attr(aria-label);
}
.__collapse > input:checked {
color: var(--sl-color-text-invert);
background-color: var(--sl-color-text-accent);
}
.__collapse > input:checked {
color: var(--sl-color-text-invert);
background-color: var(--sl-color-text-accent);
}
.__collapse > .__collapse-content {
display: none;
grid-column-start: 1;
grid-column-end: span 999;
grid-row-start: 2;
border-top: 1px solid var(--sl-color-gray-5);
padding-top: 1rem;
}
.__collapse > input:checked + .__collapse-content {
display: block;
}
.__collapse > .__collapse-content {
display: none;
grid-column-start: 1;
grid-column-end: span 999;
grid-row-start: 2;
border-top: 1px solid var(--sl-color-gray-5);
padding-top: 1rem;
}
.__collapse > input:checked + .__collapse-content {
display: block;
}
</style>
<style is:global>
.top-level {
margin-bottom: 1rem;
}
.sidebar-pane {
overflow-y:scroll;
}
.top-level {
margin-bottom: 1rem;
}
.sidebar-pane {
overflow-y: scroll;
}
</style>

View File

@@ -1,181 +0,0 @@
---
title: Bridge
draft: true
---
import Rater from '@theme/Rater'
import useBaseUrl from '@docusaurus/useBaseUrl'
<div className="row">
<div className="col col--4">
<table>
<tr>
<td>Ease of Use</td>
<td><Rater value="3"/></td>
</tr>
<tr>
<td>Extensibility</td>
<td><Rater value="5"/></td>
</tr>
<tr>
<td>Performance</td>
<td><Rater value="4"/></td>
</tr>
<tr>
<td>Security</td>
<td><Rater value="4"/></td>
</tr>
</table>
</div>
<div className="col col--4 pattern-logo">
<img src={useBaseUrl('img/recipes/Bridge.svg')} alt="Bridge" />
</div>
<div className="col col--4">
Pros:
<ul>
<li>Highly configurable</li>
<li>No Rust skills required</li>
</ul>
Cons:
<ul>
<li>Some WebAPIs unavailable</li>
<li>Challenge to implement</li>
</ul>
</div>
</div>
## Description
The Bridge recipe is a secure pattern where messages are passed between brokers via an implicit bridge using the API. It isolates functionality to the specific scope and passes messages instead of functionality.
## Diagram
```mermaid
graph TD
H==>F
subgraph WEBVIEW
F-.-E
end
D-->E
E-->D
B-->D
D-->B
subgraph RUST
A==>H
A-->B
B-.-C
B-.-G
end
A[Binary]
B{Rust Broker}
C[Subprocess 2]
G[Subprocess 1]
D(( API BRIDGE ))
E{JS Broker}
F[Window]
H{Bootstrap}
class D apibridge
class RUST rust
class WEBVIEW webview
```
## Configuration
Here's what you need to add to your tauri.conf.json file:
```json
{
"tauri": {
"allowlist": {
"all": false,
"clipboard": {
"all": false,
"readText": false,
"writeText": false
},
"dialog": {
"all": false,
"ask": false,
"confirm": false,
"message": false,
"open": false,
"save": false
},
"fs": {
"all": false,
"copyFile": false,
"createDir": false,
"readDir": false,
"readFile": false,
"removeDir": false,
"removeFile": false,
"renameFile": false,
"scope": [],
"writeFile": false
},
"globalShortcut": {
"all": false
},
"http": {
"all": false,
"request": false,
"scope": []
},
"notification": {
"all": false
},
"os": {
"all": false
},
"path": {
"all": false
},
"process": {
"all": false,
"exit": false,
"relaunch": false,
"relaunchDangerousAllowSymlinkMacos": false
},
"protocol": {
"all": false,
"asset": false,
"assetScope": []
},
"shell": {
"all": false,
"execute": false,
"open": false,
"scope": [],
"sidecar": false
},
"window": {
"all": false,
"center": false,
"close": false,
"create": false,
"hide": false,
"maximize": false,
"minimize": false,
"print": false,
"requestUserAttention": false,
"setAlwaysOnTop": false,
"setDecorations": false,
"setFocus": false,
"setFullscreen": false,
"setIcon": false,
"setMaxSize": false,
"setMinSize": false,
"setPosition": false,
"setResizable": false,
"setSize": false,
"setSkipTaskbar": false,
"setTitle": false,
"show": false,
"startDragging": false,
"unmaximize": false,
"unminimize": false
}
}
}
}
```

View File

@@ -0,0 +1,189 @@
---
title: Bridge
draft: true
---
import Rater from '@theme/Rater';
import useBaseUrl from '@docusaurus/useBaseUrl';
<div className="row">
<div className="col col--4">
<table>
<tr>
<td>Ease of Use</td>
<td>
<Rater value="3" />
</td>
</tr>
<tr>
<td>Extensibility</td>
<td>
<Rater value="5" />
</td>
</tr>
<tr>
<td>Performance</td>
<td>
<Rater value="4" />
</td>
</tr>
<tr>
<td>Security</td>
<td>
<Rater value="4" />
</td>
</tr>
</table>
</div>
<div className="col col--4 pattern-logo">
<img src={useBaseUrl('img/recipes/Bridge.svg')} alt="Bridge" />
</div>
<div className="col col--4">
Pros:
<ul>
<li>Highly configurable</li>
<li>No Rust skills required</li>
</ul>
Cons:
<ul>
<li>Some WebAPIs unavailable</li>
<li>Challenge to implement</li>
</ul>
</div>
</div>
## Description
The Bridge recipe is a secure pattern where messages are passed between brokers via an implicit bridge using the API. It isolates functionality to the specific scope and passes messages instead of functionality.
## Diagram
```mermaid
graph TD
H==>F
subgraph WEBVIEW
F-.-E
end
D-->E
E-->D
B-->D
D-->B
subgraph RUST
A==>H
A-->B
B-.-C
B-.-G
end
A[Binary]
B{Rust Broker}
C[Subprocess 2]
G[Subprocess 1]
D(( API BRIDGE ))
E{JS Broker}
F[Window]
H{Bootstrap}
class D apibridge
class RUST rust
class WEBVIEW webview
```
## Configuration
Here's what you need to add to your tauri.conf.json file:
```json
{
"tauri": {
"allowlist": {
"all": false,
"clipboard": {
"all": false,
"readText": false,
"writeText": false
},
"dialog": {
"all": false,
"ask": false,
"confirm": false,
"message": false,
"open": false,
"save": false
},
"fs": {
"all": false,
"copyFile": false,
"createDir": false,
"readDir": false,
"readFile": false,
"removeDir": false,
"removeFile": false,
"renameFile": false,
"scope": [],
"writeFile": false
},
"globalShortcut": {
"all": false
},
"http": {
"all": false,
"request": false,
"scope": []
},
"notification": {
"all": false
},
"os": {
"all": false
},
"path": {
"all": false
},
"process": {
"all": false,
"exit": false,
"relaunch": false,
"relaunchDangerousAllowSymlinkMacos": false
},
"protocol": {
"all": false,
"asset": false,
"assetScope": []
},
"shell": {
"all": false,
"execute": false,
"open": false,
"scope": [],
"sidecar": false
},
"window": {
"all": false,
"center": false,
"close": false,
"create": false,
"hide": false,
"maximize": false,
"minimize": false,
"print": false,
"requestUserAttention": false,
"setAlwaysOnTop": false,
"setDecorations": false,
"setFocus": false,
"setFullscreen": false,
"setIcon": false,
"setMaxSize": false,
"setMinSize": false,
"setPosition": false,
"setResizable": false,
"setSize": false,
"setSkipTaskbar": false,
"setTitle": false,
"show": false,
"startDragging": false,
"unmaximize": false,
"unminimize": false
}
}
}
}
```

View File

@@ -3,45 +3,53 @@ title: Cloudbridge
draft: true
---
import Rater from '@theme/Rater'
import useBaseUrl from '@docusaurus/useBaseUrl'
import Rater from '@theme/Rater';
import useBaseUrl from '@docusaurus/useBaseUrl';
<div className="row">
<div className="col col--4">
<table>
<tr>
<td>Ease of Use</td>
<td><Rater value="1"/></td>
</tr>
<tr>
<td>Extensibility</td>
<td><Rater value="5"/></td>
</tr>
<tr>
<td>Performance</td>
<td><Rater value="3"/></td>
</tr>
<tr>
<td>Security</td>
<td><Rater value="2"/></td>
</tr>
</table>
</div>
<div className="col col--4 pattern-logo">
<img src={useBaseUrl('img/recipes/Cloudbridge.svg')} alt="Cloudbridge" />
</div>
<div className="col col--4">
Pros:
<ul>
<li>All available features</li>
<li>No Rust skills required</li>
</ul>
Cons:
<ul>
<li>Largest bundle size</li>
<li>Hard to separate concerns</li>
</ul>
</div>
<div className="col col--4">
<table>
<tr>
<td>Ease of Use</td>
<td>
<Rater value="1" />
</td>
</tr>
<tr>
<td>Extensibility</td>
<td>
<Rater value="5" />
</td>
</tr>
<tr>
<td>Performance</td>
<td>
<Rater value="3" />
</td>
</tr>
<tr>
<td>Security</td>
<td>
<Rater value="2" />
</td>
</tr>
</table>
</div>
<div className="col col--4 pattern-logo">
<img src={useBaseUrl('img/recipes/Cloudbridge.svg')} alt="Cloudbridge" />
</div>
<div className="col col--4">
Pros:
<ul>
<li>All available features</li>
<li>No Rust skills required</li>
</ul>
Cons:
<ul>
<li>Largest bundle size</li>
<li>Hard to separate concerns</li>
</ul>
</div>
</div>
## Description

View File

@@ -3,45 +3,53 @@ title: Cloudish
draft: true
---
import Rater from '@theme/Rater'
import useBaseUrl from '@docusaurus/useBaseUrl'
import Rater from '@theme/Rater';
import useBaseUrl from '@docusaurus/useBaseUrl';
<div className="row">
<div className="col col--4">
<table>
<tr>
<td>Ease of Use</td>
<td><Rater value="5"/></td>
</tr>
<tr>
<td>Extensibility</td>
<td><Rater value="3"/></td>
</tr>
<tr>
<td>Performance</td>
<td><Rater value="3"/></td>
</tr>
<tr>
<td>Security</td>
<td><Rater value="2"/></td>
</tr>
</table>
</div>
<div className="col col--4 pattern-logo">
<img src={useBaseUrl('img/recipes/Cloudish.svg')} alt="Cloudish" />
</div>
<div className="col col--4">
Pros:
<ul>
<li>Similar to a SPA web-app</li>
<li>No Rust skills required</li>
</ul>
Cons:
<ul>
<li>No access to Rust API</li>
<li>Uses a localhost server</li>
</ul>
</div>
<div className="col col--4">
<table>
<tr>
<td>Ease of Use</td>
<td>
<Rater value="5" />
</td>
</tr>
<tr>
<td>Extensibility</td>
<td>
<Rater value="3" />
</td>
</tr>
<tr>
<td>Performance</td>
<td>
<Rater value="3" />
</td>
</tr>
<tr>
<td>Security</td>
<td>
<Rater value="2" />
</td>
</tr>
</table>
</div>
<div className="col col--4 pattern-logo">
<img src={useBaseUrl('img/recipes/Cloudish.svg')} alt="Cloudish" />
</div>
<div className="col col--4">
Pros:
<ul>
<li>Similar to a SPA web-app</li>
<li>No Rust skills required</li>
</ul>
Cons:
<ul>
<li>No access to Rust API</li>
<li>Uses a localhost server</li>
</ul>
</div>
</div>
## Description

View File

@@ -3,49 +3,57 @@ title: GLUI
draft: true
---
import useBaseUrl from '@docusaurus/useBaseUrl'
import useBaseUrl from '@docusaurus/useBaseUrl';
:::warning
This pattern is not available for now.
:::
import Rater from '@theme/Rater'
import Rater from '@theme/Rater';
<div className="row">
<div className="col col--4">
<table>
<tr>
<td>Ease of Use</td>
<td><Rater value="0"/></td>
</tr>
<tr>
<td>Extensibility</td>
<td><Rater value="0"/></td>
</tr>
<tr>
<td>Performance</td>
<td><Rater value="5"/></td>
</tr>
<tr>
<td>Security</td>
<td><Rater value="0"/></td>
</tr>
</table>
</div>
<div className="col col--4 pattern-logo">
<img src={useBaseUrl('img/recipes/GLUI.svg')} alt="GLUI" />
</div>
<div className="col col--4">
Pros:
<ul>
<li>Framebuffer FTW</li>
<li>Window events rigged</li>
</ul>
Cons:
<ul>
<li>Broken on your machine</li>
</ul>
</div>
<div className="col col--4">
<table>
<tr>
<td>Ease of Use</td>
<td>
<Rater value="0" />
</td>
</tr>
<tr>
<td>Extensibility</td>
<td>
<Rater value="0" />
</td>
</tr>
<tr>
<td>Performance</td>
<td>
<Rater value="5" />
</td>
</tr>
<tr>
<td>Security</td>
<td>
<Rater value="0" />
</td>
</tr>
</table>
</div>
<div className="col col--4 pattern-logo">
<img src={useBaseUrl('img/recipes/GLUI.svg')} alt="GLUI" />
</div>
<div className="col col--4">
Pros:
<ul>
<li>Framebuffer FTW</li>
<li>Window events rigged</li>
</ul>
Cons:
<ul>
<li>Broken on your machine</li>
</ul>
</div>
</div>
## Description

View File

@@ -3,45 +3,53 @@ title: Hermit
draft: true
---
import Rater from '@theme/Rater'
import useBaseUrl from '@docusaurus/useBaseUrl'
import Rater from '@theme/Rater';
import useBaseUrl from '@docusaurus/useBaseUrl';
<div className="row">
<div className="col col--4">
<table>
<tr>
<td>Ease of Use</td>
<td><Rater value="5"/></td>
</tr>
<tr>
<td>Extensibility</td>
<td><Rater value="0"/></td>
</tr>
<tr>
<td>Performance</td>
<td><Rater value="5"/></td>
</tr>
<tr>
<td>Security</td>
<td><Rater value="5"/></td>
</tr>
</table>
</div>
<div className="col col--4 pattern-logo">
<img src={useBaseUrl('img/recipes/Hermit.svg')} alt="Hermit" />
</div>
<div className="col col--4">
Pros:
<ul>
<li>Quick to make</li>
<li>Smallest size</li>
</ul>
Cons:
<ul>
<li>No remote resources</li>
<li>No access to API</li>
</ul>
</div>
<div className="col col--4">
<table>
<tr>
<td>Ease of Use</td>
<td>
<Rater value="5" />
</td>
</tr>
<tr>
<td>Extensibility</td>
<td>
<Rater value="0" />
</td>
</tr>
<tr>
<td>Performance</td>
<td>
<Rater value="5" />
</td>
</tr>
<tr>
<td>Security</td>
<td>
<Rater value="5" />
</td>
</tr>
</table>
</div>
<div className="col col--4 pattern-logo">
<img src={useBaseUrl('img/recipes/Hermit.svg')} alt="Hermit" />
</div>
<div className="col col--4">
Pros:
<ul>
<li>Quick to make</li>
<li>Smallest size</li>
</ul>
Cons:
<ul>
<li>No remote resources</li>
<li>No access to API</li>
</ul>
</div>
</div>
## Description

View File

@@ -1,82 +0,0 @@
---
title: Lockdown
draft: true
---
import Rater from '@theme/Rater'
import useBaseUrl from '@docusaurus/useBaseUrl'
<div className="row">
<div className="col col--4">
<table>
<tr>
<td>Ease of Use</td>
<td><Rater value="2"/></td>
</tr>
<tr>
<td>Extensibility</td>
<td><Rater value="4"/></td>
</tr>
<tr>
<td>Performance</td>
<td><Rater value="5"/></td>
</tr>
<tr>
<td>Security</td>
<td><Rater value="5" /></td>
</tr>
</table>
</div>
<div className="col col--4 pattern-logo">
<img src={useBaseUrl('img/recipes/Lockdown.svg')} alt="Lockdown" />
</div>
<div className="col col--4">
Pros:
<ul>
<li>Highest security rating</li>
<li>Elegant and powerful</li>
</ul>
Cons:
<ul>
<li>Rust skills required</li>
<li>No remote resources</li>
</ul>
</div>
</div>
## Description
The Lockdown recipe is a minimal usage of the [Bridge pattern](./bridge), which only allows interaction between Rust and the Window via expiring JS Promise Closures that are injected into the Window by Rust and nulled as part of the callback.
## Diagram
```mermaid
graph TD
H==>F
G-.->B
B-->G
subgraph WEBVIEW
G-->F
end
subgraph RUST
A-->B
A==>H
end
A[Binary]
B[API:Event]
F[Window]
G((Promise Closure))
H{Bootstrap}
class RUST rust
class WEBVIEW webview
```
## Configuration
Here's what you need to add to your tauri.conf.json file:
```json
"tauri": {
"allowlist": {} // all API endpoints are default false
}
```

View File

@@ -0,0 +1,90 @@
---
title: Lockdown
draft: true
---
import Rater from '@theme/Rater';
import useBaseUrl from '@docusaurus/useBaseUrl';
<div className="row">
<div className="col col--4">
<table>
<tr>
<td>Ease of Use</td>
<td>
<Rater value="2" />
</td>
</tr>
<tr>
<td>Extensibility</td>
<td>
<Rater value="4" />
</td>
</tr>
<tr>
<td>Performance</td>
<td>
<Rater value="5" />
</td>
</tr>
<tr>
<td>Security</td>
<td>
<Rater value="5" />
</td>
</tr>
</table>
</div>
<div className="col col--4 pattern-logo">
<img src={useBaseUrl('img/recipes/Lockdown.svg')} alt="Lockdown" />
</div>
<div className="col col--4">
Pros:
<ul>
<li>Highest security rating</li>
<li>Elegant and powerful</li>
</ul>
Cons:
<ul>
<li>Rust skills required</li>
<li>No remote resources</li>
</ul>
</div>
</div>
## Description
The Lockdown recipe is a minimal usage of the [Bridge pattern](./bridge), which only allows interaction between Rust and the Window via expiring JS Promise Closures that are injected into the Window by Rust and nulled as part of the callback.
## Diagram
```mermaid
graph TD
H==>F
G-.->B
B-->G
subgraph WEBVIEW
G-->F
end
subgraph RUST
A-->B
A==>H
end
A[Binary]
B[API:Event]
F[Window]
G((Promise Closure))
H{Bootstrap}
class RUST rust
class WEBVIEW webview
```
## Configuration
Here's what you need to add to your tauri.conf.json file:
```json
"tauri": {
"allowlist": {} // all API endpoints are default false
}
```

View File

@@ -1,91 +0,0 @@
---
title: Multiwin
draft: true
---
import useBaseUrl from '@docusaurus/useBaseUrl'
import Rater from '@theme/Rater'
<div className="row">
<div className="col col--4">
<table>
<tr>
<td>Ease of Use</td>
<td><Rater value="4"/></td>
</tr>
<tr>
<td>Extensibility</td>
<td><Rater value="4"/></td>
</tr>
<tr>
<td>Performance</td>
<td><Rater value="3"/></td>
</tr>
<tr>
<td>Security</td>
<td><Rater value="5"/></td>
</tr>
</table>
</div>
<div className="col col--4 pattern-logo">
<img src={useBaseUrl('img/recipes/Multiwin.svg')} alt="Multiwin" />
</div>
<div className="col col--4">
Pros:
<ul>
<li>Windows can be spawned or destroyed at runtime</li>
<li>Separation of concerns</li>
</ul>
Cons:
<ul>
<li>Somewhat complex</li>
</ul>
</div>
</div>
## Description
The Multiwin recipe will allow you to have multiple windows.
## Diagram
```mermaid
graph LR
A==>H
H==>F
H==>G
subgraph WEBVIEW
F
end
subgraph WINIT
G
end
subgraph RUST
A
end
A[Binary]
F[Window]
G[Window]
H{Bootstrap}
class WINIT other
class RUST rust
class WEBVIEW webview
```
## Configuration
Here's what you need to add to your tauri.conf.json file:
```json
"tauri": {
"allowlist": {}, // all API endpoints are default false
"windows": [{
"title": "Window1",
"label": "main",
}, {
"title": "Splash",
"label": "splashscreen"
}]
}
```

View File

@@ -0,0 +1,99 @@
---
title: Multiwin
draft: true
---
import useBaseUrl from '@docusaurus/useBaseUrl';
import Rater from '@theme/Rater';
<div className="row">
<div className="col col--4">
<table>
<tr>
<td>Ease of Use</td>
<td>
<Rater value="4" />
</td>
</tr>
<tr>
<td>Extensibility</td>
<td>
<Rater value="4" />
</td>
</tr>
<tr>
<td>Performance</td>
<td>
<Rater value="3" />
</td>
</tr>
<tr>
<td>Security</td>
<td>
<Rater value="5" />
</td>
</tr>
</table>
</div>
<div className="col col--4 pattern-logo">
<img src={useBaseUrl('img/recipes/Multiwin.svg')} alt="Multiwin" />
</div>
<div className="col col--4">
Pros:
<ul>
<li>Windows can be spawned or destroyed at runtime</li>
<li>Separation of concerns</li>
</ul>
Cons:
<ul>
<li>Somewhat complex</li>
</ul>
</div>
</div>
## Description
The Multiwin recipe will allow you to have multiple windows.
## Diagram
```mermaid
graph LR
A==>H
H==>F
H==>G
subgraph WEBVIEW
F
end
subgraph WINIT
G
end
subgraph RUST
A
end
A[Binary]
F[Window]
G[Window]
H{Bootstrap}
class WINIT other
class RUST rust
class WEBVIEW webview
```
## Configuration
Here's what you need to add to your tauri.conf.json file:
```json
"tauri": {
"allowlist": {}, // all API endpoints are default false
"windows": [{
"title": "Window1",
"label": "main",
}, {
"title": "Splash",
"label": "splashscreen"
}]
}
```

View File

@@ -32,7 +32,7 @@ Tauri has a variety of topics that are considered to be core concepts, things an
title="Process Model"
href="/concept/process-model/"
description="Which processes Tauri manages and why."
/>
/>
<LinkCard
title="App Size"
href="/concept/size/"

View File

@@ -30,7 +30,8 @@ lto = true # Enables link-time-optimizations.
opt-level = "s" # Prioritizes small binary size. Use `3` if you prefer speed.
panic = "abort" # Higher performance by disabling panic handlers.
strip = true # Ensures debug symbols are removed.
```
````
</TabItem>
<TabItem label="Nightly">
@@ -48,7 +49,8 @@ panic = "abort" # Higher performance by disabling panic handlers.
strip = true # Ensures debug symbols are removed.
trim-paths = "all" # Removes potentially privileged information from your binaries.
rustflags = ["-Cdebuginfo=0", "-Zthreads=8"] # Better compile performance.
```
````
</TabItem>
</Tabs>

View File

@@ -6,10 +6,10 @@ sidebar:
variant: caution
---
{ /* TODO: REVISE COPY TO V2 */}
{ /* TODO: Update links and internal navigation */}
{ /* TODO: Add support to light/dark mode images */}
{ /* TODO: Revise this change: Debugging in CLion > Debug in CLion */}
{/* TODO: REVISE COPY TO V2 */}
{/* TODO: Update links and internal navigation */}
{/* TODO: Add support to light/dark mode images */}
{/* TODO: Revise this change: Debugging in CLion > Debug in CLion */}
In this guide, we'll be setting up IntelliJ CLion for debugging the [Core Process of your Tauri app](/concept/process-model/#the-core-process).
@@ -33,17 +33,17 @@ Before you proceed, make sure that your project is fully loaded. If the indexing
We will set up a Run/Debug configuration that we can use to launch our Tauri app in debugging mode. To create a configuration, go to Edit Configurations, click **+**, and then select Cargo Command.
![Add Run/Debug Configuration](@assets/develop/Debug/rustrover/add-cargo-config-light.png)
{ /* ![Add Run/Debug Configuration](@assets/debugging/clion/add-cargo-config-dark.png#gh-dark-mode-only) */}
{/* ![Add Run/Debug Configuration](@assets/debugging/clion/add-cargo-config-dark.png#gh-dark-mode-only) */}
With that created we need to configure CLion so it instructs Cargo to build our app without any default features. This will tell Tauri to use your development server instead of reading assets from disk. Normally this flag is passed by the Tauri CLI, but since we're completely sidestepping that here, we need to pass the flag manually.
![Add `--no-default-features` flag](@assets/develop/Debug/rustrover/set-no-default-features-light.png)
{ /* ![Add `--no-default-features` flag](@assets/develop/Debug/rustrover/set-no-default-features-dark.png#gh-dark-mode-only) */}
{/* ![Add `--no-default-features` flag](@assets/develop/Debug/rustrover/set-no-default-features-dark.png#gh-dark-mode-only) */}
Now we can optionally rename the Run/Debug Configuration to something more memorable, in this example we called it "Run Tauri App", but you can name it whatever you want.
![Rename Configuration](@assets/develop/Debug/rustrover/rename-configuration-light.png)
{ /* ![Rename Configuration](@assets/develop/Debug/rustrover/rename-configuration-dark.png#gh-dark-mode-only) */}
{/* ![Rename Configuration](@assets/develop/Debug/rustrover/rename-configuration-dark.png#gh-dark-mode-only) */}
:::caution

View File

@@ -6,8 +6,8 @@ sidebar:
variant: caution
---
{ /* TODO: Update links and internal navigation */}
{ /* TODO: Add support to light/dark mode images */}
{/* TODO: Update links and internal navigation */}
{/* TODO: Add support to light/dark mode images */}
In this guide, we'll be setting up JetBrains RustRover for debugging the [Core Process of your Tauri app](/concept/process-model/#the-core-process).
@@ -29,27 +29,29 @@ Before you proceed, make sure that your project is fully loaded. If the Cargo to
## Setting up Run Configurations
You will need to set up two separate Run/Debug configurations:
* one for launching the Tauri app in debugging mode,
* another one for running your frontend development server of choice.
- one for launching the Tauri app in debugging mode,
- another one for running your frontend development server of choice.
### Tauri App
1. In the main menu, go to **Run | Edit Configurations**.
2. In the **Run/Debug Configurations** dialog:
* To create a new configuration, click **+** on the toolbar and select **Cargo**.
- To create a new configuration, click **+** on the toolbar and select **Cargo**.
![Add Run/Debug Configuration](@assets/develop/Debug/rustrover/add-cargo-config-light.png)
{ /* ![Add Run/Debug Configuration](@assets/develop/Debug/rustrover/add-cargo-config-dark.png#gh-dark-mode-only) */}
{/* ![Add Run/Debug Configuration](@assets/develop/Debug/rustrover/add-cargo-config-dark.png#gh-dark-mode-only) */}
With that created, we need to configure RustRover, so it instructs Cargo to build our app without any default features. This will tell Tauri to use your development server instead of reading assets from the disk. Normally this flag is passed by the Tauri CLI, but since we're completely sidestepping that here, we need to pass the flag manually.
![Add `--no-default-features` flag](@assets/develop/Debug/rustrover/set-no-default-features-light.png)
{ /* ![Add `--no-default-features` flag](@assets/develop/Debug/rustrover/set-no-default-features-dark.png#gh-dark-mode-only) */}
{/* ![Add `--no-default-features` flag](@assets/develop/Debug/rustrover/set-no-default-features-dark.png#gh-dark-mode-only) */}
Now we can optionally rename the Run/Debug Configuration to something more memorable, in this example we called it "Run Tauri App", but you can name it whatever you want.
![Rename Configuration](@assets/develop/Debug/rustrover/rename-configuration-light.png)
{ /* ![Rename Configuration](@assets/develop/Debug/rustrover/rename-configuration-dark.png#gh-dark-mode-only) */}
{/* ![Rename Configuration](@assets/develop/Debug/rustrover/rename-configuration-dark.png#gh-dark-mode-only) */}
### Development Server
@@ -64,22 +66,21 @@ To create the corresponding Run configuration, you need to check the actual deve
For `npm`, `pnpm`, or `yarn`, you could use the **npm** Run Configuration, for example:
![NPM Configuration](@assets/develop/Debug/rustrover/npm-configuration-light.png)
{ /* ![NPM Configuration](@assets/develop/Debug/rustrover/npm-configuration-dark.png#gh-dark-mode-only) */}
{/* ![NPM Configuration](@assets/develop/Debug/rustrover/npm-configuration-dark.png#gh-dark-mode-only) */}
Make sure you have the correct values in the **Command**, **Scripts**, and **Package Manager** fields.
If your development server is `trunk` for Rust-based WebAssembly frontend frameworks, you could use the generic **Shell Script** Run Configuration:
![Trunk Serve Configuration](@assets/develop/Debug/rustrover/trunk-configuration-light.png)
{ /* ![Trunk Serve Configuration](@assets/develop/Debug/rustrover/trunk-configuration-dark.png#gh-dark-mode-only) */}
{/* ![Trunk Serve Configuration](@assets/develop/Debug/rustrover/trunk-configuration-dark.png#gh-dark-mode-only) */}
## Launching a Debugging Session
To launch a debugging session, you first need to run your development server, and then start debugging the Tauri App by clicking the **Debug** button next to the Run Configurations Switcher. RustRover will automatically recognize breakpoints placed in any Rust file in your project and stop on the first one hit.
![Debug Session](@assets/develop/Debug/rustrover/debug-session-light.png)
{ /* ![Debug Session](@assets/develop/Debug/rustrover/debug-session-dark.png#gh-dark-mode-only) */}
{/* ![Debug Session](@assets/develop/Debug/rustrover/debug-session-dark.png#gh-dark-mode-only) */}
From this point, you can explore the values of your variables, step further into the code, and check what's going at runtime in detail.

View File

@@ -338,7 +338,7 @@ class ExamplePlugin: Plugin {
Tauri automatically implements two commands for the plugin: `checkPermissions` and `requestPermissions`. Those commands can be directly called from JavaScript or Rust:
{ /* TODO: PermissionState type should be exported in Tauri */}
{/* TODO: PermissionState type should be exported in Tauri */}
<Tabs>
<TabItem label="JavaScript">
@@ -405,7 +405,7 @@ impl<R: Runtime> Notification<R> {
## Plugin Events
{ /* TODO: Is this section a duplicate of Lifecycle Events above? */}
{/* TODO: Is this section a duplicate of Lifecycle Events above? */}
Plugins can emit events at any point of time using the `trigger` function:

View File

@@ -6,11 +6,11 @@ sidebar:
order: 10
---
{ /* TODO: Add a CLI section */}
{/* TODO: Add a CLI section */}
import CommandTabs from '@components/CommandTabs.astro';
{ /* TODO: Link to windowing system, commands for sending messages, and event system */}
{/* TODO: Link to windowing system, commands for sending messages, and event system */}
:::tip[Plugin Development]
@@ -24,11 +24,11 @@ Tauri offers a windowing system with web view functionality, a way to send messa
A Tauri plugin is composed of a Cargo crate and an optional NPM package that provides API bindings for its commands and events. Additionally, a plugin project can include an Android library project and a Swift package for iOS. You can learn more about developing plugins for Android and iOS in the [Mobile Plugin Development guide](/develop/plugins/develop-mobile/).
{ /* TODO: https://github.com/tauri-apps/tauri/issues/7749 */}
{/* TODO: https://github.com/tauri-apps/tauri/issues/7749 */}
## Naming Convention
{ /* TODO: Add link to allowlist */}
{/* TODO: Add link to allowlist */}
Tauri plugins have a prefix (`tauri-plugin-` prefix for the Rust crate name and `@tauri-apps/plugin-` for the NPM package) followed by the plugin name. The plugin name is specified on the plugin configuration under [`tauri.conf.json > plugin`](/reference/config/#pluginconfig) and on the allowlist configuration.

View File

@@ -9,7 +9,7 @@ sidebar:
variant: caution
---
{ /* TODO: REVISE COPY TO V2 */}
{/* TODO: REVISE COPY TO V2 */}
:::caution[Currently in pre-alpha]
@@ -61,18 +61,24 @@ import { LinkCard, CardGrid } from '@astrojs/starlight/components';
<CardGrid>
<LinkCard title="Setup" href="/start/develop/tests/webdriver/example/" />
<LinkCard title="Selenium" href="/start/develop/tests/webdriver/example/selenium" />
<LinkCard
title="WebdriverIO"
href="/start/develop/tests/webdriver/example/webdriverio"
/>
title="Selenium"
href="/start/develop/tests/webdriver/example/selenium"
/>
<LinkCard
title="WebdriverIO"
href="/start/develop/tests/webdriver/example/webdriverio"
/>
</CardGrid>
## Continuous Integration (CI)
The above examples also comes with a CI script to test with GitHub actions, but you may still be interested in the below WebDriver CI guide as it explains the concept a bit more.
<LinkCard title="Continuous Integration (CI)" href="/start/develop/tests/webdriver/ci" />
<LinkCard
title="Continuous Integration (CI)"
href="/start/develop/tests/webdriver/ci"
/>
[webdriver]: https://www.w3.org/TR/webdriver/
[`tauri-driver`]: https://crates.io/crates/tauri-driver

View File

@@ -17,15 +17,15 @@ Here is a sample to illustrate the configuration. This is not a complete `tauri.
```json title="src-tauri/tauri.conf.json"
{
"tauri": {
"bundle": {
"externalBin": [
"/absolute/path/to/sidecar",
"relative/path/to/binary",
"binaries/my-sidecar"
]
}
}
"tauri": {
"bundle": {
"externalBin": [
"/absolute/path/to/sidecar",
"relative/path/to/binary",
"binaries/my-sidecar"
]
}
}
}
```
@@ -54,29 +54,29 @@ rustc -Vv | Select-String "host:" | ForEach-Object {$_.Line.split(" ")[1]}
Here's a Node.js script to append the target triple to a binary:
```javascript
const execa = require('execa')
const fs = require('fs')
const execa = require('execa');
const fs = require('fs');
let extension = ''
let extension = '';
if (process.platform === 'win32') {
extension = '.exe'
extension = '.exe';
}
async function main() {
const rustInfo = (await execa('rustc', ['-vV'])).stdout
const targetTriple = /host: (\S+)/g.exec(rustInfo)[1]
if (!targetTriple) {
console.error('Failed to determine platform target triple')
}
fs.renameSync(
`src-tauri/binaries/sidecar${extension}`,
`src-tauri/binaries/sidecar-${targetTriple}${extension}`
)
const rustInfo = (await execa('rustc', ['-vV'])).stdout;
const targetTriple = /host: (\S+)/g.exec(rustInfo)[1];
if (!targetTriple) {
console.error('Failed to determine platform target triple');
}
fs.renameSync(
`src-tauri/binaries/sidecar${extension}`,
`src-tauri/binaries/sidecar-${targetTriple}${extension}`
);
}
main().catch((e) => {
throw e
})
throw e;
});
```
## Running it from Rust
@@ -116,8 +116,8 @@ In the JavaScript code, import the `Command` class from the `@tauri-apps/plugin-
```javascript
import { Command } from '@tauri-apps/plugin-shell';
// `binaries/my-sidecar` is the EXACT value specified on `tauri.conf.json > tauri > bundle > externalBin`
const sidecar_command = Command.sidecar('binaries/my-sidecar')
const output = await sidecar_command.execute()
const sidecar_command = Command.sidecar('binaries/my-sidecar');
const output = await sidecar_command.execute();
```
## Passing arguments
@@ -130,38 +130,38 @@ First, define the arguments that need to be passed to the sidecar command in `sr
```json title="src-tauri/capabilities/main.json" ins={14-31}
{
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
"description": "Capability for the main window",
"windows": ["main"],
"permissions": [
"path:default",
"event:default",
"window:default",
"app:default",
"resources:default",
"menu:default",
"tray:default",
{
"identifier": "shell:allow-execute",
"allow": [
{
"args": [
"arg1",
"-a",
"--arg2",
{
"validator": "\\S+"
},
],
"cmd": "",
"name": "binaries/my-sidecar",
"sidecar": true
}
]
},
"shell:allow-open"
]
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
"description": "Capability for the main window",
"windows": ["main"],
"permissions": [
"path:default",
"event:default",
"window:default",
"app:default",
"resources:default",
"menu:default",
"tray:default",
{
"identifier": "shell:allow-execute",
"allow": [
{
"args": [
"arg1",
"-a",
"--arg2",
{
"validator": "\\S+"
}
],
"cmd": "",
"name": "binaries/my-sidecar",
"sidecar": true
}
]
},
"shell:allow-open"
]
}
```
@@ -192,25 +192,20 @@ import { Command } from '@tauri-apps/plugin-shell';
// `binaries/my-sidecar` is the EXACT value specified on `tauri.conf.json > tauri > bundle > externalBin`
// notice that the args array matches EXACTLY what is specified on `tauri.conf.json`.
const command = Command.sidecar('binaries/my-sidecar', [
'arg1',
'-a',
'--arg2',
'any-string-that-matches-the-validator',
])
const output = await command.execute()
'arg1',
'-a',
'--arg2',
'any-string-that-matches-the-validator',
]);
const output = await command.execute();
```
:::note
Example: For a set of arguments like: `-i /path/to/input.png -o /path/to/output.txt`, the arguments array would look like
```json
[
"-i",
{"validator": "\\S+"},
"-o",
{"validator": "\\S+"}
]
["-i", { "validator": "\\S+" }, "-o", { "validator": "\\S+" }]
```
Here, the first and third arguments are static (`-i` and `-o`), but the second and fourth are dynamic and match the regex pattern described (`\\S+` means anything except space).

View File

@@ -82,7 +82,7 @@ en Rust:
Consulta todas las [Opciones de diálogo](/reference/javascript/dialog/) en la referencia de la API de JavaScript.
{ /* ASK */}
{/* ASK */}
#### Crear un diálogo de Si/No
@@ -101,7 +101,7 @@ console.log(answer);
// Imprime un booleano en la consola
```
{ /* CONFIRM */}
{/* CONFIRM */}
#### Crear un diálogo de Ok/Cancelar
@@ -120,7 +120,7 @@ console.log(confirmation);
// Imprime un booleano en la consola
```
{ /* MESSAGE */}
{/* MESSAGE */}
#### Crear un diálogo de mensaje
@@ -133,7 +133,7 @@ import { message } from '@tauri-apps/plugin-dialog';
await message('File not found', { title: 'Tauri', type: 'error' });
```
{ /* OPEN */}
{/* OPEN */}
#### Abrir un diálogo de selección de archivos
@@ -153,7 +153,7 @@ console.log(file);
// Imprime la ruta y el nombre del archivo en la consola
```
{ /* SAVE */}
{/* SAVE */}
#### Diálogo de guardar en archivo

View File

@@ -41,9 +41,9 @@ Conceptualmente Tauri desempeña el rol de un servidor web estático. Necesitas
Debajo puedes consultar una checklist de escenarios comunes al integrar un frontend con Tauri:
{ /* TODO: Link to core concept of SSG/SSR, etc. */}
{ /* TODO: Link to mobile development server guide */}
{ /* TODO: Concept of how to do a client-server relationship? */}
{/* TODO: Link to core concept of SSG/SSR, etc. */}
{/* TODO: Link to mobile development server guide */}
{/* TODO: Concept of how to do a client-server relationship? */}
- Usa la generación de sitios estáticos (SSG). Tauri no soporta alternativas basadas en servidores de manera oficial (como SSR).
- Para el desarrollo de apps móviles, es necesario un servidor de desarrollo de algun tipo para servir el frontend desde tu IP interna.

View File

@@ -34,8 +34,8 @@ Aprende más sobre Nuxt en https://nuxt.com. Esta guía es precisa a partir de N
}
```
</TabItem>
<TabItem label="yarn">
</TabItem>
<TabItem label="yarn">
```json
// tauri.conf.json
@@ -49,8 +49,8 @@ Aprende más sobre Nuxt en https://nuxt.com. Esta guía es precisa a partir de N
}
```
</TabItem>
<TabItem label="pnpm">
</TabItem>
<TabItem label="pnpm">
```json
// tauri.conf.json
@@ -64,7 +64,8 @@ Aprende más sobre Nuxt en https://nuxt.com. Esta guía es precisa a partir de N
}
```
</TabItem>
</TabItem>
</Tabs>
2. Actualiza la configuración de Nuxt:

View File

@@ -23,8 +23,8 @@ Sigue el enlace para comenzar según tu sistema operativo:
Tauri requiere varias dependencias del sistema para el desarrollo en Linux. Estas pueden ser diferentes dependiendo de su distribución, pero hemos incluido algunas distribuciones populares a continuación para ayudarlo a configurar.
{ /* Note: These are the officially supported linux distributions. */}
{ /* If you wish to add another please open an issue to discuss prior to opening a PR */}
{/* Note: These are the officially supported linux distributions. */}
{/* If you wish to add another please open an issue to discuss prior to opening a PR */}
<Tabs>
<TabItem label="Debian">
@@ -184,7 +184,7 @@ Aquí está el archivo como un script plano: [rustup.sh](https://sh.rustup.rs/)
</TabItem>
<TabItem label="Windows">
Visita https://www.rust-lang.org/tools/install para instalar `rustup`.
Visita https://www.rust-lang.org/tools/install para instalar `rustup`.
</TabItem>
</Tabs>
@@ -205,7 +205,7 @@ Si deseas compilar tu aplicación para Android o iOS, entonces hay algunas depen
1. Descarga e instala [Android Studio desde el sitio web de Android Developers](https://developer.android.com/studio)
2. Establece la variable de entorno `JAVA_HOME`:
{ /* TODO: Can this be done in the 4th step? */}
{/* TODO: Can this be done in the 4th step? */}
<Tabs>
<TabItem label="Linux">
@@ -240,7 +240,7 @@ export JAVA_HOME="/Applications/Android Studio.app/Contents/jbr/Contents/Home"
4. Establece las variables de entorno `ANDROID_HOME` y `NDK_HOME`. Reemplaza los números de versión para que coincidan con la versión instalada.
{ /* TODO: Does the version number change below? */}
{/* TODO: Does the version number change below? */}
<Tabs>
<TabItem label="Linux">
@@ -261,7 +261,7 @@ export NDK_HOME="$ANDROID_HOME/ndk/25.0.8775105"
</TabItem>
<TabItem label="Windows">
{ /* TODO: Do we need a note about this version? */}
{/* TODO: Do we need a note about this version? */}
```ps
[System.Environment]::SetEnvironmentVariable("ANDROID_HOME", "$env:LocalAppData\Android\Sdk", "User")
@@ -284,9 +284,9 @@ rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-andro
</TabItem>
<TabItem label="Windows">
```ps
rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android
```
```ps
rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android
```
</TabItem>
</Tabs>

View File

@@ -11,5 +11,8 @@ import { LinkCard, CardGrid } from '@astrojs/starlight/components';
href="/fr/develop/Debug/application//"
/>
<LinkCard title="Débogage dans VS Code" href="/fr/develop/Debug/vscode" />
<LinkCard title="Débogage dans RustRover" href="/fr/develop/Debug/rustrover" />
<LinkCard
title="Débogage dans RustRover"
href="/fr/develop/Debug/rustrover"
/>
</CardGrid>

View File

@@ -42,9 +42,9 @@ Théoriquement, Tauri agit comme un hôte web statique. Vous avez besoin de four
Ci-dessous se trouve une liste des scénarios communs nécessaires pour intégrer un frontend avec Tauri :
{ /* TODO: Link to core concept of SSG/SSR, etc. */}
{ /* TODO: Link to mobile development server guide */}
{ /* TODO: Concept of how to do a client-server relationship? */}
{/* TODO: Link to core concept of SSG/SSR, etc. */}
{/* TODO: Link to mobile development server guide */}
{/* TODO: Concept of how to do a client-server relationship? */}
- Utilisez la génération statique de site (SSG). Tauri ne supporte pas officiellent les solutions basées sur serveur (par exemple SSR).
- Pour le développement mobile, un serveur de développement d'un certain type est nécessaire pour héberger le frontend sur votre IP locale.

View File

@@ -34,8 +34,8 @@ Apprenez-en plus au sujet de Nuxt sur https://nuxt.com. Ce guide est valable à
}
```
</TabItem>
<TabItem label="yarn">
</TabItem>
<TabItem label="yarn">
```json
// tauri.conf.json
@@ -49,8 +49,8 @@ Apprenez-en plus au sujet de Nuxt sur https://nuxt.com. Ce guide est valable à
}
```
</TabItem>
<TabItem label="pnpm">
</TabItem>
<TabItem label="pnpm">
```json
// tauri.conf.json
@@ -64,7 +64,8 @@ Apprenez-en plus au sujet de Nuxt sur https://nuxt.com. Ce guide est valable à
}
```
</TabItem>
</TabItem>
</Tabs>
2. Mettez à jour la configuration de Nuxt :

View File

@@ -23,8 +23,8 @@ Suivez les liens pour votre système d'exploitation:
Tauri exige un système varié de dépendances pour le développement sur Linux. Celles-ci peuvent être différentes selon votre distribution, mais nous avons inclus quelques distributions populaires ci-dessous pour vous aider durant l'installation.
{ /* Note: These are the officially supported linux distributions. */}
{ /* If you wish to add another please open an issue to discuss prior to opening a PR */}
{/* Note: These are the officially supported linux distributions. */}
{/* If you wish to add another please open an issue to discuss prior to opening a PR */}
<Tabs>
<TabItem label="Debian">
@@ -187,7 +187,7 @@ Voici le fichier contenant le script: [rustup.sh](https://sh.rustup.rs/)
</TabItem>
<TabItem label="Windows">
Visitez https://www.rust-lang.org/tools/install pour installer `rustup`.
Visitez https://www.rust-lang.org/tools/install pour installer `rustup`.
</TabItem>
</Tabs>
@@ -208,7 +208,7 @@ Si vous vouler que votre application soit utilisable sur Android et iOS, il faut
1. Téléchargez et installez [Android Studio à partir du site Android Developers](https://developer.android.com/studio)
2. Configurez la variable d'environement `JAVA_HOME`:
{ /* TODO: Can this be done in the 4th step? */}
{/* TODO: Can this be done in the 4th step? */}
<Tabs>
<TabItem label="Linux">
@@ -243,7 +243,7 @@ export JAVA_HOME="/Applications/Android Studio.app/Contents/jbr/Contents/Home"
4. Configurez les variables d'environemment `ANDROID_HOME` et `NDK_HOME`
{ /* TODO: Does the version number change below? */}
{/* TODO: Does the version number change below? */}
<Tabs>
<TabItem label="Linux and macOS">
@@ -256,7 +256,7 @@ export NDK_HOME="$ANDROID_HOME/ndk/25.0.8775105"
</TabItem>
<TabItem label="Windows">
{ /* TODO: Do we need a note about this version? */}
{/* TODO: Do we need a note about this version? */}
```ps
[System.Environment]::SetEnvironmentVariable("ANDROID_HOME", "$env:LocalAppData\Android\Sdk", "User")
@@ -279,9 +279,9 @@ rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-andro
</TabItem>
<TabItem label="Windows">
```ps
rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android
```
```ps
rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android
```
</TabItem>
</Tabs>

View File

@@ -37,9 +37,9 @@ import Cta from '@fragments/cta.mdx';
</div>
<div class="lp-cta-card">
<Card title="Create a Project" icon="rocket">
<Cta/>
</Card>
<Card title="Create a Project" icon="rocket">
<Cta />
</Card>
</div>
<CardGrid>

View File

@@ -35,11 +35,11 @@ Install the CLI plugin to get started.
{' '}
<CommandTabs
npm="npm run tauri add cli"
yarn="yarn run tauri add cli"
pnpm="pnpm tauri add cli"
cargo="cargo tauri add cli"
/>
npm="npm run tauri add cli"
yarn="yarn run tauri add cli"
pnpm="pnpm tauri add cli"
cargo="cargo tauri add cli"
/>
</TabItem>
<TabItem label="Manual">
@@ -70,10 +70,10 @@ Install the CLI plugin to get started.
3. Install the JavaScript Guest bindings using your preferred JavaScript package manager:
<CommandTabs
npm="npm install @tauri-apps/plugin-cli"
yarn="yarn add @tauri-apps/plugin-cli"
pnpm="pnpm add @tauri-apps/plugin-cli"
/>
npm="npm install @tauri-apps/plugin-cli"
yarn="yarn add @tauri-apps/plugin-cli"
pnpm="pnpm add @tauri-apps/plugin-cli"
/>
</Steps>
</TabItem>
@@ -126,7 +126,7 @@ All JSON configurations here are just samples, many other fields have been omitt
The `args` array represents the list of arguments accepted by its command or subcommand.
{ /* TODO: List available configuration */}
{/* TODO: List available configuration */}
### Positional Arguments

View File

@@ -85,7 +85,7 @@ in Rust:
See all [Dialog Options](/reference/javascript/dialog/) at the JavaScript API reference.
{ /* ASK */}
{/* ASK */}
#### Create Yes/No Dialog
@@ -104,7 +104,7 @@ console.log(answer);
// Prints boolean to the console
```
{ /* CONFIRM */}
{/* CONFIRM */}
#### Create Ok/Cancel Dialog
@@ -123,7 +123,7 @@ console.log(confirmation);
// Prints boolean to the console
```
{ /* MESSAGE */}
{/* MESSAGE */}
#### Create Message Dialog
@@ -136,7 +136,7 @@ import { message } from '@tauri-apps/plugin-dialog';
await message('File not found', { title: 'Tauri', kind: 'error' });
```
{ /* OPEN */}
{/* OPEN */}
#### Open a File Selector Dialog
@@ -156,7 +156,7 @@ console.log(file);
// Prints file path and name to the console
```
{ /* SAVE */}
{/* SAVE */}
#### Save to File Dialog

View File

@@ -84,27 +84,27 @@ Install the log plugin to get started.
<Steps>
1. First, you need to register the plugin with Tauri.
1. First, you need to register the plugin with Tauri.
```rust title="src-tauri/src/lib.rs" {1} {6-14}
use tauri_plugin_log::{Target, TargetKind};
```rust title="src-tauri/src/lib.rs" {1} {6-14}
use tauri_plugin_log::{Target, TargetKind};
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.plugin(
tauri_plugin_log::Builder::new()
.targets([
Target::new(TargetKind::Stdout),
Target::new(TargetKind::LogDir { file_name: None }),
Target::new(TargetKind::Webview),
])
.build(),
)
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
```
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.plugin(
tauri_plugin_log::Builder::new()
.targets([
Target::new(TargetKind::Stdout),
Target::new(TargetKind::LogDir { file_name: None }),
Target::new(TargetKind::Webview),
])
.build(),
)
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
```
2. Afterwards, all the plugin's APIs are available through the JavaScript guest bindings:

View File

@@ -90,24 +90,25 @@ Additional setup is required to get tray-relative positions to work.
tauri-plugin-positioner = { version = "2.0.0-beta", features = ["tray-icon"] }
```
2. Setup `on_tray_event` for positioner plugin:
```rust title="src-tauri/src/lib.rs" ins={4-12}
fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_positioner::init())
// This is required to get tray-relative positions to work
.setup(|app| {
TrayIconBuilder::new()
.on_tray_icon_event(|app, event| {
tauri_plugin_positioner::on_tray_event(app.app_handle(), &event);
})
.build(app)?;
Ok(())
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
```
2. Setup `on_tray_event` for positioner plugin:
```rust title="src-tauri/src/lib.rs" ins={4-12}
fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_positioner::init())
// This is required to get tray-relative positions to work
.setup(|app| {
TrayIconBuilder::new()
.on_tray_icon_event(|app, event| {
tauri_plugin_positioner::on_tray_event(app.app_handle(), &event);
})
.build(app)?;
Ok(())
})
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
```
</Steps>
## Usage

View File

@@ -78,9 +78,9 @@ The closure has three arguments:
<Steps>
1. **`app` :** The [AppHandle](https://docs.rs/tauri/latest/tauri/struct.AppHandle.html) of the application.
2. **`args` :** The list of arguments, that was passed by the user to initiate this new instance.
3. **`cwd` :** The Current Working Directory denotes the directory from which the new application instance was launched.
1. **`app` :** The [AppHandle](https://docs.rs/tauri/latest/tauri/struct.AppHandle.html) of the application.
2. **`args` :** The list of arguments, that was passed by the user to initiate this new instance.
3. **`cwd` :** The Current Working Directory denotes the directory from which the new application instance was launched.
</Steps>

View File

@@ -230,24 +230,21 @@ See [Access Control List](/reference/acl/) for more information.
```json title="src-tauri/capabilities/main.json" ins={7-8}
{
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "main-capability",
"description": "Capability for the main window",
"windows": ["main"],
"permissions": [
"sql:allow-load",
"sql:allow-execute",
]
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "main-capability",
"description": "Capability for the main window",
"windows": ["main"],
"permissions": ["sql:allow-load", "sql:allow-execute"]
}
```
| Permission | Description |
|------|-----|
|`sql:allow-close`|Enables the close command without any pre-configured scope.|
|`sql:deny-close`|Denies the close command without any pre-configured scope.|
|`sql:allow-execute`|Enables the execute command without any pre-configured scope.|
|`sql:deny-execute`|Denies the execute command without any pre-configured scope.|
|`sql:allow-load`|Enables the load command without any pre-configured scope.|
|`sql:deny-load`|Denies the load command without any pre-configured scope.|
|`sql:allow-select`|Enables the select command without any pre-configured scope.|
|`sql:deny-select`|Denies the select command without any pre-configured scope.|
| Permission | Description |
| ------------------- | ------------------------------------------------------------- |
| `sql:allow-close` | Enables the close command without any pre-configured scope. |
| `sql:deny-close` | Denies the close command without any pre-configured scope. |
| `sql:allow-execute` | Enables the execute command without any pre-configured scope. |
| `sql:deny-execute` | Denies the execute command without any pre-configured scope. |
| `sql:allow-load` | Enables the load command without any pre-configured scope. |
| `sql:deny-load` | Denies the load command without any pre-configured scope. |
| `sql:allow-select` | Enables the select command without any pre-configured scope. |
| `sql:deny-select` | Denies the select command without any pre-configured scope. |

View File

@@ -142,9 +142,9 @@ See [Access Control List](/reference/acl/) for more information.
}
```
| Permission | Description |
| ----------------------------------------- | -------------------------------------------------------------------------- |
| `window-state:allow-restore-state` | Enables the restore_state command without any pre-configured scope. |
| `window-state:deny-restore-state` | Denies the restore_state command without any pre-configured scope. |
| `window-state:allow-save-window-state` | Enables the save_window_state command without any pre-configured scope. |
| `window-state:deny-save-window-state` | Denies the save_window_state command without any pre-configured scope. |
| Permission | Description |
| -------------------------------------- | ----------------------------------------------------------------------- |
| `window-state:allow-restore-state` | Enables the restore_state command without any pre-configured scope. |
| `window-state:deny-restore-state` | Denies the restore_state command without any pre-configured scope. |
| `window-state:allow-save-window-state` | Enables the save_window_state command without any pre-configured scope. |
| `window-state:deny-save-window-state` | Denies the save_window_state command without any pre-configured scope. |

View File

@@ -588,7 +588,6 @@ Options:
```
## `capability`
<CommandTabs

View File

@@ -35,23 +35,23 @@ We recommend starting with the vanilla template (HTML, CSS, and JavaScript witho
:::
{ /* TODO: Can CTA offer to install the deps? */}
{/* TODO: Can CTA offer to install the deps? */}
After `create-tauri-app` has complete you can navigate into your project's folder, install dependencies, then use the [Tauri CLI](/reference/cli) to start the development server:
import CommandTabs from '@components/CommandTabs.astro';
<CommandTabs
npm="cd tauri-app
npm="cd tauri-app
npm install
npm run tauri dev"
yarn="cd tauri-app
yarn="cd tauri-app
yarn install
yarn tauri dev"
pnpm="cd tauri-app
pnpm="cd tauri-app
pnpm install
pnpm tauri dev"
cargo="cd tauri-app
cargo="cd tauri-app
cargo tauri dev"
/>

View File

@@ -18,9 +18,9 @@ Conceptually Tauri acts as a static web host. You need to provide Tauri with a f
Below is a checklist of common scenarios needed to integrate a frontend with Tauri:
{ /* TODO: Link to core concept of SSG/SSR, etc. */}
{ /* TODO: Link to mobile development server guide */}
{ /* TODO: Concept of how to do a client-server relationship? */}
{/* TODO: Link to core concept of SSG/SSR, etc. */}
{/* TODO: Link to mobile development server guide */}
{/* TODO: Concept of how to do a client-server relationship? */}
- Use static site generation (SSG), single-page applications (SPA), or classic multi-page apps (MPA). Tauri does not natively support server based alternatives (such as SSR).
- For mobile development, a development server of some kind is necessary that can host the frontend on your internal IP.
@@ -28,7 +28,7 @@ Below is a checklist of common scenarios needed to integrate a frontend with Tau
## JavaScript
{ /* TODO: Help me with the wording here lol */}
{/* TODO: Help me with the wording here lol */}
For most projects we recommend [Vite](https://vitejs.dev/) for SPA frameworks such as React, Vue, Svelte, and Solid, but also for plain JavaScript or TypeScript projects. Most other guides listed here show how to use Meta-Frameworks as they are typically designed for SSR and therefore require special configuration.
<CardGrid>
@@ -36,10 +36,7 @@ For most projects we recommend [Vite](https://vitejs.dev/) for SPA frameworks su
<LinkCard title="Nuxt" href="/start/frontend/nuxt/" />
<LinkCard title="Qwik" href="/start/frontend/qwik/" />
<LinkCard title="SvelteKit" href="/start/frontend/sveltekit/" />
<LinkCard
title="Vite (recommended)"
href="/start/frontend/vite/"
/>
<LinkCard title="Vite (recommended)" href="/start/frontend/vite/" />
<LinkCard title="Webpack" href="/start/frontend/webpack/" />
</CardGrid>

View File

@@ -34,8 +34,8 @@ Learn more about Nuxt at https://nuxt.com. This guide is accurate as of Nuxt 3.7
}
```
</TabItem>
<TabItem label="yarn">
</TabItem>
<TabItem label="yarn">
```json
// tauri.conf.json
@@ -49,8 +49,8 @@ Learn more about Nuxt at https://nuxt.com. This guide is accurate as of Nuxt 3.7
}
```
</TabItem>
<TabItem label="pnpm">
</TabItem>
<TabItem label="pnpm">
```json
// tauri.conf.json
@@ -64,7 +64,8 @@ Learn more about Nuxt at https://nuxt.com. This guide is accurate as of Nuxt 3.7
}
```
</TabItem>
</TabItem>
</Tabs>
2. Update Nuxt configuration:

View File

@@ -53,11 +53,11 @@ fn main() {
The Tauri v2 CLI includes a `migrate` command that automates most of the process and helps you finish the migration:
<CommandTabs
npm="npm install @tauri-apps/cli@next
npm="npm install @tauri-apps/cli@next
npm run tauri migrate"
yarn="yarn upgrade @tauri-apps/cli --next
yarn="yarn upgrade @tauri-apps/cli --next
yarn tauri migrate"
pnpm="pnpm update @tauri-apps/cli@next
pnpm="pnpm update @tauri-apps/cli@next
pnpm tauri migrate"
cargo='cargo install tauri-cli --version "^2.0.0-beta"
cargo tauri migrate'
@@ -1159,7 +1159,6 @@ On the JavaScript side, the `WebviewWindow` class is now exported in the `@tauri
The `onMenuClicked` function was removed, you can intercept menu events when creating a menu in JavaScript instead.
### Migrate Embedded External Binaries (Sidecar)
In Tauri v1, the external binaries and their arguments were defined in the allowlist. In v2, use the new permissions system. Read [Migrate Permissions](#migrate-permissions) for more information.

View File

@@ -13,16 +13,7 @@ Learn about common scenarios and steps to upgrade from Tauri 1.0 or migrate from
import { LinkCard, CardGrid } from '@astrojs/starlight/components';
<CardGrid>
<LinkCard
title="Upgrade from Tauri 1.0"
href="/start/migrate/from-tauri-1"
/>
<LinkCard
title="Migrate from Electron"
href="/start/migrate/from-electron"
/>
<LinkCard
title="Migrate from Flutter"
href="/start/migrate/from-flutter"
/>
<LinkCard title="Upgrade from Tauri 1.0" href="/start/migrate/from-tauri-1" />
<LinkCard title="Migrate from Electron" href="/start/migrate/from-electron" />
<LinkCard title="Migrate from Flutter" href="/start/migrate/from-flutter" />
</CardGrid>

View File

@@ -25,8 +25,8 @@ Follow the link to get started for your respective operating system:
Tauri requires various system dependencies for development on Linux. These may be different depending on your distribution but we've included some popular distributions below to help you get setup.
{ /* Note: These are the officially supported linux distributions. */}
{ /* If you wish to add another please open an issue to discuss prior to opening a PR */}
{/* Note: These are the officially supported linux distributions. */}
{/* If you wish to add another please open an issue to discuss prior to opening a PR */}
<Tabs>
<TabItem label="Debian">
@@ -186,7 +186,7 @@ Here is the file as a plain script: [rustup.sh](https://sh.rustup.rs/)
</TabItem>
<TabItem label="Windows">
Visit https://www.rust-lang.org/tools/install to install `rustup`.
Visit https://www.rust-lang.org/tools/install to install `rustup`.
</TabItem>
</Tabs>
@@ -230,7 +230,7 @@ If you'd like to target your app for Android or iOS then there are a few additio
1. Download and install [Android Studio from the Android Developers website](https://developer.android.com/studio)
2. Set the `JAVA_HOME` environment variable:
{ /* TODO: Can this be done in the 4th step? */}
{/* TODO: Can this be done in the 4th step? */}
<Tabs>
<TabItem label="Linux">

View File

@@ -250,7 +250,7 @@ class ExamplePlugin: Plugin {
Tauri 自动为插件实现了两个命令:`checkPermissions` 和 `requestPermissions`。这些命令可以从 JavaScript 或 Rust 中直接调用。
{ /* TODO: PermissionState type should be exported in Tauri */}
{/* TODO: PermissionState type should be exported in Tauri */}
<Tabs>
<TabItem label="JavaScript">
@@ -317,7 +317,7 @@ impl<R: Runtime> Notification<R> {
## 插件事件
{ /* TODO: Is this section a duplicate of Lifecycle Events above? */}
{/* TODO: Is this section a duplicate of Lifecycle Events above? */}
插件可以使用 `trigger` 函数在任何时候触发事件:

View File

@@ -3,11 +3,11 @@ title: 插件开发
i18nReady: true
---
{ /* TODO: Add a CLI section */}
{/* TODO: Add a CLI section */}
import CommandTabs from '@components/CommandTabs.astro';
{ /* TODO: Link to windowing system, commands for sending messages, and event system */}
{/* TODO: Link to windowing system, commands for sending messages, and event system */}
:::tip[插件开发]
@@ -24,11 +24,11 @@ Tauri 提供了一个基于 webview 功能的视窗系统,一个在 Rust 进
同时,一个插件项目可以包含一个 Android 库项目和/或一个用于 iOS 的 Swift 包。
你可以查阅[移动端插件开发指南](/zh-cn/develop/plugins/develop-mobile)以获取更多关于开发安卓或 iOS 插件的信息。
{ /* TODO: https://github.com/tauri-apps/tauri/issues/7749 */}
{/* TODO: https://github.com/tauri-apps/tauri/issues/7749 */}
## 命名规范
{ /* TODO: Add link to allowlist */}
{/* TODO: Add link to allowlist */}
Tauri 插件具有一个前缀Rust 包使用 `tauri-plugin-` 前缀NPM 包使用 `@tauri-apps/plugin-` 前缀),随后是插件名称。
插件名称由插件配置中的 [`tauri.conf.json > plugin`](/reference/config/#pluginconfig) 和许可列表中的配置确定。
@@ -40,11 +40,11 @@ Tauri 插件具有一个前缀Rust 包使用 `tauri-plugin-` 前缀NPM 包
要引导创建一个新的插件项目,请运行 `plugin init`。如果不需要相应的 NPM 程序包,请使用 `--no-api` 命令行标志。
<CommandTabs
npm="npm run tauri plugin init"
yarn="yarn tauri plugin init"
pnpm="pnpm tauri plugin init"
cargo="cargo tauri plugin init"
/>
npm="npm run tauri plugin init"
yarn="yarn tauri plugin init"
pnpm="pnpm tauri plugin init"
cargo="cargo tauri plugin init"
/>
这会初始化插件,并且生成如下所示的代码:
@@ -63,7 +63,7 @@ Tauri 插件具有一个前缀Rust 包使用 `tauri-plugin-` 前缀NPM 包
└── package.json - NPM 包元数据
```
{ /* TODO: https://github.com/tauri-apps/tauri/issues/7749 */}
{/* TODO: https://github.com/tauri-apps/tauri/issues/7749 */}
如果你有一个现有的插件,并且想添加 Android 或 iOS 功能,你可以使用 `plugin android add` 和 `plugin ios add` 来引导移动端库项目,并指导你完成所需的更改。

View File

@@ -31,11 +31,11 @@ _这个插件要求 Rust 版本至少是 **1.75**_
{' '}
<CommandTabs
npm="npm run tauri add cli"
yarn="yarn run tauri add cli"
pnpm="pnpm tauri add cli"
cargo="cargo tauri add cli"
/>
npm="npm run tauri add cli"
yarn="yarn run tauri add cli"
pnpm="pnpm tauri add cli"
cargo="cargo tauri add cli"
/>
</TabItem>
<TabItem label="手动">

View File

@@ -82,7 +82,7 @@ import CommandTabs from '@components/CommandTabs.astro';
可以在 JavaScript API 参考中查看所有 [Dialog 选项](/reference/javascript/dialog/)。
{ /* ASK */}
{/* ASK */}
#### 创建 Yes/No 对话框
@@ -101,7 +101,7 @@ console.log(answer);
// Prints boolean to the console
```
{ /* CONFIRM */}
{/* CONFIRM */}
#### 创建 Ok/Cancel 对话框
@@ -120,7 +120,7 @@ console.log(confirmation);
// Prints boolean to the console
```
{ /* MESSAGE */}
{/* MESSAGE */}
#### 创建 Message 对话框
@@ -133,7 +133,7 @@ import { message } from '@tauri-apps/plugin-dialog';
await message('File not found', { title: 'Tauri', type: 'error' });
```
{ /* OPEN */}
{/* OPEN */}
#### 打开一个文件选择对话框

View File

@@ -23,20 +23,14 @@ Tauri 与前端无关,支持大多数开箱即用的前端框架。但是,
<LinkCard title="Qwik" href="/zh-cn/start/frontend/qwik" />
<LinkCard title="Svelte" href="/zh-cn/start/frontend/svelte" />
<LinkCard title="Vite" href="/zh-cn/start/frontend/vite" />
<LinkCard
title="Webpack"
href="/zh-cn/start/frontend/webpack"
/>
<LinkCard title="Webpack" href="/zh-cn/start/frontend/webpack" />
</CardGrid>
## Rust
<CardGrid>
<LinkCard title="Leptos" href="/zh-cn/start/frontend/leptos" />
<LinkCard
title="Sycamore"
href="/zh-cn/start/frontend/sycamore"
/>
<LinkCard title="Sycamore" href="/zh-cn/start/frontend/sycamore" />
<LinkCard title="Trunk" href="/zh-cn/start/frontend/trunk" />
<LinkCard title="Yew" href="/zh-cn/start/frontend/yew" />
</CardGrid>

View File

@@ -23,8 +23,8 @@ import { Tabs, TabItem, Card } from '@astrojs/starlight/components';
Tauri 在 Linux 上进行开发需要各种系统依赖项。这些可能会有所不同,具体取决于你的发行版,但我们在下面提供了一些流行的发行版来帮助你进行设置。
{ /* Note: These are the officially supported linux distributions. */}
{ /* If you wish to add another please open an issue to discuss prior to opening a PR */}
{/* Note: These are the officially supported linux distributions. */}
{/* If you wish to add another please open an issue to discuss prior to opening a PR */}
<Tabs>
<TabItem label="Debian">
@@ -207,7 +207,7 @@ curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
1. 从 Android Developers 网站下载并安装 [Android Studio](https://developer.android.com/studio)。
2. 设置 `JAVA_HOME` 环境变量:
{ /* TODO: Can this be done in the 4th step? */}
{/* TODO: Can this be done in the 4th step? */}
<Tabs>
<TabItem label="Linux">
@@ -242,7 +242,7 @@ export JAVA_HOME="/Applications/Android Studio.app/Contents/jbr/Contents/Home"
4. 配置 `ANDROID_HOME` 和 `NDK_HOME` 环境变量:
{ /* TODO: Does the version number change below? */}
{/* TODO: Does the version number change below? */}
<Tabs>
<TabItem label="Linux and macOS">
@@ -255,7 +255,7 @@ export NDK_HOME="$ANDROID_HOME/ndk/25.0.8775105"
</TabItem>
<TabItem label="Windows">
{ /* TODO: Do we need a note about this version? */}
{/* TODO: Do we need a note about this version? */}
```ps
[System.Environment]::SetEnvironmentVariable("ANDROID_HOME", "$env:LocalAppData\Android\Sdk", "User")