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

build(task-runner): add self-documented task runner #486

Merged
merged 4 commits into from
Apr 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,6 @@ Cargo.lock
# doing this because of how our tests currently (naively) drop the tauri.conf.js in that folder
# todo: needs a proper fic
/cli/tauri.js/tauri.conf.js

# doing this because the task-runner (`mask prepare`) will clone gh:tauri-apps/examples
/examples
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ members = [
"tauri",
"tauri-api",
"tauri-updater",
"tauri-utils"
"tauri-utils",
]
exclude = [
"examples",
]
75 changes: 75 additions & 0 deletions maskfile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Shorthand Commands

## prepare
> Setup all stuffs needed for runing the examples

```sh
git clone --recursive [email protected]:tauri-apps/examples.git \
|| (cd examples && git pull origin master; cd ..) # always prepare up-to-date examples in case it's already available

export TAURI_DIST_DIR=$PWD/tauri/test/fixture/dist
export TAURI_DIR=$PWD/tauri/test/fixture/src-tauri

cargo build
cargo install --path cli/tauri-bundler --force
cargo install cargo-web # used by example rust/yew

cd cli/tauri.js
yarn && yarn build
```

## run

![tauri-mask-run-example](https://user-images.githubusercontent.com/4953069/75866011-00ed8600-5e37-11ea-9106-3cb104a05f80.gif)

### run example (example)
> Run specific example in dev mode

```sh
source .scripts/init_env.sh
shopt -s globstar

cd examples/**/$example 2>/dev/null \
|| cd examples/**/$example/$example # workaround for rust/yew/todomvc/todomvc

case "$PWD" in
*/node/*)
yarn && yarn tauri:source dev
;;
*/rust/*)
cargo web deploy
[ $example = `basename $(dirname $PWD)` ] && cd ..

yarn add tauri@link:../../../cli/tauri.js
yarn && yarn tauri dev
;;
*)
echo unknown project $(dirname $example)/$example
;;
esac
```

## list

### list examples
> List all available examples

```sh
find examples/*/*/* -maxdepth 0 -type d -not -path '*.git*' \
-exec sh -c 'echo $(basename $(dirname {}))/$(basename {})' \;
```

## clean
> Remove installed dependencies and reset examples in case something gone wrong

```sh
cargo uninstall tauri-bundler
cargo clean

shopt -s globstar
rm -r **/node_modules

cd examples
git checkout -- . # discard all unstaged changes
git clean -dfX # remove all untracked files & directories
```