Skip to content

Commit

Permalink
chore: update workspace script
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhengqbbb committed Dec 6, 2023
1 parent a02b7d1 commit 3c878c2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 55 deletions.
52 changes: 8 additions & 44 deletions .x-cmd/release
Original file line number Diff line number Diff line change
@@ -1,30 +1,12 @@
# shellcheck shell=dash
(

# Section: Arg
WORK_DIR="$(x wsroot)"
DIST_PATH="$WORK_DIR"/docs/.vitepress/dist
GITHUB_URL="https://${github_access_token}@github.com/Zhengqbbb/cz-git.git"
BRANCH_NAME=gh-page

# Section: Fuction
deploy() {
param:dsl '
type:
Type = cz brew docs all next
Realse = patch minor major prepatch
options:
--cmd "select target dev command" <>:Type
--version "select realse version" <>:Realse
'
param:run
deploy_"${cmd}" "$version"
}

deploy_all() {
[ -z "$github_access_token" ] && printf "%s\n" "please provide token" && return 1
deploy_cz "$@"
deploy_docs "$@"
x tui form \
_version "select realse version" "" = patch minor major prepatch
[ -n "$_version" ] || return
deploy_cz "$_version"
}

deploy_cz() {
Expand All @@ -47,31 +29,13 @@ deploy_next() {
}

deploy_brew() {
param:dsl '
options:
--version "input version (e.g 1.3.9)" <>:
'
param:run
[ -n "$(command -v brew)" ] || return 1
cd "$(brew --repository)" || return 1
x tui form \
_version "input version (e.g 1.3.9)" ""
[ -n "$(command -v brew)" ] || return
cd "$(brew --repository)" || return
brew bump-formula-pr --url "https://registry.npmjs.org/czg/-/czg-${version}.tgz" czg
}

deploy_docs() {
pnpm docs:build
[ ! -d "$DIST_PATH" ] && return 1
cd "$DIST_PATH" || exit

echo 'cz-git.qbb.sh' > CNAME
[ -d "$DIST_PATH/.git" ] && rm -rf "$DIST_PATH/.git"
git init \
&& git remote add origin "$GITHUB_URL" \
&& git checkout -b $BRANCH_NAME \
&& git add -A \
&& git commit -m 'build: :books: deploy docs' \
&& git push -f "$GITHUB_URL" $BRANCH_NAME
}

# Section: Main
case "${1}" in
cz) shift; deploy_cz "$@" ;;
Expand Down
17 changes: 6 additions & 11 deletions .x-cmd/search
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,16 @@ DOC_SEARCH_CONFIG_FILE=$WORK_DIR/docs/.vitepress/build/docSearchConfig.json

# Section: Fuction
search() {
param:dsl '
type:
Type = only_console all google baidu bing docsearch
options:
--cmd "select target search command" <>:Type
'
param:run
search_"${cmd}"
local _command=""
x tui form --ctrl_exit_strategy \
_command "select target search command" "only_console" = only_console all google baidu bing docsearch
[ -n "$_command" ] || return 1
search_"${_command}"
}

log() {
printf "\n\033[1;32m%s \033[1;33m%s \033[1;32m%s\033[0m\n" \
"»»»" \
"$1" \
"«««"
"»»»" "$1" "«««"
}

search_all() {
Expand Down

0 comments on commit 3c878c2

Please sign in to comment.