mirror of
https://github.com/msojocs/wechat-web-devtools-linux.git
synced 2025-07-22 00:00:04 +08:00
feat: 版本指定与保存功能
This commit is contained in:
parent
18e80ba04f
commit
a5bb4e44b9
1
conf/devtools_v
Normal file
1
conf/devtools_v
Normal file
@ -0,0 +1 @@
|
|||||||
|
1.05.2203030
|
@ -60,8 +60,28 @@ fi
|
|||||||
# export PATH="$root_dir/tmp/7z:$PATH"
|
# export PATH="$root_dir/tmp/7z:$PATH"
|
||||||
|
|
||||||
echo "==========Initializing wechat-devtools package=========="
|
echo "==========Initializing wechat-devtools package=========="
|
||||||
if [ -f "$root_dir/package.nw/package.json" ]; then
|
|
||||||
success "微信开发者工具安装完毕"
|
if [[ $@ == *version* ]];then
|
||||||
|
# 参数有版本号,优先级高,清空TARGET_VERSION
|
||||||
|
echo "参数有版本号"
|
||||||
|
TARGET_VERSION=""
|
||||||
else
|
else
|
||||||
node "$root_dir/tools/update-wechat-devtools-node" $@
|
# 参数没有版本号,获取
|
||||||
fi
|
echo "参数没有版本号"
|
||||||
|
TARGET_VERSION="version="$( cat "$root_dir/conf/devtools_v")
|
||||||
|
fi
|
||||||
|
echo "TARGET_VERSION: $TARGET_VERSION"
|
||||||
|
if [ ! -f "$root_dir/package.nw/package.json" ];then
|
||||||
|
# 没装,直接装
|
||||||
|
node "$root_dir/tools/update-wechat-devtools-node" $TARGET_VERSION $@
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
# 装了,获取已安装版本
|
||||||
|
DEVTOOLS_VERSION=$( cat "$root_dir/package.nw/package.json" | grep -m 1 -Eo "\"[0-9]{1}\.[0-9]{2}\.[0-9]+" )
|
||||||
|
DEVTOOLS_VERSION="${DEVTOOLS_VERSION//\"/}"
|
||||||
|
# 已安装, 比较目标版本
|
||||||
|
if [ "$TARGET_VERSION" == "$DEVTOOLS_VERSION" ];then
|
||||||
|
success "微信开发者工具安装完毕"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
node "$root_dir/tools/update-wechat-devtools-node" $TARGET_VERSION $@
|
||||||
|
@ -16,6 +16,8 @@ const urls = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const arguments = process.argv.slice(2);
|
const arguments = process.argv.slice(2);
|
||||||
|
console.log(arguments)
|
||||||
|
|
||||||
const args = {};
|
const args = {};
|
||||||
for (let arg of arguments) {
|
for (let arg of arguments) {
|
||||||
let t = arg.split("=");
|
let t = arg.split("=");
|
||||||
@ -334,6 +336,11 @@ const start = async () => {
|
|||||||
path.resolve(__dirname, "../package.nw/.build_time"),
|
path.resolve(__dirname, "../package.nw/.build_time"),
|
||||||
"" + parseInt(new Date().getTime() / 1000)
|
"" + parseInt(new Date().getTime() / 1000)
|
||||||
);
|
);
|
||||||
|
// 写入版本
|
||||||
|
fs.writeFileSync(
|
||||||
|
path.resolve(__dirname, "../conf/devtools_v"),
|
||||||
|
version
|
||||||
|
)
|
||||||
console.log(
|
console.log(
|
||||||
`Succeeded upgrading wechat-devtools to version ${version}`
|
`Succeeded upgrading wechat-devtools to version ${version}`
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user