Skip to content

v2 migration: guides/development to next #1670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export default defineConfig({
items: [
{
label: 'Develop',
link: 'guides/develop',
autogenerate: { directory: 'guides/develop' },
},
{
label: 'Debug',
Expand Down Expand Up @@ -227,5 +227,23 @@ export default defineConfig({
'/blog/2023/06/14/tauri-1-4': '/blog/tauri-1-4',
'/blog/2023/06/15/tauri-board-elections-and-governance-updates':
'/blog/tauri-board-elections-and-governance-updates',
//
// v1 /guides/development -> /guides/develop
'/v1/guides/development/development-cycle': '/guides/develop/development-cycle',
'/v1/guides/development/updating-dependencies': '/guides/develop/updating-dependencies',
// i18n fr
'/fr/v1/guides/development/development-cycle/': '/fr/guides/develop/development-cycle/',
'/fr/v1/guides/development/updating-dependencies/': '/fr/guides/develop/updating-dependencies/',
// i18n ko
'/ko/v1/guides/development/development-cycle/': '/ko/guides/develop/development-cycle/',
'/ko/v1/guides/development/updating-dependencies/': '/ko/guides/develop/updating-dependencies/',
// i18n zh-cn
'/zh-cn/v1/guides/development/development-cycle/': '/zh-cn/guides/develop/development-cycle/',
'/zh-cn/v1/guides/development/updating-dependencies/': '/zh-cn/guides/develop/updating-dependencies/',
// i18n it
'/it/v1/guides/development/development-cycle/': '/it/guides/develop/development-cycle/',
'/it/v1/guides/development/updating-dependencies/': '/it/guides/develop/updating-dependencies/'
//
},
});

34 changes: 34 additions & 0 deletions src/content/docs/fr/guides/develop/development-cycle.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: Development Cycle
description: Concepts de base pour le développement avec Tauri
---

import CommandTabs from '@components/CommandTabs.astro';

### 1. Démarrez votre serveur de développement

Maintenant que tout est configuré, vous devez démarrer votre serveur de développement d'applications fourni par votre framework ou bundler d'interface utilisateur (en supposant que vous en utilisiez un, bien sûr).

:::note

Chaque framework possède ses propres outils de développement. Il n'entre pas dans le cadre de ce document de les couvrir tous ou de rester à jour.
:::

### 2. Démarrer la fenêtre de développement de Tauri

<CommandTabs
npm="npm run tauri dev"
yarn="yarn tauri dev"
pnpm="pnpm tauri dev"
cargo="cargo tauri dev"
/>

La première fois que vous exécutez cette commande, le gestionnaire de packages Rust prend plusieurs minutes pour télécharger et créer tous les packages requis. Comme ils sont mis en cache, les builds suivants sont beaucoup plus rapides, car seul votre code a besoin d'être reconstruit.

Une fois que Rust a terminé la construction, la vue Web s'ouvre et affiche votre application Web. Vous pouvez apporter des modifications à votre application Web, et si vos outils le permettent, la vue Web devrait se mettre à jour automatiquement, tout comme un navigateur. Lorsque vous apportez des modifications à vos fichiers Rust, ils sont reconstruits automatiquement et votre application redémarre automatiquement.

:::caution[À propos de Cargo.toml et du contrôle de code source]

Dans votre référentiel de projet, vous **DEVEZ** valider le `src-tauri/Cargo.lock` avec le `src-tauri/Cargo.toml` sur git car Cargo utilise le fichier de verrouillage pour fournir des versions déterministes. Par conséquent, il est recommandé que toutes les applications enregistrent leur `Cargo.lock`. Vous **NE DEVEZ PAS** valider le dossier `src-tauri/target` ou l'un de ses contenus.

:::
63 changes: 63 additions & 0 deletions src/content/docs/fr/guides/develop/updating-dependencies.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
title: Mise à jour des dépendances
description: Concepts de base pour le développement avec Tauri
---

import CommandTabs from '@components/CommandTabs.astro';

## Mettre à jour les packages npm

Si vous utilisez le package `tauri` :

<CommandTabs
npm="npm install @tauri-apps/cli@latest @tauri-apps/api@latest"
yarn="yarn up @tauri-apps/cli @tauri-apps/api"
pnpm="pnpm update @tauri-apps/cli @tauri-apps/api --latest"
/>

Vous pouvez également détecter la dernière version de Tauri sur la ligne de commande, en utilisant :


<CommandTabs
npm="npm outdated @tauri-apps/cli"
yarn="yarn outdated @tauri-apps/cli"
pnpm="pnpm outdated @tauri-apps/cli"
/>

Sinon, si vous utilisez l'approche `vue-cli-plugin-tauri` :

<CommandTabs
npm="npm install vue-cli-plugin-tauri@latest"
yarn="yarn up vue-cli-plugin-tauri"
pnpm="pnpm update vue-cli-plugin-tauri --latest"
/>

## Mettre à jour les packages Cargo

Vous pouvez vérifier les packages obsolètes avec [`cargo outdated`][] ou sur les pages crates.io : [tauri][] / [tauri-build][].

Accédez à `src-tauri/Cargo.toml` et remplacez `tauri` et `tauri-build` par

```toml
[build-dependencies]
tauri-build = "%version%"

[dependencies]
tauri = { version = "%version%" }
```

où `%version%` est le numéro de version correspondant ci-dessus.

Ensuite, procédez comme suit :

```shell
cd src-tauri
cargo update
```

Vous pouvez également exécuter la commande `cargo upgrade` fournie par [cargo-edit][] qui fait tout cela automatiquement.

[`cargo outdated`]: https://github.com/kbknapp/cargo-outdated
[tauri]: https://crates.io/crates/tauri/versions
[tauri-build]: https://crates.io/crates/tauri-build/versions
[cargo-edit]: https://github.com/killercup/cargo-edit
11 changes: 0 additions & 11 deletions src/content/docs/guides/develop.mdx

This file was deleted.

36 changes: 36 additions & 0 deletions src/content/docs/guides/develop/development-cycle.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: Development Cycle
description: Core concepts for developing with Tauri.
---
{/*TODO: REVISE COPY TO V2 */}

import CommandTabs from '@components/CommandTabs.astro';

### 1. Start Your Dev server

Now that you have everything set up, you should start your application development server provided by your UI framework or bundler (assuming you're using one, of course).

:::note

Every framework has its own development tooling. It is outside of the scope of this document to cover them all or stay up to date.
:::

### 2. Start Tauri Development Window


<CommandTabs
npm="npm run tauri dev"
yarn="yarn tauri dev"
pnpm="pnpm tauri dev"
cargo="cargo tauri dev"
/>

The first time you run this command, the Rust package manager takes several minutes to download and build all the required packages. Since they are cached, subsequent builds are much faster, as only your code needs rebuilding.

Once Rust has finished building, the webview opens, displaying your web app. You can make changes to your web app, and if your tooling enables it, the webview should update automatically, just like a browser. When you make changes to your Rust files, they are rebuilt automatically, and your app automatically restarts.

:::caution[About Cargo.toml and Source Control]

In your project repository, you **SHOULD** commit the `src-tauri/Cargo.lock` along with the `src-tauri/Cargo.toml` to git because Cargo uses the lockfile to provide deterministic builds. As a result, it is recommended that all applications check in their `Cargo.lock`. You **SHOULD NOT** commit the `src-tauri/target` folder or any of its contents.

:::
65 changes: 65 additions & 0 deletions src/content/docs/guides/develop/updating-dependencies.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
title: Updating Dependencies
description: Core concepts for developing with Tauri.
---
{/*TODO: REVISE COPY TO V2 */}

import CommandTabs from '@components/CommandTabs.astro';

## Update npm Packages

If you are using the `tauri` package:

<CommandTabs
npm="npm install @tauri-apps/cli@latest @tauri-apps/api@latest"
yarn="yarn up @tauri-apps/cli @tauri-apps/api"
pnpm="pnpm update @tauri-apps/cli @tauri-apps/api --latest"
/>

You can also detect what the latest version of Tauri is on the command line, using:


<CommandTabs
npm="npm outdated @tauri-apps/cli"
yarn="yarn outdated @tauri-apps/cli"
pnpm="pnpm outdated @tauri-apps/cli"
/>


Alternatively, if you are using the `vue-cli-plugin-tauri` approach:

<CommandTabs
npm="npm install vue-cli-plugin-tauri@latest"
yarn="yarn up vue-cli-plugin-tauri"
pnpm="pnpm update vue-cli-plugin-tauri --latest"
/>

## Update Cargo Packages

You can check for outdated packages with [`cargo outdated`] or on the crates.io pages: [tauri] / [tauri-build].

Go to `src-tauri/Cargo.toml` and change `tauri` and `tauri-build` to

```toml
[build-dependencies]
tauri-build = "%version%"

[dependencies]
tauri = { version = "%version%" }
```
{/* _TODO MIGRATED FROM V1 ->*/}
where `%version%` is the corresponding version number from above. {/* TODO: (You can just use the `MAJOR.MINOR`) version, like `0.9`.*/}

Then do the following:

```shell
cd src-tauri
cargo update
```

Alternatively, you can run the `cargo upgrade` command provided by [cargo-edit] which does all of this automatically.

[`cargo outdated`]: https://github.com/kbknapp/cargo-outdated
[tauri]: https://crates.io/crates/tauri/versions
[tauri-build]: https://crates.io/crates/tauri-build/versions
[cargo-edit]: https://github.com/killercup/cargo-edit
34 changes: 34 additions & 0 deletions src/content/docs/zh-CN/guides/develop/development-cycle.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: 开发周期
description: 使用 Tauri 开发的核心概念
---

import CommandTabs from '@components/CommandTabs.astro';

### 1. 启动开发服务器

现在您已经设置好了一切,您应该启动由 UI 框架或捆绑器提供的应用程序开发服务器(当然,假设您使用的是)。

:::note

每个框架都有自己的开发工具。 涵盖所有内容或保持最新状态超出了本文档的范围。
:::

### 2. 启动 Tauri 开发窗口

<CommandTabs
npm="npm run tauri dev"
yarn="yarn tauri dev"
pnpm="pnpm tauri dev"
cargo="cargo tauri dev"
/>

第一次运行此命令时,Rust 包管理器需要几分钟来下载和构建所有必需的包。 由于它们是缓存的,因此后续构建要快得多,因为只有新的代码需要重新构建。

一旦 Rust 完成构建,Web 视图就会打开,显示您的 Web 应用程序。 您可以对 Web 应用程序进行更改,如果您的工具启用了它,则 Web 视图应自动更新,就像浏览器一样。 当您对 Rust 文件进行更改时,它们会自动重建,并且您的应用程序会自动重新启动。

:::caution[info 关于 Cargo.toml 和源代码管理]

在您的项目仓库中,您应该将`src-tauri/Cargo.lock`和`src-tauri/Cargo.toml`提交到 git,因为 Cargo 使用锁文件来提供确定性构建。 因此,建议所有应用程序都签入到 `Cargo.lock`。 您不应该提交`src-tauri/target`文件夹或其任何内容。

:::
64 changes: 64 additions & 0 deletions src/content/docs/zh-CN/guides/develop/updating-dependencies.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
title: 更新依赖关系
description: 使用 Tauri 开发的核心概念
---

import CommandTabs from '@components/CommandTabs.astro';

## 更新 npm 包

如果您正在使用 `tauri` 包:

<CommandTabs
npm="npm install @tauri-apps/cli@latest @tauri-apps/api@latest"
yarn="yarn up @tauri-apps/cli @tauri-apps/api"
pnpm="pnpm update @tauri-apps/cli @tauri-apps/api --latest"
/>

您还可以通过以下方式检测最新版本的 Tauri 在命令行上:


<CommandTabs
npm="npm outdated @tauri-apps/cli"
yarn="yarn outdated @tauri-apps/cli"
pnpm="pnpm outdated @tauri-apps/cli"
/>


或者,如果您正在使用 `vue-cli-plugin-tauri` 方法:


<CommandTabs
npm="npm install vue-cli-plugin-tauri@latest"
yarn="yarn up vue-cli-plugin-tauri"
pnpm="pnpm update vue-cli-plugin-tauri --latest"
/>

## 更新 Cargo 包

您可以用 [`Cargo outdated`][] 或在 crates.io 页面上检查过期的包: [tauri][] / [tauri-build][]

打开 `src-tauri/Cargo.toml` 并更改 `tauri` 和 `tauri-build`

```toml
[build-dependencies]
tauri-build = "%version%"

[dependencies]
tauri = { version = "%version%" }
```
其中 `%version%` 是上面相应的版本号

然后执行以下操作:

```shell
cd src-tauri
cargo update
```

或者,您可以运行 `cargo upgrade` 命令,由 [ cargo-edit][] 提供,这将自动完成所有这一切。

[`cargo outdated`]: https://github.com/kbknapp/cargo-outdated
[tauri]: https://crates.io/crates/tauri/versions
[tauri-build]: https://crates.io/crates/tauri-build/versions
[cargo-edit]: https://github.com/killercup/cargo-edit