mirror of
https://github.com/msojocs/wechat-web-devtools-linux.git
synced 2025-07-22 00:00:04 +08:00
feat: reduce wine
This commit is contained in:
parent
656a3ddfec
commit
1c0780298b
74
.github/workflows/release.yml
vendored
74
.github/workflows/release.yml
vendored
@ -9,7 +9,7 @@ on:
|
|||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- v*
|
- v*
|
||||||
branches: [ master ]
|
branches: [ master, reduce-wine]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ master ]
|
branches: [ master ]
|
||||||
# # Allows you to run this workflow manually from the Actions tab
|
# # Allows you to run this workflow manually from the Actions tab
|
||||||
@ -57,41 +57,55 @@ jobs:
|
|||||||
- name: Build
|
- name: Build
|
||||||
run: docker-compose up
|
run: docker-compose up
|
||||||
|
|
||||||
- name: Build AppImage
|
- name: Refactor Directory Structure
|
||||||
run: |
|
run: |
|
||||||
sudo chmod -R 777 tmp package.nw node
|
sudo chmod -R 777 package.nw node
|
||||||
bash tools/appimage.sh
|
ls -l
|
||||||
wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
|
sudo rm -rf cache tmp .git
|
||||||
chmod a+x appimagetool-x86_64.AppImage
|
mkdir ${{ env. name }}
|
||||||
./appimagetool-x86_64.AppImage ./tmp/AppDir
|
sudo find -maxdepth 1 -not -name ${{ env.name }} -not -name . -exec mv {} ${{ env.name }} \;
|
||||||
|
sudo cp -r "${{ env.name }}/package.nw/node_modules/nodegit" nodegit
|
||||||
|
sudo cp -r "${{ env.name }}/compiler" compiler
|
||||||
|
ls -l
|
||||||
env:
|
env:
|
||||||
name: 'release-${{ steps.tag.outputs.tag }}'
|
name: 'WeChat_Dev_Tools_${{ steps.tag.outputs.tag }}'
|
||||||
ARCH: '${{ matrix.ARCH }}'
|
|
||||||
|
|
||||||
- name: Delete unused file
|
|
||||||
run: |
|
|
||||||
ls -l
|
|
||||||
sudo rm -rf cache tmp appimagetool-x86_64.AppImage
|
|
||||||
mkdir ${{ env. name }}
|
|
||||||
sudo find -maxdepth 1 -not -name ${{ env.name }} -not -name . -exec mv {} ${{ env.name }} \;
|
|
||||||
sudo cp -r "${{ env.name }}/package.nw/node_modules/nodegit" nodegit
|
|
||||||
sudo cp -r "${{ env.name }}/compiler" compiler
|
|
||||||
sudo mv ${{ env.name }}/WeChat*.AppImage .
|
|
||||||
ls -l
|
|
||||||
cd "${{ env.name }}"
|
|
||||||
env:
|
|
||||||
name: 'release-${{ steps.tag.outputs.tag }}'
|
|
||||||
|
|
||||||
- name: Compress
|
- name: Compress
|
||||||
run: |
|
run: |
|
||||||
ls -l
|
ls -l
|
||||||
tar -zvcf ${{ env.name }}.tar.gz ${{ env.name }}
|
|
||||||
tar -zvcf compiler.tar.gz compiler
|
tar -zvcf compiler.tar.gz compiler
|
||||||
tar -zvcf nodegit.tar.gz nodegit
|
tar -zvcf nodegit.tar.gz nodegit
|
||||||
sudo rm -rf ${{ env.name }} compiler nodegit
|
sudo rm -rf compiler nodegit
|
||||||
ls -l
|
ls -l
|
||||||
env:
|
env:
|
||||||
name: 'release-${{ steps.tag.outputs.tag }}'
|
name: 'WeChat_Dev_Tools_${{ steps.tag.outputs.tag }}'
|
||||||
|
|
||||||
|
- name: Build AppImage && Pack
|
||||||
|
run: |
|
||||||
|
bash ./${{ env.name }}/tools/appimage.sh
|
||||||
|
wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
|
||||||
|
chmod a+x appimagetool-x86_64.AppImage
|
||||||
|
# build AppImage
|
||||||
|
./appimagetool-x86_64.AppImage ./${{ env.name }}/tmp/AppDir ${{ env.name }}_${{ env.ARCH }}_wine.AppImage
|
||||||
|
# pack
|
||||||
|
tar -zvcf ${{ env.name }}_${{ env.ARCH }}_wine.tar.gz ${{ env.name }}
|
||||||
|
|
||||||
|
# reduce wine
|
||||||
|
export REDUCE_WINE=true
|
||||||
|
bash ${{ env.name }}/tools/fix-core
|
||||||
|
bash ${{ env.name }}/tools/fix-other
|
||||||
|
bash ./${{ env.name }}/tools/appimage.sh
|
||||||
|
# build AppImage
|
||||||
|
./appimagetool-x86_64.AppImage ./${{ env.name }}/tmp/AppDir ${{ env.name }}_${{ env.ARCH }}_reduce_wine.AppImage
|
||||||
|
# pack
|
||||||
|
tar -zvcf ${{ env.name }}_${{ env.ARCH }}_reduce_wine.tar.gz ${{ env.name }}
|
||||||
|
|
||||||
|
sudo rm -rf appimagetool-x86_64.AppImage ${{ env.name }}
|
||||||
|
ls -l
|
||||||
|
env:
|
||||||
|
name: 'WeChat_Dev_Tools_${{ steps.tag.outputs.tag }}'
|
||||||
|
ARCH: '${{ matrix.ARCH }}'
|
||||||
|
|
||||||
|
|
||||||
- name: Create release and upload artifacts
|
- name: Create release and upload artifacts
|
||||||
if: startsWith(github.ref, 'refs/heads/')
|
if: startsWith(github.ref, 'refs/heads/')
|
||||||
@ -111,9 +125,5 @@ jobs:
|
|||||||
name: ${{ steps.tag.outputs.name }}
|
name: ${{ steps.tag.outputs.name }}
|
||||||
tag_name: ${{ steps.tag.outputs.tag }}
|
tag_name: ${{ steps.tag.outputs.tag }}
|
||||||
files: |
|
files: |
|
||||||
${{ env.name }}.tar.gz
|
*.tar.gz
|
||||||
compiler.tar.gz
|
*.AppImage
|
||||||
nodegit.tar.gz
|
|
||||||
*.AppImage
|
|
||||||
env:
|
|
||||||
name: 'release-${{ steps.tag.outputs.tag }}'
|
|
@ -7,9 +7,28 @@ export APPDATA="$( echo ~ )/.config/wechat_devtools"
|
|||||||
export PATH="$root_dir/wine:$root_dir/node/bin:$root_dir/nwjs:$PATH"
|
export PATH="$root_dir/wine:$root_dir/node/bin:$root_dir/nwjs:$PATH"
|
||||||
export USERPROFILE=$( echo ~ )
|
export USERPROFILE=$( echo ~ )
|
||||||
|
|
||||||
if [ -d ~/.config/wechat_devtools/WeappCache ];then
|
current=`date "+%Y-%m-%d %H:%M:%S"`
|
||||||
echo "删除缓存"
|
timeStamp=`date -d "$current" +%s`
|
||||||
rm -rf ~/.config/wechat_devtools/WeappCache
|
|
||||||
|
# 获取首次运行时间
|
||||||
|
if [[ -f "$APPDATA/.run_time" ]];then
|
||||||
|
run_time=`cat "$APPDATA/.run_time"`
|
||||||
|
else
|
||||||
|
run_time=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 获取构建时间
|
||||||
|
if [[ -f "$root_dir/package.nw/.build_time" ]];then
|
||||||
|
build_time=`cat "$root_dir/package.nw/.build_time"`
|
||||||
|
else
|
||||||
|
build_time=timeStamp
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! $build_time < $run_time ]];then
|
||||||
|
echo "清理缓存"
|
||||||
|
echo $timeStamp > "$APPDATA/.run_time"
|
||||||
|
rm -rf "$APPDATA/WeappCache"
|
||||||
|
rm -rf "$APPDATA/WeappVendor"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
EXTENSION1="--load-extension=$root_dir/nwjs/package.nw/js/ideplugin"
|
EXTENSION1="--load-extension=$root_dir/nwjs/package.nw/js/ideplugin"
|
||||||
|
84
compiler/generatemd5.js
Normal file
84
compiler/generatemd5.js
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
const path = require('path')
|
||||||
|
const fs = require('fs')
|
||||||
|
const crypto = require('crypto')
|
||||||
|
const os = require('os')
|
||||||
|
const child_process = require('child_process')
|
||||||
|
let platform = process.argv[2]
|
||||||
|
|
||||||
|
let exeList = []
|
||||||
|
const macExeList = [
|
||||||
|
'wcc',
|
||||||
|
'wcsc',
|
||||||
|
'wcc.bin'
|
||||||
|
]
|
||||||
|
const winExeList = [
|
||||||
|
'wcc.exe',
|
||||||
|
'wcsc.exe'
|
||||||
|
]
|
||||||
|
if(platform === 'darwin') {
|
||||||
|
exeList = macExeList;
|
||||||
|
} else if(platform === 'win32') {
|
||||||
|
exeList= winExeList;
|
||||||
|
} else {
|
||||||
|
exeList = macExeList.concat(winExeList)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function generate(vendorPath) {
|
||||||
|
let dirList = fs.readdirSync(vendorPath)
|
||||||
|
console.log(dirList)
|
||||||
|
let libs = {}
|
||||||
|
dirList.forEach((item) => {
|
||||||
|
if (item == 'dev' || item == 'quickstart' || item == 'beta') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let itemPath = path.join(vendorPath, item)
|
||||||
|
let stat = fs.statSync(itemPath)
|
||||||
|
if (stat.isDirectory()) {
|
||||||
|
let fileList = fs.readdirSync(itemPath)
|
||||||
|
|
||||||
|
let md5Info = {}
|
||||||
|
fileList.forEach((file) => {
|
||||||
|
if (fs.statSync(path.join(itemPath, file)).isFile()) {
|
||||||
|
let fileData = fs.readFileSync(path.join(itemPath, file))
|
||||||
|
let md5sum = crypto.createHash('md5')
|
||||||
|
md5sum.update(fileData)
|
||||||
|
md5Info[file] = md5sum.digest('hex')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
libs[item] = md5Info
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
let oldConfig = JSON.parse(fs.readFileSync(path.join(vendorPath, 'config.json'), 'utf8'))
|
||||||
|
for (var key in oldConfig.libs) {
|
||||||
|
// libs[key] = Object.assign({}, oldConfig.libs[key], libs[key])
|
||||||
|
oldConfig.libs[key] = Object.assign({}, oldConfig.libs[key], libs[key])
|
||||||
|
}
|
||||||
|
|
||||||
|
// let newLib = {}
|
||||||
|
// let keys = Object.keys(libs)
|
||||||
|
// keys.sort()
|
||||||
|
// for (var i = 0; i < keys.length; i++) {
|
||||||
|
// let key = keys[i]
|
||||||
|
// newLib[key] = libs[key]
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 更新
|
||||||
|
oldConfig.configVersion = Date.now()
|
||||||
|
|
||||||
|
for (let key in exeList) {
|
||||||
|
let file = exeList[key]
|
||||||
|
let fileData = fs.readFileSync(path.join(vendorPath, file))
|
||||||
|
let md5sum = crypto.createHash('md5')
|
||||||
|
md5sum.update(fileData)
|
||||||
|
oldConfig[file] = md5sum.digest('hex')
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.writeFileSync(path.join(vendorPath, 'config.json'), JSON.stringify(oldConfig, null, '\t'))
|
||||||
|
}
|
||||||
|
|
||||||
|
generate(__dirname)
|
@ -8,4 +8,8 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli
|
|||||||
done
|
done
|
||||||
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
|
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
|
||||||
|
|
||||||
wine "$DIR/wcc.exe" "$@"
|
if [[ $@ =~ -ll ]];then
|
||||||
|
wine "$DIR/wcc.exe" "$@"
|
||||||
|
else
|
||||||
|
"$DIR/wcc.bin" "$@"
|
||||||
|
fi
|
||||||
|
@ -8,4 +8,9 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli
|
|||||||
done
|
done
|
||||||
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
|
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
|
||||||
|
|
||||||
wine "$DIR/wcsc.exe" "$@"
|
if [[ $@ =~ -ll ]];then
|
||||||
|
wine "$DIR/wcsc.exe" "$@"
|
||||||
|
else
|
||||||
|
"$DIR/wcsc.bin" "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
10
readme.md
10
readme.md
@ -66,7 +66,13 @@ Docker容器启动方法
|
|||||||
|
|
||||||
如需要映射外部目录,请自行修改Docker启动命令
|
如需要映射外部目录,请自行修改Docker启动命令
|
||||||
|
|
||||||
# 构筑方法0(推荐)
|
# 自行构建
|
||||||
|
|
||||||
|
> 注:
|
||||||
|
> 如需进行降低`wine`依赖的操作,请添加环境变量:`REDUCE_WINE=true`
|
||||||
|
|
||||||
|
|
||||||
|
## 构筑方法0(推荐)
|
||||||
|
|
||||||
理论上此方法99%成功;在网络不稳定时容易失败(原因懂得都懂)
|
理论上此方法99%成功;在网络不稳定时容易失败(原因懂得都懂)
|
||||||
|
|
||||||
@ -87,7 +93,7 @@ docker-compose up
|
|||||||
|
|
||||||
之后即可通过点击应用图标启动微信开发者工具,也可以运行`bin/wechat-devtools`通过命令行启动
|
之后即可通过点击应用图标启动微信开发者工具,也可以运行`bin/wechat-devtools`通过命令行启动
|
||||||
|
|
||||||
# 构筑方法1
|
## 方法1
|
||||||
|
|
||||||
由于使用到`node-gyp` `nw-gyp`,此方法会受`python`、`node`版本影响出现一些难以预料的异常(比如使用`node15.0.1`时,大部分模块构建会被忽略,但没有任何报错信息)。但是,`Docker`构建方式会帮你处理好这些问题。
|
由于使用到`node-gyp` `nw-gyp`,此方法会受`python`、`node`版本影响出现一些难以预料的异常(比如使用`node15.0.1`时,大部分模块构建会被忽略,但没有任何报错信息)。但是,`Docker`构建方式会帮你处理好这些问题。
|
||||||
|
|
||||||
|
7
test/reduce-wine
Normal file
7
test/reduce-wine
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
export REDUCE_WINE=true
|
||||||
|
|
||||||
|
|
||||||
|
root_dir=$(cd `dirname $0`/.. && pwd -P)
|
||||||
|
$root_dir/tools/fix-core
|
||||||
|
$root_dir/tools/fix-other
|
@ -1,13 +1,19 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
if [[ $REDUCE_WINE == 'true' ]];then
|
||||||
|
echo "not wine"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $@ =~ -ll ]];then
|
||||||
|
echo "include"
|
||||||
|
fi
|
||||||
|
exit
|
||||||
|
|
||||||
|
echo "$@ $0 $1 $2"
|
||||||
|
|
||||||
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
|
||||||
|
@ -17,25 +17,48 @@ node "$root_dir/tools/wxvpkg/unpack" "$package_dir/core.wxvpkg" "$tmp_dir/core.w
|
|||||||
#
|
#
|
||||||
|
|
||||||
# find
|
# find
|
||||||
open_find_result=$( grep -lr "this.props.onWindowOpenFail());" "$tmp_dir/core.wxvpkg" )
|
open_find_result=$( grep -lr "this.props.onWindowOpenFail());if" "$tmp_dir/core.wxvpkg" )
|
||||||
echo "云开发控制台启动点: $open_find_result"
|
echo "云开发控制台启动点: $open_find_result"
|
||||||
# replace
|
if [[ ! -z $open_find_result ]];then
|
||||||
new_cb_handle="this.props.onWindowOpenFail());Object.keys(window).forEach(key=>{if(!e.window[key]){try{e.window[key]=window[key];}catch(e){console.error(e);}}});"
|
# replace
|
||||||
sed -i "s/this.props.onWindowOpenFail());/$new_cb_handle/g" $open_find_result
|
new_cb_handle="this.props.onWindowOpenFail());Object.keys(window).forEach(key=>{if(!e.window[key]){try{e.window[key]=window[key];}catch(e){console.error(e);}}});"
|
||||||
|
sed -i "s/this.props.onWindowOpenFail());/$new_cb_handle/g" $open_find_result
|
||||||
|
fi
|
||||||
|
|
||||||
token_find_result=$( grep -lr "constructor(){this._sessionToken=\"\",this._tokenMap={}}" "$tmp_dir/core.wxvpkg" )
|
token_find_result=$( grep -lr "constructor(){this._sessionToken=\"\",this._tokenMap={}}" "$tmp_dir/core.wxvpkg" )
|
||||||
echo "WebSocket token存储对象位置: $token_find_result"
|
echo "WebSocket token存储对象位置: $token_find_result"
|
||||||
new_constructor="constructor(){if(window.tokenData){/*有就直接用*/this._sessionToken=window.tokenData._sessionToken;this._tokenMap=window.tokenData._tokenMap;}else{/*没有就新建*/this._sessionToken=\"\",this._tokenMap={};window.tokenData=this;/*新建完要给中间人*/}}"
|
if [[ ! -z $token_find_result ]];then
|
||||||
sed -i "s#constructor(){this._sessionToken=\"\",this._tokenMap={}}#$new_constructor#g" "$token_find_result"
|
new_constructor="constructor(){if(window.tokenData){/*有就直接用*/this._sessionToken=window.tokenData._sessionToken;this._tokenMap=window.tokenData._tokenMap;}else{/*没有就新建*/this._sessionToken=\"\",this._tokenMap={};window.tokenData=this;/*新建完要给中间人*/}}"
|
||||||
|
sed -i "s#constructor(){this._sessionToken=\"\",this._tokenMap={}}#$new_constructor#g" "$token_find_result"
|
||||||
|
fi
|
||||||
|
|
||||||
# open -a Terminal "`pwd`" --> gnome-terminal
|
# open -a Terminal "`pwd`" --> gnome-terminal
|
||||||
find_result=$( grep -lr 'open -a Terminal "`pwd`"' "$tmp_dir/core.wxvpkg" )
|
find_result=$( grep -lr 'open -a Terminal "`pwd`"' "$tmp_dir/core.wxvpkg" )
|
||||||
echo "Terminal启动位置: $find_result"
|
if [[ ! -z $find_result ]];then
|
||||||
new_str="gnome-terminal"
|
echo "Terminal启动位置: $find_result"
|
||||||
sed -i "s#open -a Terminal \"\`pwd\`\"#$new_str#g" "$find_result"
|
new_str="gnome-terminal"
|
||||||
|
sed -i "s#open -a Terminal \"\`pwd\`\"#$new_str#g" "$find_result"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# wcc、wcsc处理,设置REDUCE_WINE环境变量生效
|
||||||
|
if [[ $REDUCE_WINE == 'true' ]];then
|
||||||
|
# "wcc.exe":!0,"wcsc.exe":!0
|
||||||
|
find_result=$( grep -lr '{wcc:!0,wcsc:!0,DevToolProtector:!0}' "$tmp_dir/core.wxvpkg" )
|
||||||
|
if [[ ! -z $find_result ]];then
|
||||||
|
echo "wcc: $find_result"
|
||||||
|
new_str='{"wcc.exe":!0,"wcsc.exe":!0,"wcc.bin":!0,"wcsc.bin":!0,wcc:!0,wcsc:!0,DevToolProtector:!0}'
|
||||||
|
sed -i "s#{wcc:!0,wcsc:!0,DevToolProtector:!0}#$new_str#g" "$find_result"
|
||||||
|
new_str='"linux"===process.platform'
|
||||||
|
sed -i "s#\"darwin\"===process.platform#$new_str#g" "$find_result"
|
||||||
|
fi
|
||||||
|
|
||||||
|
current=`date "+%Y-%m-%d %H:%M:%S"`
|
||||||
|
timeStamp=`date -d "$current" +%s`
|
||||||
|
echo $timeStamp > "${package_dir}/.build_time"
|
||||||
|
fi
|
||||||
|
|
||||||
# pack 路径 到 文件
|
# pack 路径 到 文件
|
||||||
|
echo "pack"
|
||||||
node "$root_dir/tools/wxvpkg/pack" "$tmp_dir/core.wxvpkg" "$package_dir/core.wxvpkg"
|
node "$root_dir/tools/wxvpkg/pack" "$tmp_dir/core.wxvpkg" "$package_dir/core.wxvpkg"
|
||||||
rm -rf "$tmp_dir/core.wxvpkg"
|
rm -rf "$tmp_dir/core.wxvpkg"
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
root_dir=$(cd `dirname $0`/.. && pwd -P)
|
root_dir=$(cd `dirname $0`/.. && pwd -P)
|
||||||
srcdir=$root_dir
|
srcdir=$root_dir
|
||||||
tmp_dir="$root_dir/tmp"
|
tmp_dir="$root_dir/tmp"
|
||||||
@ -14,20 +14,11 @@ sed -i 's#module.exports = createWebviewManager;#module.exports = createWebviewM
|
|||||||
|
|
||||||
# 修复:可视化用的wcc,wcsc
|
# 修复:可视化用的wcc,wcsc
|
||||||
echo "fix: wcc,wcsc"
|
echo "fix: wcc,wcsc"
|
||||||
mkdir "$tmp_dir/node_modules"
|
if [[ ! -d "$tmp_dir/node_modules" ]];then
|
||||||
|
mkdir "$tmp_dir/node_modules"
|
||||||
|
fi
|
||||||
cd $tmp_dir && npm install miniprogram-compiler
|
cd $tmp_dir && npm install miniprogram-compiler
|
||||||
# wcc wcsc
|
# wcc wcsc
|
||||||
# 预览编译
|
|
||||||
# cd "${package_dir}/js/vendor/" && rm -rf "wcc.exe"
|
|
||||||
# cp "${package_dir}/node_modules_tmp/node_modules/miniprogram-compiler/bin/linux/wcc" "${package_dir}/js/vendor/wcc.exe"
|
|
||||||
# wcc_md5=$( md5sum wcc.exe|cut -d ' ' -f1 ) && \
|
|
||||||
# sed -i 's/wcc.exe": ".*"/wcc.exe": "'"${wcc_md5}"'"/g' "config.json"
|
|
||||||
# cd "${package_dir}/js/vendor/" && rm -rf "wcsc.exe"
|
|
||||||
# cp "${package_dir}/node_modules_tmp/node_modules/miniprogram-compiler/bin/linux/wcsc" "${package_dir}/js/vendor/wcsc.exe"
|
|
||||||
# cd "${package_dir}/js/vendor" && \
|
|
||||||
# wcsc_md5=$( md5sum wcsc.exe|cut -d ' ' -f1 ) && \
|
|
||||||
# sed -i 's/wcsc.exe": ".*"/wcsc.exe": "'"${wcsc_md5}"'"/g' "config.json"
|
|
||||||
|
|
||||||
# 可视化编译
|
# 可视化编译
|
||||||
(cd "${package_dir}/node_modules/" \
|
(cd "${package_dir}/node_modules/" \
|
||||||
&& rm -rf wcc wcsc \
|
&& rm -rf wcc wcsc \
|
||||||
@ -37,4 +28,20 @@ cd $tmp_dir && npm install miniprogram-compiler
|
|||||||
&& cp -r "${srcdir}/compiler/wcc_node"/* "wcc" \
|
&& cp -r "${srcdir}/compiler/wcc_node"/* "wcc" \
|
||||||
&& cp -r "${srcdir}/compiler/wcsc_node"/* "wcsc"
|
&& cp -r "${srcdir}/compiler/wcsc_node"/* "wcsc"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# 预览编译,设置REDUCE_WINE环境变量生效
|
||||||
|
# 如果是mac执行wcc,否则wcc.exe
|
||||||
|
if [[ $REDUCE_WINE == 'true' ]];then
|
||||||
|
\cp -rf "${srcdir}/compiler/generatemd5.js" "${package_dir}/js/vendor/generatemd5.js"
|
||||||
|
\cp -rf "${srcdir}/compiler/wine/wcc" "${package_dir}/js/vendor/wcc"
|
||||||
|
\cp -rf "${srcdir}/compiler/wine/wcsc" "${package_dir}/js/vendor/wcsc"
|
||||||
|
\cp -rf "${tmp_dir}/node_modules/miniprogram-compiler/bin/linux/wcc" "${package_dir}/js/vendor/wcc.bin"
|
||||||
|
\cp -rf "${tmp_dir}/node_modules/miniprogram-compiler/bin/linux/wcsc" "${package_dir}/js/vendor/wcsc.bin"
|
||||||
|
node "${package_dir}/js/vendor/generatemd5.js"
|
||||||
|
|
||||||
|
current=`date "+%Y-%m-%d %H:%M:%S"`
|
||||||
|
timeStamp=`date -d "$current" +%s`
|
||||||
|
echo $timeStamp > "${package_dir}/.build_time"
|
||||||
|
fi
|
||||||
|
|
||||||
rm -rf "$tmp_dir/node_modules"
|
rm -rf "$tmp_dir/node_modules"
|
@ -187,10 +187,8 @@ const upgrade = function (extractPath) {
|
|||||||
execSync(`rm -rf ${path.resolve(__dirname, "../nwjs/package.nw")}`)
|
execSync(`rm -rf ${path.resolve(__dirname, "../nwjs/package.nw")}`)
|
||||||
console.log(`创建链接 ${path.resolve(__dirname, "../package.nw")}--->${path.resolve(__dirname, "../nwjs/package.nw")}`)
|
console.log(`创建链接 ${path.resolve(__dirname, "../package.nw")}--->${path.resolve(__dirname, "../nwjs/package.nw")}`)
|
||||||
// 链接
|
// 链接
|
||||||
fs.symlinkSync(
|
execSync(`cd ${path.resolve(__dirname, "../nwjs")} && ln -s ../package.nw package.nw`)
|
||||||
path.resolve(__dirname, "../package.nw"),
|
|
||||||
path.resolve(__dirname, "../nwjs/package.nw")
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,14 +281,6 @@ const patch_other = function () {
|
|||||||
info("Patching Other");
|
info("Patching Other");
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
fs.copyFileSync(
|
|
||||||
path.resolve(__dirname, "../compiler/wine/wcc"),
|
|
||||||
path.resolve(__dirname, "../package.nw/js/vendor/wcc")
|
|
||||||
);
|
|
||||||
fs.copyFileSync(
|
|
||||||
path.resolve(__dirname, "../compiler/wine/wcsc"),
|
|
||||||
path.resolve(__dirname, "../package.nw/js/vendor/wcsc")
|
|
||||||
);
|
|
||||||
execSync(path.resolve(__dirname, "fix-other"))
|
execSync(path.resolve(__dirname, "fix-other"))
|
||||||
|
|
||||||
resolve();
|
resolve();
|
||||||
@ -310,6 +300,8 @@ const start = async () => {
|
|||||||
await rebuild_wechat_devtools_node_modules();
|
await rebuild_wechat_devtools_node_modules();
|
||||||
await patch_wechat_devtools();
|
await patch_wechat_devtools();
|
||||||
await patch_other();
|
await patch_other();
|
||||||
|
// 写入构建时间戳
|
||||||
|
fs.writeFileSync(path.resolve(__dirname, '../package.nw/.build_time'), '' + parseInt(new Date().getTime()/1000))
|
||||||
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