Tauri & ReactJS - Creating Modern Desktop Apps (read desc.)

elibro
14 Jan 202208:26

Summary

TLDRThis video script provides a step-by-step guide on integrating a web app with Taurine, a framework that allows web apps to run on desktops using the system's web view instead of a browser. It covers prerequisites like installing Microsoft Visual Studio build tools, Node.js, and Rust, and demonstrates creating a React project, setting up Taurine, and troubleshooting common issues. The tutorial also includes creating a desktop app installer, showcasing Taurine's ease of use and potential for developers.

Takeaways

  • 🌐 Tarry is a tool that allows web applications to be used as desktop apps, providing access to local resources without the need for a browser.
  • 🛠️ To start with Tarry, you need to install Microsoft Visual Studio's build tools or ensure you have Visual Studio 2022 installed.
  • ☕ While the build tools are downloading and installing, it's recommended to have Node.js installed, especially if it's not already present on your system.
  • 🔍 Yarn is pre-installed with Node.js, so there's no need to worry about installing it separately.
  • 🔧 Rust and Cargo, the Rust package manager, should be installed for Tarry's backend processes.
  • 📁 Create a new project folder for integrating with Tarry, especially if starting from scratch with only an index.html file.
  • 🔄 Use 'create-react-app' to set up a new project if you're using React and JavaScript, which is a common choice for web applications.
  • 🛑 Install 'cross-env' and the CLI to prevent the browser from opening when starting the React app, as Tarry is for desktop apps.
  • 📝 Add resolutions to package.json to ensure compatibility and prevent build failures due to unresolved dependencies.
  • 🚀 Run 'yarn tarry dove' to initiate the Tarry integration process, which will also create an installer for your app.
  • 🎉 The process includes creating an installer with an icon for your desktop application, making it ready for distribution.

Q & A

  • What is Tarry and how does it differ from Electron?

    -Tarry is a tool that allows you to convert a web application into a desktop application. Unlike Electron, which uses a Chromium browser, Tarry utilizes the web view of the underlying system, thus not requiring the shipping of a whole browser.

  • What prerequisites are needed to start working with Tarry on Windows?

    -To start with Tarry on Windows, you need to install Microsoft Visual Studio Build Tools, ensure Node.js is installed, and have Yarn pre-installed. Additionally, Rust and Cargo, the Rust package manager, should be installed.

  • Why is Microsoft Visual Studio mentioned in the setup process?

    -Microsoft Visual Studio is mentioned because it provides the necessary build tools required for the setup process of Tarry on Windows.

  • What does the speaker suggest doing while waiting for the Visual Studio Build Tools to install?

    -The speaker suggests using the waiting time to install Node.js if it's not already installed, and to ensure that the installation is run in administrative mode.

  • Why is it recommended to start a new Tarry project for beginners?

    -For beginners, starting a new Tarry project is recommended because it provides a simple environment with just an index.html file, allowing them to create a static website that runs as a desktop application without needing to understand JavaScript deeply.

  • What is the purpose of the 'create-react-app' command mentioned in the script?

    -The 'create-react-app' command is used to set up a new React project. It's mentioned in the script as part of the process of integrating Tarry with an existing React project.

  • Why is 'cross-env' installed in the project?

    -'cross-env' is installed to prevent the browser from opening when starting the React app with Tarry, as it's intended for a desktop environment rather than a web browser.

  • What does the script suggest to do if the React app installation breaks due to unresolved dependencies?

    -The script suggests adding resolutions to the package.json file to ensure that the React app doesn't break due to unresolved dependencies.

  • What is the significance of the 'yarn build' command in the context of Tarry?

    -The 'yarn build' command is used to compile the project into an output directory. It's important in the context of Tarry as it prepares the web application for conversion into a desktop application.

  • How does the script describe the final step of creating a Tarry desktop application?

    -The final step described in the script is running 'yarn tarry dove' to create the desktop application, which also automatically generates an installer for the application.

  • What is the name of the company mentioned in the script and what role does it play in the context?

    -The name of the company mentioned is 'Lenerva'. It appears to be the speaker's company, possibly the entity for which the Tarry project is being set up.

Outlines

00:00

💻 Setting Up a Desktop Web App with Tarry

This paragraph introduces Tarry, a tool that allows web applications to run on a desktop without a browser, accessing local resources if needed. It's similar to Electron but uses the system's web view instead of shipping a whole browser. The script mentions using Rust for backend tasks. The setup process for Windows involves installing Microsoft Visual Studio build tools, Node.js, and Rust with Cargo, the package manager. The speaker also discusses the initial steps for integrating Tarry with an existing project, emphasizing the need for a project folder and the creation of a new React project using 'create-react-app'. There's mention of avoiding the automatic opening of a browser during the setup, which is a typical behavior of React applications.

05:00

🛠️ Troubleshooting and Building a Tarry Project

The second paragraph delves into troubleshooting the setup of a Tarry project, highlighting a specific issue where the installation process broke due to unresolved dependencies. The speaker advises installing 'cross-env' to prevent the browser from opening, which is not desired in a Tarry project. The process includes running 'yarn cross-env' with the browser set to 'none', followed by 'yarn start'. The speaker also mentions the importance of building the project with 'yarn build' to ensure that it can be cached for later use. The paragraph concludes with the successful creation of a Tarry project, including an installer with an icon, demonstrating a smooth setup process after overcoming initial difficulties.

Mindmap

Keywords

💡Tarry

Tarry is a tool used for creating desktop applications from web applications, allowing them to run outside of a browser environment. It is similar to Electron but does not rely on a Chromium browser, instead using the native web view of the underlying system. In the script, Tarry is the main subject, with the video focusing on setting it up and integrating it with a project.

💡Microsoft Visual Studio

Microsoft Visual Studio is an integrated development environment (IDE) that is essential for the script's setup process. It is used for developing applications with various programming languages. In the video, it is mentioned as a prerequisite for setting up the Tarry environment on Windows.

💡Node.js

Node.js is a JavaScript runtime that allows for server-side JavaScript execution. It is a key component for many web development projects. In the script, Node.js is recommended to be installed as part of the Tarry setup process, especially for those who do not already have it.

💡Yarn

Yarn is a package manager for JavaScript that is used for dependency management in web projects. It is mentioned in the script as being pre-installed, which simplifies the setup process for Tarry, as it is used to install other necessary packages.

💡Rust

Rust is a systems programming language known for its performance and safety. It is used in the script for backend operations within the Tarry framework. The video suggests that the audience likely already has Rust installed, as it is commonly associated with the Tarry project.

💡Cargo

Cargo is Rust's package manager and build system. It is integral to managing Rust projects and is mentioned in the script as a necessary component for the Tarry setup, assuming the audience is familiar with Rust development.

💡React

React is a popular JavaScript library for building user interfaces, particularly single-page applications. In the script, React is used as an example of a front-end technology that can be integrated with Tarry to create a desktop application.

💡Cross-env

Cross-env is a package that allows setting environment variables across different operating systems in a Node.js application. It is mentioned in the script as part of the setup process to ensure that environment variables are set correctly for the Tarry project.

💡Webpack

Webpack is a static module bundler for modern JavaScript applications. It is used in the script to build the project, and it is implied that Webpack configurations are necessary for the Tarry integration to work properly.

💡Tarry CLI

Tarry CLI is the command-line interface for the Tarry tool, which is used to scaffold and manage Tarry projects. In the script, it is mentioned as part of the process to add Tarry to an existing project.

💡Build process

The build process in the context of the script refers to compiling the web application into a format suitable for the Tarry desktop application. It is a crucial step before the application can be run as a desktop app, and the script describes how to initiate this process using 'yarn build'.

Highlights

Tarry is a tool for converting web apps into desktop applications using the local system's web view instead of a browser.

Tarry uses Rust for backend processes, offering an alternative to Electron which relies on Chromium.

To set up Tarry on Windows, Microsoft Visual Studio build tools are required, along with Node.js for JavaScript runtime.

Yarn, a package manager, is pre-installed with Node.js, simplifying the setup process.

Rust and its package manager, Cargo, should be installed for Tarry development.

For troubleshooting, ensure Microsoft Edge is installed as it might be required for Tarry to function properly.

Starting a new Tarry project is recommended for beginners, providing a simple index.html to work with.

For existing projects, Tarry can be added with specific commands in the project directory.

Creating a new project folder and initializing a React app is part of setting up a Tarry project with JavaScript.

Cross-env and the CLI are necessary dev dependencies for a React app to work with Tarry.

Resolutions must be set to prevent build failures in a React app integrated with Tarry.

The build process with 'yarn build' is crucial before running the Tarry application.

Running 'yarn tarry dove' initiates the Tarry development process for the project.

Tarry automatically generates an installer for the desktop application.

The speaker shares their experience of difficulties and hopes for a smoother experience for others.

The final product is a desktop application named 'r2t2' with an icon, showcasing the result of the Tarry setup.

Transcripts

play00:00

tarry is what you can use to take your

play00:03

web app

play00:04

so your friend and app

play00:06

and then

play00:08

use

play00:09

on a desktop so instead of the browser

play00:12

your

play00:12

you now can access the local resources

play00:16

if you want it to

play00:18

okay so it's like an electron

play00:21

but not

play00:23

a chromium browser so instead of

play00:26

instead of shipping a whole browser you

play00:29

just use the web view in the underlying

play00:32

system which is what this is about and

play00:35

it uses rust to do that

play00:38

so

play00:39

if you want to do some back and stuff

play00:40

it'll be in rust

play00:43

anyways let's get started we just go

play00:45

integrate with towery nope

play00:47

we gotta do setup for windows

play00:52

so the first thing you'll need is to

play00:55

install these microsoft visual studio

play00:57

sequential build tools go here build it

play01:00

or if you already have visual studio

play01:04

2022

play01:05

you're good

play01:06

and i already have it and anyways build

play01:08

it and do not go grab a coffee

play01:11

because you want to do this other stuff

play01:13

so while that's downloading and

play01:14

installing

play01:16

you want to have node.js installed and

play01:20

this is if you already have node.js you

play01:22

don't really need to worry about this

play01:24

this is only if you don't have node.js

play01:25

you should do it this way

play01:27

i remember to

play01:30

run your

play01:31

run it in administrative mode

play01:34

when you're

play01:35

doing this stuff

play01:36

after you install nbm

play01:42

now yarn is already pre-installed so you

play01:44

don't have to worry about that

play01:45

rusty

play01:47

and by worry about that i mean worry

play01:48

about installing it rusty and cargo

play01:50

package manager so

play01:52

yeah install rust

play01:54

pretty sure you guys already have rust

play01:56

installed because

play01:57

you only found out about towering

play01:59

through rust i didn't really find out

play02:01

about tarry i don't think you'd find out

play02:03

about terry from the front end side but

play02:05

even though they act like you'd find it

play02:07

through the front-end side

play02:09

no web view two

play02:11

the first time i actually read this as

play02:12

windows 10 not 11

play02:14

and i did not install it so only install

play02:17

this if things don't work

play02:19

which

play02:20

they do work for me so yeah

play02:24

because i already haven't edge installed

play02:26

it's installed by default so i don't

play02:28

really get why it wouldn't be installed

play02:30

anyways let's go

play02:34

to integrate with terry

play02:38

now what they recommend is starting a

play02:40

new tarry project no this is if you're a

play02:43

noob

play02:44

and you don't know javascript or

play02:46

anything about javascript

play02:48

then you do this because then all you

play02:49

have is an index.html

play02:52

and you can do whatever you want a

play02:53

static

play02:54

a website that runs on a desktop app

play02:58

so we'll scroll down here and this is

play02:59

what you need

play03:00

add tower to existing project

play03:03

so cd into the project folder and then

play03:05

we add it but now you're saying wait a

play03:07

second we don't have a project folder so

play03:09

what you want to do is create a project

play03:11

folder

play03:12

and i've called it r2d2 and i'm using

play03:15

react and i'm going to be using the

play03:17

react jack js

play03:19

so what we want to do is

play03:21

create react app

play03:25

okay

play03:26

so we run that and

play03:28

since we're already in the project

play03:29

folder

play03:30

we do dot

play03:32

so after we do that

play03:34

we actually want to add we want to go

play03:36

through with this but don't just copy

play03:38

this we actually need some other stuff

play03:40

because

play03:42

if you

play03:43

know anything about react

play03:46

okay so i'll show you what i mean so if

play03:48

we start the react app

play03:53

it'll take some time

play03:55

but

play04:00

what happens is

play04:04

what happens is that

play04:12

i'll show you guys as soon as

play04:15

there you go see the browser opens up so

play04:18

when we're using towery we don't want

play04:19

the browser to open up because it'll

play04:21

open up a desktop app

play04:22

so anyways we go here

play04:25

and we want to install the cross end

play04:27

thing

play04:28

and the cli

play04:31

and

play04:32

we can skip this because it'll just be

play04:34

done here

play04:40

so we've done this and

play04:43

we've added these dev dependencies

play04:45

and the next thing we want to do is add

play04:47

resolutions

play04:48

so that the react app doesn't break

play04:51

and what i mean by this is look at this

play04:54

it'll break

play04:58

or it should break because

play05:00

this did not get

play05:01

resolved yet

play05:04

but

play05:05

yeah

play05:08

there you go see it didn't install

play05:10

so it broke and that's what i had

play05:13

trouble for an hour

play05:15

not fun man not fun at all

play05:18

and if we build it it'll work so i'm not

play05:20

gonna see it it works

play05:23

so we just do that and

play05:28

we don't care about finishing it

play05:32

anyways i think i forgot to mention why

play05:34

we need

play05:35

this thing

play05:37

and

play05:38

i'll show you as soon as i initialize

play05:40

the app

play05:41

but

play05:46

lenerva is the name of my company

play05:50

now for the assets it's in source

play05:55

or

play05:56

hold up

play05:58

it could be in build

play06:01

so we'll come back to that actually

play06:04

and you know what we'll come back to it

play06:07

right now

play06:08

we don't want to forget about it you

play06:11

know what i mean

play06:12

so we see here we go we install the api

play06:14

thing

play06:16

but let me just

play06:18

let me just squeeze that in really

play06:19

quickly

play06:22

anyways as i was saying cross end okay

play06:25

so we need it because

play06:27

we need we don't want to open the

play06:28

browser so what we do is we run yarn

play06:32

cross end and then we need to set

play06:35

browser to none

play06:36

and after that we can continue with yarn

play06:38

start

play06:40

now the same way before we build we need

play06:43

to say yarn build

play06:45

and

play06:46

what yarn build will do is you'll see

play06:49

here

play06:50

the build is being built over here so if

play06:52

we do yarn build right now

play06:54

just so

play06:56

it can be cached later on

play07:00

we can see something there but as that's

play07:02

building we can continue on our journey

play07:07

i'll skip this because

play07:09

i think things are working now

play07:12

so all we do is run yarn towery dove and

play07:19

anyways here we go here's the stuff

play07:22

and

play07:23

that's pretty good and one more thing

play07:25

right

play07:27

we want to do

play07:30

this

play07:31

this is the

play07:33

so i'm just going to do this and then

play07:35

i'm going to call it a day

play07:37

it even made the installer for me

play07:39

how awesome is that

play07:41

where is this release okay target

play07:44

release

play07:45

so

play07:46

start target

play07:48

release

play07:50

r2t2 bro r2t2

play07:53

man i am

play07:55

oh it has an icon as well r2t2

play07:58

yo look at that look at that

play08:01

so there you go there's getting started

play08:03

with towery i hope

play08:05

i covered everything and now you can

play08:07

just focus on the code

play08:09

i had a lot of difficulties getting to

play08:11

this point but i hope

play08:14

you guys

play08:16

have had the smoothest ride ever

play08:19

and don't have to think about the

play08:21

problems i encountered because i've

play08:23

encountered a lot

play08:25

so yeah see ya

Rate This

5.0 / 5 (0 votes)

Etiquetas Relacionadas
Tauri setupRust integrationReact appDesktop applicationWebviewNode.jsCross-platformDevelopment toolsWindows setupYarn build
¿Necesitas un resumen en inglés?