新增微信开发者工具

master
yutent 2023-09-26 14:33:19 +08:00
parent 7797106e3b
commit 5828d2c102
3 changed files with 129 additions and 2 deletions

View File

@ -12,6 +12,10 @@
- `bun` Incredibly fast JavaScript runtime
- `nodejs` Node.js event-based server-side javascript engine
- `zellij` A terminal workspace with batteries included
- `fcitx5-skin-plain` fcitx5皮肤
- `fcitx5-skin-plain` fcitx5皮肤
- `wechat-devtools` 微信开发工具

View File

@ -2,7 +2,7 @@
app_name="bun"
tmp_dir="/tmp/${app_name}_tmp"
version="1.0.2"
version="1.0.3"
release="v${version}"
pkg_arch="x64"
deb_arch="amd64"

123
wechat-devtools/package.sh Executable file
View File

@ -0,0 +1,123 @@
#!/bin/bash
app_name="wechat-devtools"
tmp_dir="/tmp/${app_name}_tmp"
version="1.06.2307260-2"
release="v${version}"
deb_url="https://github.com/msojocs/wechat-web-devtools-linux/releases/download/${release}/io.github.msojocs.wechat-devtools-linux_${version}_amd64.deb"
# 创建临时目录, 用于下载官方包
if [ -d $tmp_dir ]; then
rm -rf $tmp_dir
fi
if [ "$1" == "" ]; then
if [ -d "./unpack" ]; then
sudo rm -rf ./unpack
fi
if [ -f "./${app_name}_${version}.deb" ]; then
rm "./${app_name}_${version}.deb"
fi
mkdir $tmp_dir
# 创建临时待打包目录
echo "创建待打包目录..."
mkdir -p "./unpack/DEBIAN"
mkdir -p "./unpack/usr/bin"
mkdir -p "./unpack/usr/lib/${app_name}"
mkdir -p "./unpack/usr/share/applications"
source_dir="${tmp_dir}/${app_name}/opt/apps/io.github.msojocs.wechat-devtools-linux"
echo "下载官方原包..."
# wget $deb_url -O "${tmp_dir}/${app_name}.deb"
cp "$HOME/Downloads/io.github.msojocs.wechat-devtools-linux_${version}_amd64.deb" "${tmp_dir}/${app_name}.deb"
echo "下载完成, 解包中..."
dpkg-deb -R "${tmp_dir}/${app_name}.deb" "${tmp_dir}/${app_name}"
echo "解包完成, 复制到待打包目录..."
mv "${source_dir}/files/bin/bin" "./unpack/usr"
mv "${source_dir}/files/bin/nwjs" "./unpack/usr/lib/${app_name}"
mv "${source_dir}/files/bin/package.nw" "./unpack/usr/lib/${app_name}"
mv "${source_dir}/entries/icons" "./unpack/usr/share"
rm -rf "./unpack/usr/lib/${app_name}/package.nw/node_modules/wcc/bin/mac"
rm -rf "./unpack/usr/lib/${app_name}/package.nw/node_modules/wcc/bin/windows"
cp "./unpack/usr/lib/${app_name}/nwjs/locales/en-US.pak" "$tmp_dir/en-US.pak"
cp "./unpack/usr/lib/${app_name}/nwjs/locales/en-US.pak.info" "$tmp_dir/en-US.pak.info"
cp "./unpack/usr/lib/${app_name}/nwjs/locales/zh-CN.pak" "$tmp_dir/zh-CN.pak"
cp "./unpack/usr/lib/${app_name}/nwjs/locales/zh-CN.pak.info" "$tmp_dir/zh-CN.pak.info"
rm -rf ./unpack/usr/lib/${app_name}/nwjs/locales/*
cp "$tmp_dir/en-US.pak" "./unpack/usr/lib/${app_name}/nwjs/locales/"
cp "$tmp_dir/en-US.pak.info" "./unpack/usr/lib/${app_name}/nwjs/locales/"
cp "$tmp_dir/zh-CN.pak" "./unpack/usr/lib/${app_name}/nwjs/locales/"
cp "$tmp_dir/zh-CN.pak.info" "./unpack/usr/lib/${app_name}/nwjs/locales/"
rm -rf $tmp_dir
echo "复制完成, 创建可执行文件及程序桌面入口文件..."
echo """
[Desktop Entry]
Name=WeChat Dev Tools
Name[zh_CN]=微信开发者工具
Comment=The development tools for wechat projects
Comment[zh_CN]=提供微信开发相关项目的开发IDE支持
Categories=Development;WebDevelopment;IDE;
Exec=wechat-devtools
Icon=wechat-devtools
Type=Application
Terminal=false
StartupWMClass=wechat-devtools
Actions=
MimeType=x-scheme-handler/wechatide
""" > ./unpack/usr/share/applications/wechat-devtools.desktop
echo "文件复制完成, 手动修改启动脚本..."
elif [ "$1" == "pack" ]; then
cd ./unpack
find usr/ -type f | xargs -I {} md5sum {} > DEBIAN/md5sums
IFS=$'\t' read -ra size <<< "$(du -d 0)"
echo """
Package: ${app_name}
Version: ${version}
Architecture: amd64
Maintainer: Yutent <yutent.io@gmail.com>
Breaks: io.github.msojocs.wechat-devtools-no-wine
Replaces: io.github.msojocs.wechat-devtools-no-wine
Installed-Size: ${size[0]}
Section: development
Priority: optional
Description: WeChat Devtools For Linux.
To help developers develop and debug Weixin Mini Programs more simply and efficiently,
Tencent have launched the new Weixin DevTools based on the original Official Account
web debugging tools. Therefore, we now have two developer modes (Official Account web
debugging) and (Mini Program debugging). This version is unofficial.
""" > DEBIAN/control
echo '计算文件md5完成, 打包中...'
cd ../
sudo chown -R root:root unpack
dpkg-deb -b ./unpack "./${app_name}_${version}.deb"
sudo rm -rf ./unpack
echo "打包完成 :)"
fi