Rename dioxus to dx in examples and fullstack

This commit is contained in:
Jonathan Kelley 2023-07-14 13:53:06 -07:00
parent d27af03e3f
commit 16763c065b
No known key found for this signature in database
GPG key ID: 1FBB50F7EB0A08BE
22 changed files with 48 additions and 48 deletions

View file

@ -76,7 +76,7 @@ Next, we need to modify our `main.rs` to use either hydrate on the client or ren
{{#include ../../../examples/hydration.rs}} {{#include ../../../examples/hydration.rs}}
``` ```
Now, build your client-side bundle with `dioxus build --features web` and run your server with `cargo run --features ssr`. You should see the same page as before, but now you can interact with the buttons! Now, build your client-side bundle with `dx build --features web` and run your server with `cargo run --features ssr`. You should see the same page as before, but now you can interact with the buttons!
## Sycronizing props between the server and client ## Sycronizing props between the server and client
@ -99,4 +99,4 @@ The only thing we need to change on the client is the props. `dioxus-fullstack`
{{#include ../../../examples/hydration_props.rs}} {{#include ../../../examples/hydration_props.rs}}
``` ```
Now, build your client-side bundle with `dioxus build --features web` and run your server with `cargo run --features ssr`. Navigate to `http://localhost:8080/1` and you should see the counter start at 1. Navigate to `http://localhost:8080/2` and you should see the counter start at 2. Now, build your client-side bundle with `dx build --features web` and run your server with `cargo run --features ssr`. Navigate to `http://localhost:8080/1` and you should see the counter start at 1. Navigate to `http://localhost:8080/2` and you should see the counter start at 2.

View file

@ -24,7 +24,7 @@ Next, add the server function to your `main.rs`:
{{#include ../../../examples/server_function.rs}} {{#include ../../../examples/server_function.rs}}
``` ```
Now, build your client-side bundle with `dioxus build --features web` and run your server with `cargo run --features ssr`. You should see a new button that multiplies the count by 2. Now, build your client-side bundle with `dx build --features web` and run your server with `cargo run --features ssr`. You should see a new button that multiplies the count by 2.
## Conclusion ## Conclusion

View file

@ -9,8 +9,8 @@ It is also very much usable as a template for your projects, if you're aiming to
Make sure you have Dioxus CLI installed (if you're unsure, run `cargo install dioxus-cli`). Make sure you have Dioxus CLI installed (if you're unsure, run `cargo install dioxus-cli`).
You can run `dioxus serve` in this directory to start the web server locally, or run You can run `dx serve` in this directory to start the web server locally, or run
`dioxus build --release` to build the project so you can deploy it on a separate web-server. `dx build --release` to build the project so you can deploy it on a separate web-server.
## Project Structure ## Project Structure
``` ```
@ -41,4 +41,4 @@ For service worker scripting (in JavaScript):
* [Service worker guide from PWABuilder](https://docs.pwabuilder.com/#/home/sw-intro) * [Service worker guide from PWABuilder](https://docs.pwabuilder.com/#/home/sw-intro)
* [Service worker examples, also from PWABuilder](https://github.com/pwa-builder/pwabuilder-serviceworkers) * [Service worker examples, also from PWABuilder](https://github.com/pwa-builder/pwabuilder-serviceworkers)
If you want to stay as close to 100% Rust as possible, you can try using [wasi-worker](https://github.com/dunnock/wasi-worker) to replace the JS service worker file. The JSON manifest will still be required though. If you want to stay as close to 100% Rust as possible, you can try using [wasi-worker](https://github.com/dunnock/wasi-worker) to replace the JS service worker file. The JSON manifest will still be required though.

View file

@ -18,7 +18,7 @@ There are plenty Rust Elm-like frameworks in the world - we were not interested
The `RSX` DSL is _barely_ a DSL. Rustaceans will find the DSL very similar to simply assembling nested structs, but without the syntactical overhead of "Default" everywhere or having to jump through hoops with the builder pattern. Between RSX, HTML, the Raw Factory API, and the NodeBuilder syntax, there's plenty of options to choose from. The `RSX` DSL is _barely_ a DSL. Rustaceans will find the DSL very similar to simply assembling nested structs, but without the syntactical overhead of "Default" everywhere or having to jump through hoops with the builder pattern. Between RSX, HTML, the Raw Factory API, and the NodeBuilder syntax, there's plenty of options to choose from.
### What are the build times like? Why on earth would I choose Rust instead of JS/TS/Elm? ### What are the build times like? Why on earth would I choose Rust instead of JS/TS/Elm?
Dioxus builds as roughly as fast as a complex WebPack-TypeScript site. Compile times will be slower than an equivalent TypeScript site, but not unbearably slow. The Wasm compiler backend for Rust is very fast. Iterating on small components is basically instant and larger apps takes a few seconds. In practice, the compiler guarantees of Rust balance out the rebuild times. dx builds as roughly as fast as a complex WebPack-TypeScript site. Compile times will be slower than an equivalent TypeScript site, but not unbearably slow. The Wasm compiler backend for Rust is very fast. Iterating on small components is basically instant and larger apps takes a few seconds. In practice, the compiler guarantees of Rust balance out the rebuild times.
### What about Yew/Seed/Sycamore/Dominator/Dodrio/Percy? ### What about Yew/Seed/Sycamore/Dominator/Dodrio/Percy?
- Yew and Seed use an Elm-like pattern and don't support SSR or any alternate rendering platforms - Yew and Seed use an Elm-like pattern and don't support SSR or any alternate rendering platforms

View file

@ -4,7 +4,7 @@
name = "dioxus-cli" name = "dioxus-cli"
# default platfrom # default platfrom
# you can also use `dioxus serve/build --platform XXX` to use other platform # you can also use `dx serve/build --platform XXX` to use other platform
# value: web | desktop # value: web | desktop
default_platform = "desktop" default_platform = "desktop"
@ -42,4 +42,4 @@ script = []
# use binaryen.wasm-opt for output Wasm file # use binaryen.wasm-opt for output Wasm file
# binaryen just will trigger in `web` platform # binaryen just will trigger in `web` platform
binaryen = { wasm_opt = true } binaryen = { wasm_opt = true }

View file

@ -24,7 +24,7 @@ cargo install --path . --debug
## Get Started ## Get Started
Use `dioxus create project-name` to initialize a new Dioxus project. <br> Use `dx create project-name` to initialize a new Dioxus project. <br>
It will be cloned from the [dioxus-template](https://github.com/DioxusLabs/dioxus-template) repository. It will be cloned from the [dioxus-template](https://github.com/DioxusLabs/dioxus-template) repository.
@ -33,7 +33,7 @@ It will be cloned from the [dioxus-template](https://github.com/DioxusLabs/dioxu
Alternatively, you can specify the template path: Alternatively, you can specify the template path:
``` ```
dioxus create hello --template gh:dioxuslabs/dioxus-template dx create hello --template gh:dioxuslabs/dioxus-template
``` ```
## Dioxus Config File ## Dioxus Config File

View file

@ -2,10 +2,10 @@
In this chapter we will introduce all `dioxus-cli` commands. In this chapter we will introduce all `dioxus-cli` commands.
> You can also use `dioxus --help` to get cli help info. > You can also use `dx --help` to get cli help info.
``` ```
dioxus dioxus
Build, bundle, & ship your Dioxus app Build, bundle, & ship your Dioxus app
USAGE: USAGE:
@ -23,4 +23,4 @@ SUBCOMMANDS:
help Print this message or the help of the given subcommand(s) help Print this message or the help of the given subcommand(s)
serve Build, watch & serve the Rust WASM app and all of its assets serve Build, watch & serve the Rust WASM app and all of its assets
translate Translate some html file into a Dioxus component translate Translate some html file into a Dioxus component
``` ```

View file

@ -1,13 +1,13 @@
# Build # Build
The `dioxus build` command can help you `pack & build` a dioxus project. The `dx build` command can help you `pack & build` a dioxus project.
``` ```
dioxus-build dioxus-build
Build the Rust WASM app and all of its assets Build the Rust WASM app and all of its assets
USAGE: USAGE:
dioxus build [OPTIONS] dx build [OPTIONS]
OPTIONS: OPTIONS:
--example <EXAMPLE> [default: ""] --example <EXAMPLE> [default: ""]
@ -18,7 +18,7 @@ OPTIONS:
You can use this command to build a project: You can use this command to build a project:
``` ```
dioxus build --release dx build --release
``` ```
## Target platform ## Target platform
@ -27,14 +27,14 @@ Use the `platform` option to choose your target platform:
``` ```
# for desktop project # for desktop project
dioxus build --platform desktop dx build --platform desktop
``` ```
`platform` currently only supports `desktop` & `web`. `platform` currently only supports `desktop` & `web`.
``` ```
# for web project # for web project
dioxus build --platform web dx build --platform web
``` ```
## Build Example ## Build Example
@ -43,5 +43,5 @@ You can use the `example` option to select a example to build:
``` ```
# build the `test` example # build the `test` example
dioxus build --exmaple test dx build --exmaple test
``` ```

View file

@ -1,9 +1,9 @@
# Clean # Clean
`dioxus clean` will clear the build artifacts (the out_dir and the cargo cache) `dx clean` will clear the build artifacts (the out_dir and the cargo cache)
``` ```
dioxus-clean dioxus-clean
Clean build artifacts Clean build artifacts
USAGE: USAGE:

View file

@ -1,9 +1,9 @@
# Serve # Serve
The `dioxus serve` can start a dev server with hot-reloading The `dx serve` can start a dev server with hot-reloading
``` ```
dioxus-serve dioxus-serve
Build, watch & serve the Rust WASM app and all of its assets Build, watch & serve the Rust WASM app and all of its assets
USAGE: USAGE:
@ -58,4 +58,4 @@ You can add the `cross-origin-policy` option to change cross-origin header to:
``` ```
dioxus serve --corss-origin-policy dioxus serve --corss-origin-policy
``` ```

View file

@ -1,9 +1,9 @@
# Translate # Translate
`dioxus translate` can translate some `html` file into a Dioxus compoent `dx translate` can translate some `html` file into a Dioxus compoent
``` ```
dioxus-translate dioxus-translate
Translate some source file into a Dioxus component Translate some source file into a Dioxus component
USAGE: USAGE:
@ -65,4 +65,4 @@ fn component(cx: Scope) -> Element {
} }
}) })
} }
``` ```

View file

@ -29,8 +29,8 @@ General application confiration:
# default: web # default: web
default_platform = "web" default_platform = "web"
``` ```
if you change this to `desktop`, the `dioxus build` will default building a desktop app if you change this to `desktop`, the `dx build` will default building a desktop app
3. ***out_dir*** - The directory to place the build artifacts from `dioxus build` or `dioxus service` into. This is also where the `assets` directory will be copied to 3. ***out_dir*** - The directory to place the build artifacts from `dx build` or `dx service` into. This is also where the `assets` directory will be copied to
``` ```
out_dir = "dist" out_dir = "dist"
``` ```

View file

@ -4,7 +4,7 @@ Once you have the Dioxus CLI tool installed, you can use it to create dioxus pro
## Initializing a default project ## Initializing a default project
First, run the `dioxus create` command to create a new project ready to be used with Dioxus and the Dioxus CLI: First, run the `dx create` command to create a new project ready to be used with Dioxus and the Dioxus CLI:
``` ```
dioxus create hello-dioxus dioxus create hello-dioxus

View file

@ -2,7 +2,7 @@
> For Cli 0.2.0 we will add `plugin-develop` support. > For Cli 0.2.0 we will add `plugin-develop` support.
Before the 0.2.0 we use `dioxus tool` to use & install some plugin, but we think that is not good for extend cli program, some people want tailwind support, some people want sass support, we can't add all this thing in to the cli source code and we don't have time to maintain a lot of tools that user request, so maybe user make plugin by themself is a good choice. Before the 0.2.0 we use `dx tool` to use & install some plugin, but we think that is not good for extend cli program, some people want tailwind support, some people want sass support, we can't add all this thing in to the cli source code and we don't have time to maintain a lot of tools that user request, so maybe user make plugin by themself is a good choice.
### Why Lua ? ### Why Lua ?
@ -76,4 +76,4 @@ end
manager.serve.interval = 1000 manager.serve.interval = 1000
return manager return manager
``` ```

View file

@ -4,7 +4,7 @@
name = "{{project-name}}" name = "{{project-name}}"
# default platfrom # default platfrom
# you can also use `dioxus serve/build --platform XXX` to use other platform # you can also use `dx serve/build --platform XXX` to use other platform
# value: web | desktop # value: web | desktop
default_platform = "{{default-platform}}" default_platform = "{{default-platform}}"

View file

@ -161,7 +161,7 @@ pub fn build(config: &CrateConfig, quiet: bool) -> Result<BuildResult> {
} }
} else { } else {
log::warn!( log::warn!(
"Binaryen tool not found, you can use `dioxus tool add binaryen` to install it." "Binaryen tool not found, you can use `dx tool add binaryen` to install it."
); );
} }
} }
@ -200,7 +200,7 @@ pub fn build(config: &CrateConfig, quiet: bool) -> Result<BuildResult> {
} }
} else { } else {
log::warn!( log::warn!(
"Tailwind tool not found, you can use `dioxus tool add tailwindcss` to install it." "Tailwind tool not found, you can use `dx tool add tailwindcss` to install it."
); );
} }
} }

View file

@ -31,7 +31,7 @@ impl Plugin {
} }
} }
Plugin::Add { name: _ } => { Plugin::Add { name: _ } => {
log::info!("You can use `dioxus plugin app-path` to get Installation position"); log::info!("You can use `dx plugin app-path` to get Installation position");
} }
} }
Ok(()) Ok(())

View file

@ -1,7 +1,7 @@
//! Run with: //! Run with:
//! //!
//! ```sh //! ```sh
//! dioxus build --features web //! dx build --features web
//! cargo run --features ssr --no-default-features //! cargo run --features ssr --no-default-features
//! ``` //! ```
@ -21,7 +21,7 @@ fn main() {
{ {
// Start hot reloading // Start hot reloading
hot_reload_init!(dioxus_hot_reload::Config::new().with_rebuild_callback(|| { hot_reload_init!(dioxus_hot_reload::Config::new().with_rebuild_callback(|| {
execute::shell("dioxus build --features web") execute::shell("dx build --features web")
.spawn() .spawn()
.unwrap() .unwrap()
.wait() .wait()

View file

@ -1,7 +1,7 @@
//! Run with: //! Run with:
//! //!
//! ```sh //! ```sh
//! dioxus build --features web //! dx build --features web
//! cargo run --features ssr --no-default-features //! cargo run --features ssr --no-default-features
//! ``` //! ```
@ -22,7 +22,7 @@ fn main() {
{ {
// Start hot reloading // Start hot reloading
hot_reload_init!(dioxus_hot_reload::Config::new().with_rebuild_callback(|| { hot_reload_init!(dioxus_hot_reload::Config::new().with_rebuild_callback(|| {
execute::shell("dioxus build --features web") execute::shell("dx build --features web")
.spawn() .spawn()
.unwrap() .unwrap()
.wait() .wait()

View file

@ -1,7 +1,7 @@
//! Run with: //! Run with:
//! //!
//! ```sh //! ```sh
//! dioxus build --features web //! dx build --features web
//! cargo run --features ssr --no-default-features //! cargo run --features ssr --no-default-features
//! ``` //! ```
@ -21,7 +21,7 @@ fn main() {
{ {
// Start hot reloading // Start hot reloading
hot_reload_init!(dioxus_hot_reload::Config::new().with_rebuild_callback(|| { hot_reload_init!(dioxus_hot_reload::Config::new().with_rebuild_callback(|| {
execute::shell("dioxus build --features web") execute::shell("dx build --features web")
.spawn() .spawn()
.unwrap() .unwrap()
.wait() .wait()

View file

@ -1,7 +1,7 @@
//! Run with: //! Run with:
//! //!
//! ```sh //! ```sh
//! dioxus build --features web //! dx build --features web
//! cargo run --features ssr --no-default-features //! cargo run --features ssr --no-default-features
//! ``` //! ```
@ -21,7 +21,7 @@ fn main() {
{ {
// Start hot reloading // Start hot reloading
hot_reload_init!(dioxus_hot_reload::Config::new().with_rebuild_callback(|| { hot_reload_init!(dioxus_hot_reload::Config::new().with_rebuild_callback(|| {
execute::shell("dioxus build --features web") execute::shell("dx build --features web")
.spawn() .spawn()
.unwrap() .unwrap()
.wait() .wait()

View file

@ -20,7 +20,7 @@ fn main() {
{ {
// Start hot reloading // Start hot reloading
hot_reload_init!(dioxus_hot_reload::Config::new().with_rebuild_callback(|| { hot_reload_init!(dioxus_hot_reload::Config::new().with_rebuild_callback(|| {
execute::shell("dioxus build --features web") execute::shell("dx build --features web")
.spawn() .spawn()
.unwrap() .unwrap()
.wait() .wait()