Skip to content
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

New Multiplatform Templates #50

Merged
merged 32 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5a79184
Update the template with breaking changes in 0.6
ealmloff Jul 19, 2024
9e8184c
fix(build): used new `asset!` macro
Andrew15-5 Aug 7, 2024
5f01d28
remove manganis dependency
ealmloff Aug 7, 2024
a53719a
Merge pull request #1 from Andrew15-5/remove-manganis-macro
ealmloff Aug 7, 2024
b1a2dd0
progress: new templates
DogeDark Oct 30, 2024
e649343
feat: barebones template
DogeDark Oct 30, 2024
6571def
progress: workspace template
DogeDark Nov 10, 2024
d728f72
progress: workspace template
DogeDark Nov 10, 2024
06acc51
Merge branch 'v0.6' into new-templates-0.6
DogeDark Nov 16, 2024
cc9d5e7
add: more doc on development
DogeDark Nov 16, 2024
988e5a2
remove: assets
DogeDark Nov 16, 2024
c789713
progress: templates
DogeDark Nov 18, 2024
3b48059
progress: templates
DogeDark Nov 18, 2024
e3b37b8
feat: easier dioxus version specifying
DogeDark Nov 18, 2024
cf14da1
revision: readme final touches
DogeDark Nov 18, 2024
f9b5d70
revision: rename barebones, update readme, replace calc w echo
DogeDark Nov 21, 2024
fc65956
progress: ci scripts
DogeDark Nov 21, 2024
ff2f548
fix: indentation for workflow
DogeDark Nov 21, 2024
2a6a331
fix: ci
DogeDark Nov 21, 2024
4ca1a52
fix: gdk
DogeDark Nov 21, 2024
e681d2d
fix: libsoup
DogeDark Nov 21, 2024
64e7bf4
fix: libsoup
DogeDark Nov 21, 2024
2a5f37c
fix: libjavascriptcoregtk
DogeDark Nov 21, 2024
9bf04f4
fix: just use tauri deps
DogeDark Nov 21, 2024
a09d39f
fix: apt install
DogeDark Nov 21, 2024
88d1877
fix: apt update
DogeDark Nov 21, 2024
c7b8c5a
revision: cleanup
DogeDark Nov 21, 2024
ed587cd
revision: workarounds for --define
DogeDark Nov 25, 2024
adbed22
revision: ci
DogeDark Nov 25, 2024
e4f84ef
fix: ci
DogeDark Nov 25, 2024
82f5cc7
fix: ci
DogeDark Nov 25, 2024
101b119
fix: tailwind
DogeDark Nov 29, 2024
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
54 changes: 54 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Templates CI

on:
push:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]


# workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings

jobs:
check:
if: github.event.pull_request.draft == false
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: cargo-bins/[email protected]
- run: cargo binstall [email protected]
- run: sudo apt update
- run: sudo apt install expect libwebkit2gtk-4.1-dev build-essential curl wget file libxdo-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev

# Test bare bones
- name: Create Bare-Bones
run: dx new --template . --subtemplate Bare-Bones --yes --option default_platform=web barebones-all

- name: Test Bare-Bones
working-directory: ./barebones-all
run: cargo check

# Test Jumpstart
- name: Create Jumpstart
run: dx new --template . --subtemplate Jumpstart --yes --option default_platform=web jumpstart-all

- name: Test Jumpstart
working-directory: ./jumpstart-all
run: cargo check

# Test Workspace
- name: Create Workspace
run: dx new --template . --subtemplate Workspace --yes workspace-all

- name: Test Workspace
working-directory: ./workspace-all
run: cargo check

File renamed without changes.
17 changes: 17 additions & 0 deletions Bare-Bones/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "{{project-name}}"
version = "0.1.0"
authors = ["{{authors}}"]
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
dioxus = { {{ dioxus_dep_src }}, features = {{dioxus_dep_features}} }
dioxus-logger = "0.5"

[features]
default = ["{{default_platform}}"]
{%- for feature in features %}
{{ feature }}
{%- endfor %}
14 changes: 3 additions & 11 deletions Dioxus.toml → Bare-Bones/Dioxus.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@
# App (Project) Name
name = "{{project-name}}"

# Dioxus App Default Platform
# web, desktop, fullstack
default_platform = "desktop"

# `build` & `serve` dist path
# `build` dist path
out_dir = "dist"

# assets file folder
asset_dir = "assets"
# resource (assets) file folder
asset_dir = "none"

[web.app]

Expand All @@ -30,11 +26,7 @@ watch_path = ["src", "assets"]
[web.resource]

# CSS style file
{% if styling == "Tailwind" %}
style = ["/tailwind.css"]
{% else %}
style = []
{% endif %}

# Javascript code file
script = []
Expand Down
34 changes: 34 additions & 0 deletions Bare-Bones/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Development

Your new bare-bones project includes minimal organization with a single `main.rs` file and a few assets.

{% if is_tailwind -%}
### Tailwind
1. Install npm: https://docs.npmjs.com/downloading-and-installing-node-js-and-npm
2. Install the Tailwind CSS CLI: https://tailwindcss.com/docs/installation
3. Run the following command in the root of the project to start the Tailwind CSS compiler:

```bash
npx tailwindcss -i ./input.css -o ./assets/tailwind.css --watch
```
{%- endif %}

### Serving Your App

Run the following command in the root of your project to start developing with the default platform:

```bash
dx serve
```

To run for a different platform, use the `--platform platform` flag. E.g.
```bash
dx serve --platform desktop
```

{% if is_mobile -%}
To serve on mobile, you need to explicitly set your target device, `android` or `ios`:
```bash
dx serve --platform android
```
{%- endif %}
Binary file added Bare-Bones/assets/favicon.ico
Binary file not shown.
File renamed without changes
111 changes: 111 additions & 0 deletions Bare-Bones/assets/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/* App-wide styling */
body {
background-color: #0f1116;
color: #ffffff;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
margin: 20px;
}

#hero {
margin: 0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}

#links {
width: 400px;
text-align: left;
font-size: x-large;
color: white;
display: flex;
flex-direction: column;
}

#links a {
color: white;
text-decoration: none;
margin-top: 20px;
margin: 10px 0px;
border: white 1px solid;
border-radius: 5px;
padding: 10px;
}

#links a:hover {
background-color: #1f1f1f;
cursor: pointer;
}

#header {
max-width: 1200px;
}

{% if is_router -%}
/* Navbar */
#navbar {
display: flex;
flex-direction: row;
}

#navbar a {
color: #ffffff;
margin-right: 20px;
text-decoration: none;
transition: color 0.2s ease;
}

#navbar a:hover {
cursor: pointer;
color: #91a4d2;
}

/* Blog page */
#blog {
margin-top: 50px;
}

#blog a {
color: #ffffff;
margin-top: 50px;
}
{%- endif %}

{% if is_fullstack -%}
/* Echo */
#echo {
width: 360px;
margin-left: auto;
margin-right: auto;
margin-top: 50px;
background-color: #1e222d;
padding: 20px;
border-radius: 10px;
}

#echo>h4 {
margin: 0px 0px 15px 0px;
}


#echo>input {
border: none;
border-bottom: 1px white solid;
background-color: transparent;
color: #ffffff;
transition: border-bottom-color 0.2s ease;
outline: none;
display: block;
padding: 0px 0px 5px 0px;
width: 100%;
}

#echo>input:focus {
border-bottom-color: #6d85c6;
}

#echo>p {
margin: 20px 0px 0px auto;
}
{%- endif %}
14 changes: 14 additions & 0 deletions Bare-Bones/cargo-generate.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[template]

[hooks]
pre = ["init.rhai", "../common.rhai"]
post = ["conditional-files.rhai"]

[placeholders]
is_web = { prompt = "Do you want to build for Dioxus Web?", default = true, type = "bool" }
is_desktop = { prompt = "Do you want to build for Dioxus Desktop?", default = true, type = "bool" }
is_mobile = { prompt = "Do you want to build for Dioxus Mobile?", default = true, type = "bool" }

is_fullstack = { prompt = "Do you want to use Dioxus Fullstack?", default = true, type = "bool" }
is_router = { prompt = "Do you want to use the Dioxus Router?", default = true, type = "bool" }
is_tailwind = { prompt = "Do you want to use Tailwind CSS?", default = false, type = "bool" }
9 changes: 9 additions & 0 deletions Bare-Bones/conditional-files.rhai
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// This file handles conditional files for this specific sub-template.

const IS_TAILWIND_VAR = "is_tailwind";

let is_tailwind = variable::get(IS_TAILWIND_VAR);
if !is_tailwind {
file::delete("tailwind.config.js");
file::delete("input.css");
}
3 changes: 3 additions & 0 deletions Bare-Bones/init.rhai
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Tell the common init script that this template needs the default platform.
variable::set("needs_default_platform", true);
// variable::set("needs_tailwind_prompt", true);
File renamed without changes.
Loading