create-tauri-app 版本 3 发布

create-tauri-app 的新主版本已发布。此版本增加了对 Tauri 2.0 alpha 版本的支持、初始化 iOS 和 Android 项目的能力,并删除了一些使用较少的模板,以使项目更易于维护。
🌐 A new major version of create-tauri-app has been released. This version adds support for the alpha version of Tauri 2.0, the ability to initialize iOS and Android projects and removes some less commonly used templates to make the project more maintainable.
🌐 Tauri 2.0 Alpha & Mobile Support
Tauri 2.0 的第一个 alpha 版本几乎在 3 个月前发布,它带来了对 Android 和 iOS 的初步移动支持。之前,没有一个简单的方法可以创建新项目来测试 alpha 版本中的更改或移动支持。好吧,现在这一切都结束了!
🌐 The first alpha version of Tauri 2.0 was published almost 3 months ago which brought initial mobile support for Android and iOS. Previously there wasn’t an easy way to create a new project to test either the changes in the alpha version nor the mobile support. Well, that ends now!
从 create-tauri-app 的第 3 版开始,你现在可以传递 --beta 标志,它将引导一个使用 tauri@2.0.0-beta 的应用。添加 --beta 标志时,它会自动提示你是否希望添加移动支持。你还可以使用 --mobile 标志来自动使其兼容移动设备。
🌐 Starting with version 3 of create-tauri-app, you can now pass --beta flag and it will bootstrap an app that uses tauri@2.0.0-beta. When adding the --beta flag it will automatically prompt you if you’d like to add mobile support. You can also use the --mobile flag to automatically make it mobile compatible.
开始:
🌐 To get started:
# pnpmpnpm create tauri-app --alpha
# yarnyarn create tauri-app --alpha
# npmnpm create tauri-app -- --alpha
# Cargocargo install create-tauri-app --lockedcargo create-tauri-app --alpha
# Bashsh <(curl https://create.tauri.app/sh) --alpha
# Powershell$env:CTA_ARGS="--alpha";iwr -useb https://create.tauri.app/ps | iex🌐 Prompt Improvements
在 create-tauri-app 的第 2 版中,我们还专注于改进提示问题的流程和体验。
🌐 With version 2 of create-tauri-app we also focused on improving the flow and experience of the prompted questions.
以前第二个提示会询问“选择你的包管理器”。这有点含糊,可能会让一些人有疑问:
🌐 Previously the second prompt would ask “Choose your package manager”. This was a bit vague and could leave some with unanswered questions:
cargo是什么?- 它是一个新的 Node.js 包管理器吗?
- 为什么选择它而不是
pnpm或yarn?
如果我们决定添加一种新的前端语言(例如 WebAssembly 的 Golang Web 应用),情况会更加模糊。我们添加了一个提示,要求选择包管理器以询问你更喜欢哪种语言。它看起来像这样:
🌐 This would be even more vague if we decided to add a new frontend language (such as a webassembly Golang web application). We added a prompt asking to choose the package manager to ask which language would you prefer. It looks something like this:
? Choose which language to use for your frontend › Rust❯ TypeScript / JavaScript (pnpm, yarn, npm)在选择前端语言后,如果该语言有多个可用的包管理器(例如 Node.js 的 npm、yarn 和 pnpm),create-tauri-app 将提示选择使用哪个包管理器。
🌐 After choosing the frontend language create-tauri-app will then prompt for package manager to use if the language has multiple (such as Node.js with npm, yarn, and pnpm).
我们觉得有问题的另一个提示是模板选择提示。它包含了很多可供选择的模板,并且随着时间的推移不断增加:
🌐 Another prompt that we felt problematic was the template selection prompt. It contained a lot of templates to choose from and was only growing with time:
✔ Choose your package manager · pnpm? Choose your UI template › vanilla vanilla-ts vue❯ vue-ts svelte svelte-ts react react-ts solid solid-ts next next-ts preact preact-ts angular clojurescript svelte-kit svelte-kit-ts我们决定把这个分成两个提示。第一个将会询问使用哪个 UI 模板:
🌐 We decided to split this up into 2 prompts. The first will ask which UI template to use:
✔ Choose your package manager · pnpm? Choose your UI template › Vanilla❯ Vue Svelte React Solid Angular Next SvelteKit ClojureScript Preact然后第二个将会询问该模板特有的任何其他选项(例如在 Vue 中选择 TypeScript 或 JavaScript):
🌐 And then the second will then ask any additional choices that are specific to that template (such as choosing between TypeScript or JavaScript for Vue):
✔ Choose your package manager · pnpm✔ Choose your UI template · Vue - (https://vuejs.org)? Choose your UI flavor ›❯ TypeScript JavaScript即使有了这些改进,模板列表仍然相当庞大,并且只会随着时间的推移而增长。接下来要关注的是模板列表本身。
🌐 Even with these refinements the list of templates was still quite large and would only grow over time. The next thing to look at was the list of templates themselves.
🌐 Removing Templates
当 create-tauri-app 版本 2 发布时,它很快就收到了提交的 PR,以添加超出最初发布的额外模板。虽然得到社区如此多的支持令人兴奋,但它确实带来了几个新的挑战:
🌐 When create-tauri-app version 2 was launched it quickly received PRs to add additional templates beyond what it originally launched with. While it was exciting to receive so much support from the community, it did bring up a couple of new challenges:
- 这几乎使得将它们放入一个提示中变得不可能
- 维护所有模板变得越来越困难
在展示 Tauri 的灵活性的同时,还要确保项目可维护并且具有我们想要的开发者体验,这是一种很难的平衡。
🌐 It was a hard balance between showing how flexible Tauri is but also making sure that the project was maintainable and had the DX that we wanted.
我们决定专注于最受欢迎的前端框架,并参考了社区调查(如 The State of JS)以及我们自己 Tauri 社区的反馈。基于这些,我们移除了 next、next-ts、preact、preact-ts、clojurescript、svelte-kit 和 svelte-kit-ts 模板,同时也关闭了旨在添加更多模板的 PR。
🌐 We decided to focus on the most popular frontend frameworks and used guidance from community surveys like The State of JS and our own Tauri community feedback. With this we removed the next, next-ts, preact, preact-ts, clojurescript, svelte-kit and svelte-kit-ts templates and also closed PRs which aimed to add more templates.
🌐 Community-Maintained Templates & Previous Versions
我们希望确保为 Tauri 社区提供一个地方,让他们为自己喜爱的框架提供模板。awesome-tauri 的模板部分正是这样一个地方。我们邀请社区向 awesome-tauri 仓库提交包含其模板的 PR,以便与 Tauri 社区分享。我们还将在 Tauri 网站上创建一个版块,以突出展示这些社区模板。
🌐 We want to make sure that we offer a place for the Tauri community to provide their own templates for the frameworks they love. The templates section of awesome-tauri is just the place for that. We invite the community to submit a PR to the awesome-tauri repo with their templates so that they can be shared with the Tauri community. We’ll also be creating a section on the Tauri website to highlight and showcase these community templates.
如果你仍然想使用 create-tauri-app 第2版的先前模板,它们仍然发布在 npm 和 crates.io 上。以下是你可以使用先前版本的方法:
🌐 If you’d still like to use the previous templates from version 2 of create-tauri-app they are still published to npm and crates.io. Here’s how you can use a previous version:
# pnpmpnpm create tauri-app@2
# yarnyarn create tauri-app@2
# npmnpm create tauri-app@2
# Cargocargo install create-tauri-app --version 2.8.0 --lockedcargo create-tauri-app
# Bashsh <(curl https://create.tauri.app/v/2.8.0/sh)
# Powershelliwr -useb https://create.tauri.app/v/2.8.0/ps | iex然而,随着时间的推移,随着 Tauri 和前端框架的发展,这些模板将变得过时。我们建议你查看 awesome-tauri 仓库中的社区模板,如果有缺失的内容,也欢迎提交。
🌐 However, as time goes, these templates will become out of date as Tauri and the frontend frameworks move forward. We’d recommend you look at the community templates in the awesome-tauri repo and welcome submissions if something is missing.
我们希望这些变化能让社区更容易尝试 Tauri 2.0 的 alpha 和 beta 版本,同时也让每个人创建新的 Tauri 应用的过程更简单!我们很想听取你的反馈,并邀请你加入关于此帖的GitHub 讨论中进行交流。
🌐 We hope that these changes make it easier for the community to try out the alpha and beta versions of Tauri 2.0 and also make the process to create a new Tauri app easier for everyone! We’d love to hear your feedback and invite you to join the conversation on the GitHub Discussion for this post.
Tauri 中文网 - 粤ICP备13048890号
Nodejs.cn 旗下网站