update: 优化cli

update: 优化项目路径处理
This commit is contained in:
msojocs 2022-04-12 23:01:48 +08:00
parent afe64f9042
commit 6ebac53707
4 changed files with 24 additions and 25 deletions

View File

@ -1,6 +1,12 @@
#!/bin/bash
root_dir=$(cd `dirname $0`/.. && pwd -P)
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
root_dir="$( cd -P "$( dirname "$SOURCE" )"/.. >/dev/null 2>&1 && pwd )"
# 数据目录处理
if [ -z $XDG_CONFIG_HOME ];then

View File

@ -6,27 +6,12 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
root_dir="$( cd -P "$( dirname "$SOURCE" )"/.. >/dev/null 2>&1 && pwd )"
cd $DIR/..
cd $root_dir
export WECHAT_DEVTOOLS_DIR="$DIR/../nwjs"
export APPDATA="$DIR/../nwjs"
export PATH="$DIR/../wine:$DIR/../node/bin:$DIR/../nwjs:$PATH"
export WECHAT_DEVTOOLS_DIR="$root_dir/nwjs"
export APPDATA="$root_dir/nwjs"
export PATH="$root_dir/wine:$root_dir/node/bin:$root_dir/nwjs:$PATH"
$DIR/../tools/wechat-devtools-cli "$@"
# #!/bin/bash
# root_dir=$(cd `dirname $0`/.. && pwd -P)
# echo "cli"
# export WECHAT_DEVTOOLS_DIR="$root_dir/nwjs"
# export APPDATA="$HOME/.config"
# export USERPROFILE="$root"
# export PATH="$root_dir/wine:$root_dir/node/bin:$root_dir/nwjs:$PATH"
# export CALLING_DIR=$root_dir
# node $root_dir/bin/cli.js "$@"
# cd $root_dir
node $root_dir/package.nw/js/common/cli/index.js "$@"

11
test/buid-deepin.sh Normal file
View File

@ -0,0 +1,11 @@
#!/bin/bash
root_dir=$(cd `dirname $0`/.. && pwd -P)
cd $root_dir
export NO_WINE=false
docker-compose up
$root_dir/tools/build-deepin.sh $@
export NO_WINE=true
$root_dir/tools/fix-core.sh
$root_dir/tools/fix-other.sh
$root_dir/tools/build-deepin.sh $@

View File

@ -1,3 +0,0 @@
#!/usr/bin/env node
require("../nwjs/package.nw/js/common/cli/index.js");