Skip to content

Commit 94f57bb

Browse files
authored
feat: add deno support (#819)
1 parent 8eaec2d commit 94f57bb

File tree

42 files changed

+208
-179
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+208
-179
lines changed

.changes/deno.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"create-tauri-app": "patch"
3+
"create-tauri-app-js": "patch"
4+
---
5+
6+
Add support for using deno as package manager

.github/workflows/templates-test.yml

+19-13
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ concurrency:
2525

2626
jobs:
2727
generate-matrix:
28-
runs-on: ubuntu-latest
28+
runs-on: ubuntu-22.04
2929
outputs:
3030
matrix: ${{ steps.set-matrix.outputs.matrix }}
3131
steps:
@@ -47,7 +47,7 @@ jobs:
4747
4848
build-cli:
4949
needs: [generate-matrix]
50-
runs-on: ubuntu-latest
50+
runs-on: ubuntu-22.04
5151
steps:
5252
- uses: actions/checkout@v3
5353
- uses: dtolnay/rust-toolchain@stable
@@ -65,7 +65,7 @@ jobs:
6565

6666
test:
6767
needs: [build-cli, generate-matrix]
68-
runs-on: ubuntu-latest
68+
runs-on: ubuntu-22.04
6969
if: ${{ needs.generate-matrix.outputs.matrix != '[]' && needs.generate-matrix.outputs.matrix != '' }}
7070
strategy:
7171
fail-fast: false
@@ -78,12 +78,18 @@ jobs:
7878
if: matrix.settings.manager == 'bun'
7979
with:
8080
bun-version: latest
81+
82+
- name: Install Deno@2
83+
if: matrix.settings.manager == 'deno'
84+
uses: denoland/setup-deno@v2
85+
with:
86+
deno-version: v2.x
8187

8288
- run: corepack enable
83-
if: matrix.settings.manager != 'cargo'
89+
if: matrix.settings.node
8490

8591
- name: Install Node.js@18
86-
if: matrix.settings.manager != 'cargo'
92+
if: matrix.settings.node
8793
uses: actions/setup-node@v4
8894
with:
8995
node-version: 20
@@ -97,18 +103,18 @@ jobs:
97103
- uses: dtolnay/rust-toolchain@stable
98104

99105
- run: cargo install tauri-cli --locked
100-
if: (matrix.settings.manager == 'cargo' || matrix.settings.manager == 'dotnet') && matrix.settings.tauriVersion == 'latest'
106+
if: (matrix.settings.manager == 'cargo' || matrix.settings.manager == 'dotnet') && matrix.settings.tauriVersion != 1
101107

102108
- run: cargo install tauri-cli --version '^1.0.0' --locked
103109
if: (matrix.settings.manager == 'cargo' || matrix.settings.manager == 'dotnet') && matrix.settings.tauriVersion == 1
104110

105-
- run: |
106-
rustup target add wasm32-unknown-unknown
107-
cargo install trunk --locked
111+
- run: rustup target add wasm32-unknown-unknown
112+
if: matrix.settings.install_trunk || matrix.settings.install_dioxus_cli
113+
114+
- run: cargo install trunk --locked
108115
if: matrix.settings.install_trunk
109-
- run: |
110-
rustup target add wasm32-unknown-unknown
111-
cargo install dioxus-cli --locked
116+
117+
- run: cargo install dioxus-cli --locked
112118
if: matrix.settings.install_dioxus_cli
113119

114120
- name: install system dependencies (v1)
@@ -118,7 +124,7 @@ jobs:
118124
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libayatana-appindicator3-dev librsvg2-dev patchelf
119125
120126
- name: install system dependencies
121-
if: matrix.settings.tauriVersion == 'latest'
127+
if: matrix.settings.tauriVersion != 1
122128
run: |
123129
sudo apt-get update
124130
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.1 libayatana-appindicator3-dev librsvg2-dev patchelf

.prettierignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@
66
/.github
77
node_modules
88
node/index.js
9-
node/index.d.ts
9+
node/index.d.ts
10+
CHANGELOG.md
11+
pnpm-lock.yaml

.prettierrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"singleQuote": false,
3+
"semi": true
4+
}

.scripts/generate-templates-matrix.js

+7
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ const matrixConfig = [
5151
run_cmd: "bun run",
5252
templates: nodeJsTemplates,
5353
},
54+
{
55+
manager: "deno",
56+
install_cmd: "deno install",
57+
run_cmd: "deno task",
58+
templates: nodeJsTemplates,
59+
},
5460
{
5561
manager: "dotnet",
5662
install_cmd: "",
@@ -78,6 +84,7 @@ matrixConfig
7884
) {
7985
const jobInfo = {
8086
template: t,
87+
node: ["pnpm", "yarn", "npm"].includes(managerInfo.manager),
8188
install_trunk: ["yew", "sycamore", "leptos"].includes(t),
8289
install_dioxus_cli: t === "dioxus",
8390
tauriVersion: "latest",

README.md

+54-51
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
[![changelog](https://img.shields.io/badge/CHANGELOG-yellowgreen)](./CHANGELOG.md)
1111

1212
# Usage
13+
1314
To get started using `create-tauri-app` run one of the below commands in the folder you'd like to setup your project.
1415

1516
### Bash:
@@ -64,71 +65,73 @@ bunx create-tauri-app
6465
<br>
6566

6667
## Scaffold a new project (interactive)
67-
Follow along with the prompts to choose your project name, frontend language, package manager, and frontend framework, and frontend framework options if applicable.
6868

69+
Follow along with the prompts to choose your project name, frontend language, package manager, and frontend framework, and frontend framework options if applicable.
6970

7071
1. Choose a name and a bundle identifier (unique-id for your app):
71-
```
72-
? Project name (tauri-app) ›
73-
? Identifier (com.tauri-app.app) ›
74-
```
72+
```
73+
? Project name (tauri-app) ›
74+
? Identifier (com.tauri-app.app) ›
75+
```
7576
2. Select a flavor for your frontend. First the language:
76-
```
77-
? Choose which language to use for your frontend ›
78-
Rust (cargo)
79-
TypeScript / JavaScript (pnpm, yarn, npm, bun)
80-
.NET (dotnet)
81-
```
77+
```
78+
? Choose which language to use for your frontend ›
79+
Rust (cargo)
80+
TypeScript / JavaScript (pnpm, yarn, npm, bun)
81+
.NET (dotnet)
82+
```
8283
3. Select a package manager (if there are multiple available):
8384

85+
Options for **TypeScript / JavaScript**:
8486

85-
Options for **TypeScript / JavaScript**:
86-
87-
```
88-
? Choose your package manager ›
89-
pnpm
90-
yarn
91-
npm
92-
bun
93-
```
87+
```
88+
? Choose your package manager ›
89+
pnpm
90+
yarn
91+
npm
92+
bun
93+
```
9494

9595
4. Select a UI Template and flavor (if there are multiple available):
9696

97-
Options for **Rust**:
98-
```
99-
? Choose your UI template ›
100-
Vanilla
101-
Yew
102-
Leptos
103-
Sycamore
104-
```
105-
106-
Options for **TypeScript / JavaScript**:
107-
108-
```
109-
? Choose your UI template ›
110-
Vanilla
111-
Vue
112-
Svelte
113-
React
114-
Solid
115-
Angular
116-
Preact
117-
118-
? Choose your UI flavor ›
119-
TypeScript
120-
JavaScript
121-
```
122-
123-
Options for **.NET**:
124-
```
125-
? Choose your UI template ›
126-
Blazor (https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blazor/)
127-
```
97+
Options for **Rust**:
98+
99+
```
100+
? Choose your UI template ›
101+
Vanilla
102+
Yew
103+
Leptos
104+
Sycamore
105+
```
106+
107+
Options for **TypeScript / JavaScript**:
108+
109+
```
110+
? Choose your UI template ›
111+
Vanilla
112+
Vue
113+
Svelte
114+
React
115+
Solid
116+
Angular
117+
Preact
118+
119+
? Choose your UI flavor ›
120+
TypeScript
121+
JavaScript
122+
```
123+
124+
Options for **.NET**:
125+
126+
```
127+
? Choose your UI template ›
128+
Blazor (https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blazor/)
129+
```
128130

129131
Once completed, the utility reports that the template has been created and displays how to run it using the configured package manager. If it detects missing decencies on your system, it prints a list of packages and prompts how to install them.
130132

131133
## Scaffold a new project (non-interactive)
134+
132135
You can also directly specify the project name, package manager and the template you want to use via additional command line options. For example, to scaffold a Svelte project in a `my-tauri-app` directory, run:
133136

134137
```bash

node/create-tauri-app.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ const binStem = path.parse(bin).name.toLowerCase();
1313
// We want to make a helpful binary name for the underlying CLI helper, if we
1414
// can successfully detect what command likely started the execution.
1515
let binName;
16-
if (bin === "@tauri-apps/cli") {
17-
binName = "@tauri-apps/cli";
16+
17+
// deno run -A npm:@tauri-apps/cli or deno task tauri
18+
if (globalThis.navigator?.userAgent?.includes("Deno")) {
19+
binName = bin;
1820
}
1921
// Even if started by a package manager, the binary will be NodeJS or Bun.
2022
// Some distribution still use "nodejs" as the binary name.

node/npm/darwin-arm64/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
This is the **aarch64-apple-darwin** binary for `create-tauri-app`
44

55
## Licenses
6+
67
Code: (c) 2022 - The Tauri Programme within The Commons Conservancy.
78

8-
MIT or MIT/Apache 2.0 where applicable.
9+
MIT or MIT/Apache 2.0 where applicable.

node/npm/darwin-x64/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
This is the **x86_64-apple-darwin** binary for `create-tauri-app`
44

55
## Licenses
6+
67
Code: (c) 2022 - The Tauri Programme within The Commons Conservancy.
78

8-
MIT or MIT/Apache 2.0 where applicable.
9+
MIT or MIT/Apache 2.0 where applicable.

node/npm/linux-arm-gnueabihf/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
This is the **armv7-unknown-linux-gnueabihf** binary for `create-tauri-app`
44

55
## Licenses
6+
67
Code: (c) 2022 - The Tauri Programme within The Commons Conservancy.
78

8-
MIT or MIT/Apache 2.0 where applicable.
9+
MIT or MIT/Apache 2.0 where applicable.

node/npm/linux-arm64-gnu/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
This is the **aarch64-unknown-linux-gnu** binary for `create-tauri-app`
44

55
## Licenses
6+
67
Code: (c) 2022 - The Tauri Programme within The Commons Conservancy.
78

8-
MIT or MIT/Apache 2.0 where applicable.
9+
MIT or MIT/Apache 2.0 where applicable.

node/npm/linux-arm64-musl/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
This is the **aarch64-unknown-linux-musl** binary for `create-tauri-app`
44

55
## Licenses
6+
67
Code: (c) 2022 - The Tauri Programme within The Commons Conservancy.
78

8-
MIT or MIT/Apache 2.0 where applicable.
9+
MIT or MIT/Apache 2.0 where applicable.

node/npm/linux-x64-gnu/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
This is the **x86_64-unknown-linux-gnu** binary for `create-tauri-app`
44

55
## Licenses
6+
67
Code: (c) 2022 - The Tauri Programme within The Commons Conservancy.
78

8-
MIT or MIT/Apache 2.0 where applicable.
9+
MIT or MIT/Apache 2.0 where applicable.

node/npm/linux-x64-musl/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
This is the **x86_64-unknown-linux-musl** binary for `create-tauri-app`
44

55
## Licenses
6+
67
Code: (c) 2022 - The Tauri Programme within The Commons Conservancy.
78

8-
MIT or MIT/Apache 2.0 where applicable.
9+
MIT or MIT/Apache 2.0 where applicable.

node/npm/win32-arm64-msvc/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
This is the **aarch64-pc-windows-msvc** binary for `create-tauri-app`
44

55
## Licenses
6+
67
Code: (c) 2022 - The Tauri Programme within The Commons Conservancy.
78

8-
MIT or MIT/Apache 2.0 where applicable.
9+
MIT or MIT/Apache 2.0 where applicable.

node/npm/win32-ia32-msvc/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
This is the **i686-pc-windows-msvc** binary for `create-tauri-app`
44

55
## Licenses
6+
67
Code: (c) 2022 - The Tauri Programme within The Commons Conservancy.
78

8-
MIT or MIT/Apache 2.0 where applicable.
9+
MIT or MIT/Apache 2.0 where applicable.

node/npm/win32-x64-msvc/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
This is the **x86_64-pc-windows-msvc** binary for `create-tauri-app`
44

55
## Licenses
6+
67
Code: (c) 2022 - The Tauri Programme within The Commons Conservancy.
78

8-
MIT or MIT/Apache 2.0 where applicable.
9+
MIT or MIT/Apache 2.0 where applicable.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"scripts": {
3-
"format": "prettier --write --end-of-line=auto \"./**/*.{js,jsx,ts,tsx,html,css,json,vue}\"",
4-
"format:check": "prettier --check --end-of-line=auto \"./**/*.{js,jsx,ts,tsx,html,css,json,vue}\""
3+
"format": "prettier --write .",
4+
"format:check": "prettier --check ."
55
},
66
"devDependencies": {
77
"prettier": "3.3.3"

pnpm-workspace.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
packages:
2-
- 'worker'
3-
- 'node'
2+
- "worker"
3+
- "node"

src/category.rs

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ impl<'a> Category {
2222
PackageManager::Pnpm,
2323
PackageManager::Yarn,
2424
PackageManager::Npm,
25+
PackageManager::Deno,
2526
PackageManager::Bun,
2627
],
2728
Category::Dotnet => &[PackageManager::Dotnet],

0 commit comments

Comments
 (0)