update: 结构优化

This commit is contained in:
msojocs 2022-02-02 11:26:59 +08:00
parent 3e9c34bf17
commit 0ab1166dc3
11 changed files with 52 additions and 36 deletions

View File

@ -52,6 +52,7 @@ jobs:
mkdir ${{ env. name }} mkdir ${{ env. name }}
find -maxdepth 1 -not -name ${{ env.name }} -not -name . -exec mv {} ${{ env.name }} \; find -maxdepth 1 -not -name ${{ env.name }} -not -name . -exec mv {} ${{ env.name }} \;
ls -l ls -l
cp -r "${{ env.name }}/package.nw/node_modules/nodegit" nodegit
env: env:
name: 'release-${{ github.ref_name }}' name: 'release-${{ github.ref_name }}'

1
.gitignore vendored
View File

@ -2,7 +2,6 @@ arch/
nwjs/ nwjs/
node/ node/
package.nw package.nw
package.nw copy
cache/ cache/
tmp/ tmp/
mew/ mew/

View File

@ -1,7 +0,0 @@
#!/bin/bash
./tools/setup-wechat-devtools &&
tar cvzf wechat-devtools-compact.tar.gz bin conf license.md node nwjs package.nw patch readme.md res tools wine

View File

@ -70,7 +70,7 @@ node-gyp list
# end test # end test
cd /workspace cd /workspace
# rm -rf package.nw # rm -rf node nwjs package.nw
# node nwjs #
# exec ./tools/rebuild-node-modules 0.53.1 # exec ./tools/rebuild-node-modules 0.53.1
exec ./tools/setup-wechat-devtools-bash exec ./tools/setup-wechat-devtools-bash

0
wine/wcc → old/wine/wcc Executable file → Normal file
View File

0
wine/wcsc → old/wine/wcsc Executable file → Normal file
View File

View File

@ -2,6 +2,12 @@
root_dir=$(cd `dirname $0`/.. && pwd -P) root_dir=$(cd `dirname $0`/.. && pwd -P)
export PATH="$root_dir/node/bin:$PATH" export PATH="$root_dir/node/bin:$PATH"
export http_proxy="http://127.0.0.1:54321"
if [[ ! -z $https_proxy || ! -z $http_proxy ]]; then
echo -e "\033[41;37m 警告: 你设置了代理,有可能导致安装出现异常 \033[0m"
fi
PY_VERSION=`python -V 2>&1|awk '{print $2}'|awk -F '.' '{print $1}'` PY_VERSION=`python -V 2>&1|awk '{print $2}'|awk -F '.' '{print $1}'`
echo $PY_VERSION echo $PY_VERSION

6
test/wine-wcc Normal file
View File

@ -0,0 +1,6 @@
#!/bin/sh
root_dir=$(cd `dirname $0`/.. && pwd -P)
export PATH="$root_dir/cache/wechat_devtools_1.05.2201240_x64:$PATH"
execute="$root_dir/cache/wechat_devtools_1.05.2201240_x64/node.exe"
wine $execute -e "require('wcc')"

View File

@ -12,17 +12,6 @@ DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
NW_VERSION=$1 NW_VERSION=$1
package_dir="$DIR/../package.nw" package_dir="$DIR/../package.nw"
if [ -z $NW_VERSION ]; then
echo "NW 版本未指定!"
exit 1
fi
echo -e "\033[42;37m ######## 版本信息 $(date '+%Y-%m-%d %H:%M:%S') ########\033[0m"
echo "目录: $DIR"
echo "NW VERSION: $NW_VERSION"
echo "nw-gyp version: $( nw-gyp --version )"
echo "node version: $(node --version )"
echo "npm version: $(npm --version )"
export PATH="$DIR/../node/bin:$PATH" export PATH="$DIR/../node/bin:$PATH"
PY_VERSION=`python -V 2>&1|awk '{print $2}'|awk -F '.' '{print $1}'` PY_VERSION=`python -V 2>&1|awk '{print $2}'|awk -F '.' '{print $1}'`
if [ $PY_VERSION != 2 ]; then if [ $PY_VERSION != 2 ]; then
@ -34,6 +23,21 @@ hash nw-gyp 2>/dev/null || {
echo "=======请安装nw-gyp=======" echo "=======请安装nw-gyp======="
exit 1 exit 1
} }
if [ -z $NW_VERSION ]; then
echo "NW 版本未指定!"
exit 1
fi
echo -e "\033[42;37m ######## 版本信息 $(date '+%Y-%m-%d %H:%M:%S') ########\033[0m"
echo "目录: $DIR"
echo "NW VERSION: $NW_VERSION"
echo "nw-gyp version: $( nw-gyp --version )"
echo "node version: $(node --version )"
echo "npm version: $(npm --version )"
if [[ ! -z $https_proxy || ! -z $http_proxy ]]; then
echo -e "\033[41;37m 警告: 你设置了代理,这有可能导致安装出现异常 \033[0m"
fi
rm -fr "${package_dir}/node_modules/vscode-windows-ca-certs" # the module is only available in windows rm -fr "${package_dir}/node_modules/vscode-windows-ca-certs" # the module is only available in windows
rm -fr "${package_dir}/node_modules/vscode-windows-registry" # the module is only available in windows rm -fr "${package_dir}/node_modules/vscode-windows-registry" # the module is only available in windows
@ -69,6 +73,7 @@ rm -fr "${package_dir}/node_modules_tmp/node_modules/spdlog-node"
trash \ trash \
vscode-oniguruma \ vscode-oniguruma \
vscode-ripgrep \ vscode-ripgrep \
miniprogram-compiler \
nodegit \ nodegit \
--registry=https://registry.npm.taobao.org \ --registry=https://registry.npm.taobao.org \
--nodegit_binary_host_mirror=https://npm.taobao.org/mirrors/nodegit/v0.27.0/) # reinstall modules --nodegit_binary_host_mirror=https://npm.taobao.org/mirrors/nodegit/v0.27.0/) # reinstall modules
@ -83,6 +88,7 @@ cp -fr "${package_dir}/node_modules_tmp/node_modules/node-pty" "${package_dir}/n
cd "$package_dir/node_modules_tmp/node_modules/native-watchdog" && nw-gyp rebuild --arch=x64 "--target=$NW_VERSION" cd "$package_dir/node_modules_tmp/node_modules/native-watchdog" && nw-gyp rebuild --arch=x64 "--target=$NW_VERSION"
rm -rf "${package_dir}/node_modules/native-watchdog" && cp -fr "${package_dir}/node_modules_tmp/node_modules/native-watchdog" "${package_dir}/node_modules" rm -rf "${package_dir}/node_modules/native-watchdog" && cp -fr "${package_dir}/node_modules_tmp/node_modules/native-watchdog" "${package_dir}/node_modules"
cd "${package_dir}/node_modules_tmp/node_modules/nodegit" && rm -rf .github include src lifecycleScripts vendor utils build/vendor build/Release/.deps
cp -fr "${package_dir}/node_modules_tmp/node_modules/nodegit" "${package_dir}/node_modules" cp -fr "${package_dir}/node_modules_tmp/node_modules/nodegit" "${package_dir}/node_modules"
(cp -fr "${package_dir}/node_modules_tmp/node_modules/oniguruma" "${package_dir}/node_modules_tmp/node_modules/oniguruma-node") (cp -fr "${package_dir}/node_modules_tmp/node_modules/oniguruma" "${package_dir}/node_modules_tmp/node_modules/oniguruma-node")
@ -94,6 +100,11 @@ cp -fr "${package_dir}/node_modules_tmp/node_modules/nodegit" "${package_dir}/no
mkdir -p "${package_dir}/node_modules/vscode-ripgrep/bin" mkdir -p "${package_dir}/node_modules/vscode-ripgrep/bin"
cp -fr "${package_dir}/node_modules_tmp/node_modules/vscode-ripgrep/bin/rg" "${package_dir}/node_modules/vscode-ripgrep/bin/rg" cp -fr "${package_dir}/node_modules_tmp/node_modules/vscode-ripgrep/bin/rg" "${package_dir}/node_modules/vscode-ripgrep/bin/rg"
# wcc wcsc
cd "${package_dir}/js/vendor/" && rm -rf "wcc.exe" "wcsc.exe"
cp "${package_dir}/node_modules_tmp/node_modules/miniprogram-compiler/bin/linux/wcc" "${package_dir}/js/vendor/wcc.exe"
cp "${package_dir}/node_modules_tmp/node_modules/miniprogram-compiler/bin/linux/wcsc" "${package_dir}/js/vendor/wcsc.exe"
rm -rf "${package_dir}/node_modules_tmp" rm -rf "${package_dir}/node_modules_tmp"
# 移除旧配置 # 移除旧配置

View File

@ -268,22 +268,22 @@ const patch_wechat_devtools = function () {
}); });
}); });
}; };
const patch_wcc_wcsc = function () { // const patch_wcc_wcsc = function () {
info("Patching wcc and wcsc"); // info("Patching wcc and wcsc");
return new Promise((resolve, reject) => { // return new Promise((resolve, reject) => {
fs.copyFileSync( // fs.copyFileSync(
path.resolve(__dirname, "../compiler/wcc"), // path.resolve(__dirname, "../compiler/wcc"),
path.resolve(__dirname, "../package.nw/js/vendor/wcc.exe") // path.resolve(__dirname, "../package.nw/js/vendor/wcc.exe")
); // );
fs.copyFileSync( // fs.copyFileSync(
path.resolve(__dirname, "../compiler/wcsc"), // path.resolve(__dirname, "../compiler/wcsc"),
path.resolve(__dirname, "../package.nw/js/vendor/wcsc.exe") // path.resolve(__dirname, "../package.nw/js/vendor/wcsc.exe")
); // );
resolve(); // resolve();
}); // });
}; // };
const start = async () => { const start = async () => {
try { try {
@ -296,7 +296,7 @@ const start = async () => {
await patch_wechat_devtools_CLI(); await patch_wechat_devtools_CLI();
await rebuild_wechat_devtools_node_modules(); await rebuild_wechat_devtools_node_modules();
await patch_wechat_devtools(); await patch_wechat_devtools();
await patch_wcc_wcsc(); // await patch_wcc_wcsc();
console.log( console.log(
`Succeeded upgrading wechat-devtools to version ${version}` `Succeeded upgrading wechat-devtools to version ${version}`
); );