mirror of
https://github.com/msojocs/wechat-web-devtools-linux.git
synced 2025-07-22 00:00:04 +08:00
fix: debugWXS 去除对于wine的依赖 #13
This commit is contained in:
parent
9f876b7e84
commit
4744ec978d
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@ -61,7 +61,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
sudo chmod -R 777 package.nw node
|
sudo chmod -R 777 package.nw node
|
||||||
ls -l
|
ls -l
|
||||||
sudo rm -rf cache tmp .git
|
sudo rm -rf cache tmp .git test
|
||||||
mkdir ${{ env. name }}
|
mkdir ${{ env. name }}
|
||||||
sudo find -maxdepth 1 -not -name ${{ env.name }} -not -name . -exec mv {} ${{ 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 }}/package.nw/node_modules/nodegit" nodegit
|
||||||
|
@ -7,29 +7,23 @@ 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 ~ )
|
||||||
|
|
||||||
current=`date "+%Y-%m-%d %H:%M:%S"`
|
clean_cache() {
|
||||||
timeStamp=`date -d "$current" +%s`
|
echo "清理缓存";
|
||||||
|
rm -rf "$APPDATA/WeappCache";
|
||||||
|
rm -rf "$APPDATA/WeappVendor";
|
||||||
|
}
|
||||||
|
|
||||||
# 获取首次运行时间
|
# 检测是否有清除缓存的必要
|
||||||
if [[ -f "$APPDATA/.run_time" ]];then
|
if [[ -f "$APPDATA/.build_time" ]];then
|
||||||
run_time=`cat "$APPDATA/.run_time"`
|
diff "$APPDATA/.build_time" "$root_dir/package.nw/.build_time" >/dev/null;
|
||||||
|
if [ ! "$?" == "0" ];then
|
||||||
|
\cp -f "$root_dir/package.nw/.build_time" "$APPDATA/.build_time";
|
||||||
|
clean_cache;
|
||||||
|
fi;
|
||||||
else
|
else
|
||||||
run_time=0
|
\cp -f "$root_dir/package.nw/.build_time" "$APPDATA/.build_time";
|
||||||
fi
|
clean_cache;
|
||||||
|
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
|
|
||||||
|
|
||||||
EXTENSION1="--load-extension=$root_dir/nwjs/package.nw/js/ideplugin"
|
EXTENSION1="--load-extension=$root_dir/nwjs/package.nw/js/ideplugin"
|
||||||
EXTENSION2=--load-extension=~/.config/wechat_devtools/WeappPlugin
|
EXTENSION2=--load-extension=~/.config/wechat_devtools/WeappPlugin
|
||||||
|
@ -4,7 +4,8 @@ const version = "20220222"
|
|||||||
const path = require("path");
|
const path = require("path");
|
||||||
const args = process.argv.slice(2);
|
const args = process.argv.slice(2);
|
||||||
const funcName = args[args.indexOf('-gn') + 1]
|
const funcName = args[args.indexOf('-gn') + 1]
|
||||||
const wccPath = path.resolve(__dirname, './wcc.bin')
|
const debugWXS = args.includes('-ds')
|
||||||
|
const wccPath = path.resolve(__dirname, '../wcc')
|
||||||
function genFunctionContent_LLW(wxmlName, config={}, source) {
|
function genFunctionContent_LLW(wxmlName, config={}, source) {
|
||||||
// 起始
|
// 起始
|
||||||
let content = `var cs = cs || [];\u000a${config.funcName}` + "=function(_,_v,_n,_p,_s,_wp,_wl,$gwn,$gwl,$gwh,wh,$gstack,$gwrt,gra,grb,TestTest,wfor,_ca,_da,_r,_rz,_o,_oz,_1,_1z,_2,_2z,_m,_mz,nv_getDate,nv_getRegExp,nv_console,nv_parseInt,nv_parseFloat,nv_isNaN,nv_isFinite,nv_decodeURI,nv_decodeURIComponent,nv_encodeURI,nv_encodeURIComponent,$gdc,nv_JSON,_af,_gv,_ai,_grp,_gd,_gapi,$ixc,_ic,_w,_ev,_tsd){return function(path,global){\u000aif(typeof global==='undefined'){if (typeof __GWX_GLOBAL__==='undefined')global={};else global=__GWX_GLOBAL__;}if(typeof __WXML_GLOBAL__ === 'undefined') {__WXML_GLOBAL__={};\u000a}__WXML_GLOBAL__.modules = __WXML_GLOBAL__.modules || {};\u000a"
|
let content = `var cs = cs || [];\u000a${config.funcName}` + "=function(_,_v,_n,_p,_s,_wp,_wl,$gwn,$gwl,$gwh,wh,$gstack,$gwrt,gra,grb,TestTest,wfor,_ca,_da,_r,_rz,_o,_oz,_1,_1z,_2,_2z,_m,_mz,nv_getDate,nv_getRegExp,nv_console,nv_parseInt,nv_parseFloat,nv_isNaN,nv_isFinite,nv_decodeURI,nv_decodeURIComponent,nv_encodeURI,nv_encodeURIComponent,$gdc,nv_JSON,_af,_gv,_ai,_grp,_gd,_gapi,$ixc,_ic,_w,_ev,_tsd){return function(path,global){\u000aif(typeof global==='undefined'){if (typeof __GWX_GLOBAL__==='undefined')global={};else global=__GWX_GLOBAL__;}if(typeof __WXML_GLOBAL__ === 'undefined') {__WXML_GLOBAL__={};\u000a}__WXML_GLOBAL__.modules = __WXML_GLOBAL__.modules || {};\u000a"
|
||||||
@ -20,10 +21,10 @@ function genFunctionContent_LLW(wxmlName, config={}, source) {
|
|||||||
const exp = `function gz\\${funcName}_${config.num+1}\\(\\)\\{[\\s\\S]*_WXML_GLOBAL__\\.ops_cached\\.\\${funcName}_${config.num+1}\n}`
|
const exp = `function gz\\${funcName}_${config.num+1}\\(\\)\\{[\\s\\S]*_WXML_GLOBAL__\\.ops_cached\\.\\${funcName}_${config.num+1}\n}`
|
||||||
const gz = source.match(new RegExp(exp))[0]
|
const gz = source.match(new RegExp(exp))[0]
|
||||||
content += gz
|
content += gz
|
||||||
|
|
||||||
// debug要作为判断依据,所以放前面
|
// debug要作为判断依据,所以放前面
|
||||||
let debug = source.match(new RegExp(`\\n__WXML_GLOBAL__\\.ops_set\\.\\${funcName}=[\\s\\S]*?\\nvar`))
|
let debug = source.match(new RegExp(`\\n__WXML_GLOBAL__\\.ops_set\\.\\${funcName}=[\\s\\S]*?\\nvar`))
|
||||||
debug = debug[0].substring(0, debug[0].length-3).replace(new RegExp(`\\${funcName}`, 'g'), config.funcName)
|
debug = debug[0].substring(0, debug[0].length-3).replace(new RegExp(`\\${funcName}`, 'g'), config.funcName)
|
||||||
|
|
||||||
content += debug
|
content += debug
|
||||||
|
|
||||||
content += `var x=['./${wxmlName}.wxml'];d_[x[0]]={}\u000a`
|
content += `var x=['./${wxmlName}.wxml'];d_[x[0]]={}\u000a`
|
||||||
@ -65,11 +66,8 @@ function genFunctionContent_LLA(wxmlName, config={}, source) {
|
|||||||
|
|
||||||
content += "var cs = cs || [];" + cs[1].replace(new RegExp(`\\${funcName}`, 'g'), config.funcName)
|
content += "var cs = cs || [];" + cs[1].replace(new RegExp(`\\${funcName}`, 'g'), config.funcName)
|
||||||
|
|
||||||
// debug要作为判断依据,所以放前面
|
|
||||||
let debug = source.match(new RegExp(`\\n__WXML_GLOBAL__\\.ops_set\\.\\${funcName}=[\\s\\S]*?\\nvar`))
|
|
||||||
debug = debug[0].substring(0, debug[0].length-3).replace(new RegExp(`\\${funcName}`, 'g'), config.funcName)
|
|
||||||
// gz函数
|
// gz函数
|
||||||
if(!debug.includes('debuginfo_set')){
|
if(!debugWXS){
|
||||||
const exp = `function gz\\${funcName}_${config.num+1}\\(\\)\\{[\\s\\S]*?\\)}`
|
const exp = `function gz\\${funcName}_${config.num+1}\\(\\)\\{[\\s\\S]*?\\)}`
|
||||||
const gz = source.match(new RegExp(exp))
|
const gz = source.match(new RegExp(exp))
|
||||||
// console.log(gz)
|
// console.log(gz)
|
||||||
@ -80,20 +78,23 @@ function genFunctionContent_LLA(wxmlName, config={}, source) {
|
|||||||
const gz = source.match(new RegExp(exp))
|
const gz = source.match(new RegExp(exp))
|
||||||
content += gz[0].replace(new RegExp(`\\${funcName}\\_\\d+`, 'g'), `${config.funcName}_1`)
|
content += gz[0].replace(new RegExp(`\\${funcName}\\_\\d+`, 'g'), `${config.funcName}_1`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// debug
|
||||||
|
let debug = source.match(new RegExp(`\\n__WXML_GLOBAL__\\.ops_set\\.\\${funcName}=[\\s\\S]*?\\nvar`))
|
||||||
|
debug = debug[0].substring(0, debug[0].length-3).replace(new RegExp(`\\${funcName}`, 'g'), config.funcName)
|
||||||
content += debug
|
content += debug
|
||||||
|
|
||||||
content += `var x=['./${wxmlName}.wxml'];d_[x[0]]={}\u000a`
|
content += `var x=['./${wxmlName}.wxml'];d_[x[0]]={}\u000a`
|
||||||
|
|
||||||
// m0 --- m{num}
|
// m0 --- m{num}
|
||||||
if(!debug.includes('debuginfo_set')){
|
if(!debugWXS){
|
||||||
content += `var m0=function(e,s,r,gg){\u000avar z=gz${config.funcName}_1()\u000areturn r\u000a}\u000ae_[x[0]]={f:m0,j:[],i:[],ti:[],ic:[]}`
|
content += `var m0=function(e,s,r,gg){\u000avar z=gz${config.funcName}_1()\u000areturn r\u000a}\u000ae_[x[0]]={f:m0,j:[],i:[],ti:[],ic:[]}`
|
||||||
}else{
|
}else{
|
||||||
//m0 -2
|
|
||||||
// m0 --- m{num}
|
// m0 --- m{num}
|
||||||
const m0Exp = `var m${config.num}=function\\(e,s,r,gg\\){[\\s\\S]*{f:m${config.num},j:\\[\\],i:\\[\\],ti:\\[\\],ic:\\[\\]}`
|
const m0Exp = `var m${config.num}=function\\(e,s,r,gg\\){[\\s\\S]*{f:m${config.num},j:\\[\\],i:\\[\\],ti:\\[\\],ic:\\[\\]}`
|
||||||
const m0 = source.match(new RegExp(m0Exp))[0].replace(new RegExp(`m${config.num}`, 'g'), 'm0').replace(new RegExp(`x\\[${config.num}\\]`, 'g'), 'x[0]')
|
const m0 = source.match(new RegExp(m0Exp))[0].replace(new RegExp(`m${config.num}`, 'g'), 'm0').replace(new RegExp(`x\\[${config.num}\\]`, 'g'), 'x[0]')
|
||||||
content += m0.replace(new RegExp(`\\${funcName}\\_\\d+`, 'g'), `${config.funcName}_1`)
|
content += m0.replace(new RegExp(`\\${funcName}\\_\\d+`, 'g'), `${config.funcName}_1`)
|
||||||
}
|
}
|
||||||
content += `\u000aif(path&&e_[path]){\u000areturn function(env,dd,global){$gwxc=0;var root={\u0022tag\u0022:\u0022wx-page\u0022};root.children=[]\u000a;g=\u0022${config.funcName}\u0022;var main=e_[path].f\u000acs=[]\u000aif (typeof global===\u0022undefined\u0022)global={};global.f=$gdc(f_[path],\u0022\u0022,1);\u000atry{\u000amain(env,{},root,global);\u000a_tsd(root)\u000a}catch(err){\u000aconsole.log(cs, env);\u000aconsole.log(err)\u000athrow err\u000a}\u000a;g=\u0022\u0022;\u000areturn root;\u000a}\u000a}\u000a}\u000a}(__g.a,__g.b,__g.c,__g.d,__g.e,__g.f,__g.g,__g.h,__g.i,__g.j,__g.k,__g.l,__g.m,__g.n,__g.o,__g.p,__g.q,__g.r,__g.s,__g.t,__g.u,__g.v,__g.w,__g.x,__g.y,__g.z,__g.A,__g.B,__g.C,__g.D,__g.E,__g.F,__g.G,__g.H,__g.I,__g.J,__g.K,__g.L,__g.M,__g.N,__g.O,__g.P,__g.Q,__g.R,__g.S,__g.T,__g.U,__g.V,__g.W,__g.X,__g.Y,__g.Z,__g.aa);if(__vd_version_info__.delayedGwx||false)${config.funcName}();`
|
content += `\u000aif(path&&e_[path]){\u000areturn function(env,dd,global){$gwxc=0;var root={\u0022tag\u0022:\u0022wx-page\u0022};root.children=[]\u000a;g=\u0022${config.funcName}\u0022;var main=e_[path].f\u000acs=[]\u000aif (typeof global===\u0022undefined\u0022)global={};global.f=$gdc(f_[path],\u0022\u0022,1);\u000atry{\u000amain(env,{},root,global);\u000a_tsd(root)\u000a}catch(err){\u000aconsole.log(cs, env);\u000aconsole.log(err)\u000athrow err\u000a}\u000a;g=\u0022\u0022;\u000areturn root;\u000a}\u000a}\u000a}\u000a}(__g.a,__g.b,__g.c,__g.d,__g.e,__g.f,__g.g,__g.h,__g.i,__g.j,__g.k,__g.l,__g.m,__g.n,__g.o,__g.p,__g.q,__g.r,__g.s,__g.t,__g.u,__g.v,__g.w,__g.x,__g.y,__g.z,__g.A,__g.B,__g.C,__g.D,__g.E,__g.F,__g.G,__g.H,__g.I,__g.J,__g.K,__g.L,__g.M,__g.N,__g.O,__g.P,__g.Q,__g.R,__g.S,__g.T,__g.U,__g.V,__g.W,__g.X,__g.Y,__g.Z,__g.aa);if(__vd_version_info__.delayedGwx||false)${config.funcName}();`
|
||||||
|
|
||||||
// console.log(content)
|
// console.log(content)
|
||||||
|
@ -57,7 +57,6 @@ exports = async function (options) {
|
|||||||
let result
|
let result
|
||||||
try {
|
try {
|
||||||
// console.warn('final options:', options);
|
// console.warn('final options:', options);
|
||||||
// TODO: fix
|
|
||||||
result = wcc(options.cwd, options.files, {cut: options.isCut}, options)
|
result = wcc(options.cwd, options.files, {cut: options.isCut}, options)
|
||||||
// console.warn('wcc result', result)
|
// console.warn('wcc result', result)
|
||||||
} catch(errmsg) {
|
} catch(errmsg) {
|
||||||
@ -71,7 +70,7 @@ exports = async function (options) {
|
|||||||
const dir = path.dirname(output)
|
const dir = path.dirname(output)
|
||||||
if (lazyload) {
|
if (lazyload) {
|
||||||
// lazyload 为 true时,wcc 返回值是个对象, 需要序列化一下
|
// lazyload 为 true时,wcc 返回值是个对象, 需要序列化一下
|
||||||
result = JSON.stringify(result)
|
// result = JSON.stringify(result)
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await fs.stat(dir)
|
await fs.stat(dir)
|
||||||
|
@ -96,7 +96,7 @@ function getAllFiles(rootPath, files) {
|
|||||||
* @param {*} files 文件列表,包含组件
|
* @param {*} files 文件列表,包含组件
|
||||||
* @param {*} param2
|
* @param {*} param2
|
||||||
* @param {*} options 配置选项
|
* @param {*} options 配置选项
|
||||||
* @returns
|
* @returns string
|
||||||
*/
|
*/
|
||||||
function wxmlToJS(rootPath, files, { cut } = {}, options={}) {
|
function wxmlToJS(rootPath, files, { cut } = {}, options={}) {
|
||||||
const type = cut ? '-xc' : '-cc'
|
const type = cut ? '-xc' : '-cc'
|
||||||
@ -108,7 +108,6 @@ function wxmlToJS(rootPath, files, { cut } = {}, options={}) {
|
|||||||
.concat(files)
|
.concat(files)
|
||||||
.concat(['-gn', '$gwx'])
|
.concat(['-gn', '$gwx'])
|
||||||
|
|
||||||
// TODO:可用性检测
|
|
||||||
// wxs调试
|
// wxs调试
|
||||||
if(options.debugWXS)args.unshift('-ds')
|
if(options.debugWXS)args.unshift('-ds')
|
||||||
// 懒加载
|
// 懒加载
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
const path = require("path")
|
|
||||||
const fs = require("fs")
|
|
||||||
|
|
||||||
fs.symlinkSync(
|
|
||||||
path.resolve(__dirname, "../package.nw"),
|
|
||||||
path.resolve(__dirname, "../nwjs/package.nw")
|
|
||||||
|
|
||||||
)
|
|
@ -3,11 +3,18 @@
|
|||||||
root_dir=$(cd `dirname $0`/../.. && pwd -P)
|
root_dir=$(cd `dirname $0`/../.. && pwd -P)
|
||||||
pkg_dir="/mnt/disk1/Project/WeCuit-Project/WeCuit-Mini-uni-test_uni_vue-cli/dist/build/mp-weixin"
|
pkg_dir="/mnt/disk1/Project/WeCuit-Project/WeCuit-Mini-uni-test_uni_vue-cli/dist/build/mp-weixin"
|
||||||
pkg_dir="/home/msojocs/Documents/we1"
|
pkg_dir="/home/msojocs/Documents/we1"
|
||||||
|
store_dir="$root_dir/test/wcc/lla/1"
|
||||||
cd "$pkg_dir" && \
|
cd "$pkg_dir" && \
|
||||||
wine "$root_dir/package.nw/js/vendor/wcc.exe" "-d" "--split" ">_<9657" "-cc" "2>_<9657./pages/index/index.wxml>_<96570>_<9657./pages/logs/logs.wxml>_<96570" "-lla" "./pages/index/index>_<9657./pages/logs/logs" "./pages/index/index.wxml" "./pages/logs/logs.wxml" "-gn" "\$gwx" > "$root_dir/test/wcc/lla/1/wine.json"
|
wine "$root_dir/package.nw/js/vendor/wcc.exe" "-d" "--split" ">_<9657" "-cc" "2>_<9657./pages/index/index.wxml>_<96570>_<9657./pages/logs/logs.wxml>_<96570" "-lla" "./pages/index/index>_<9657./pages/logs/logs" "./pages/index/index.wxml" "./pages/logs/logs.wxml" "-gn" "\$gwx" > "$store_dir/wine.json"
|
||||||
|
|
||||||
echo "==================="
|
echo "==================="
|
||||||
|
|
||||||
cd "$pkg_dir" && \
|
cd "$pkg_dir" && \
|
||||||
"$root_dir/compiler/nodejs/wcc" "-d" "--split" ">_<9657" "-cc" "2>_<9657./pages/index/index.wxml>_<96570>_<9657./pages/logs/logs.wxml>_<96570" "-lla" "./pages/index/index>_<9657./pages/logs/logs" "./pages/index/index.wxml" "./pages/logs/logs.wxml" "-gn" "\$gwx" > "$root_dir/test/wcc/lla/1/nodejs.json"
|
"$root_dir/compiler/nodejs/wcc" "-d" "--split" ">_<9657" "-cc" "2>_<9657./pages/index/index.wxml>_<96570>_<9657./pages/logs/logs.wxml>_<96570" "-lla" "./pages/index/index>_<9657./pages/logs/logs" "./pages/index/index.wxml" "./pages/logs/logs.wxml" "-gn" "\$gwx" > "$store_dir/nodejs.json"
|
||||||
|
|
||||||
|
diff "$store_dir/wine.json" "$store_dir/nodejs.json" >/dev/null
|
||||||
|
if [ "$?" == "0" ];then
|
||||||
|
echo "the file or dir is same!"
|
||||||
|
else
|
||||||
|
echo "the file or dir is different!"
|
||||||
|
fi
|
File diff suppressed because one or more lines are too long
@ -4,10 +4,19 @@ root_dir=$(cd `dirname $0`/../.. && pwd -P)
|
|||||||
pkg_dir="/mnt/disk1/Project/WeCuit-Project/WeCuit-Mini-uni-test_uni_vue-cli/dist/build/mp-weixin"
|
pkg_dir="/mnt/disk1/Project/WeCuit-Project/WeCuit-Mini-uni-test_uni_vue-cli/dist/build/mp-weixin"
|
||||||
pkg_dir="/home/msojocs/Documents/we1"
|
pkg_dir="/home/msojocs/Documents/we1"
|
||||||
|
|
||||||
|
store_dir="$root_dir/test/wcc/llw/1"
|
||||||
|
|
||||||
cd "$pkg_dir" && \
|
cd "$pkg_dir" && \
|
||||||
wine "$root_dir/package.nw/js/vendor/wcc.exe" "-d" "--split" ">_<9657" "-cc" "2>_<9657./pages/index/index.wxml>_<96570>_<9657./pages/logs/logs.wxml>_<96570" "-llw" "./pages/index/index>_<9657./pages/logs/logs" "./pages/index/index.wxml" "./pages/logs/logs.wxml" "-gn" "\$gwx" > "$root_dir/test/wcc/llw/1/wine.json"
|
wine "$root_dir/package.nw/js/vendor/wcc.exe" "-d" "--split" ">_<9657" "-cc" "2>_<9657./pages/index/index.wxml>_<96570>_<9657./pages/logs/logs.wxml>_<96570" "-llw" "./pages/index/index>_<9657./pages/logs/logs" "./pages/index/index.wxml" "./pages/logs/logs.wxml" "-gn" "\$gwx" > "$store_dir/wine.json"
|
||||||
|
|
||||||
echo "==================="
|
echo "==================="
|
||||||
|
|
||||||
cd "$pkg_dir" && \
|
cd "$pkg_dir" && \
|
||||||
"$root_dir/compiler/nodejs/wcc" "-d" "--split" ">_<9657" "-cc" "2>_<9657./pages/index/index.wxml>_<96570>_<9657./pages/logs/logs.wxml>_<96570" "-llw" "./pages/index/index>_<9657./pages/logs/logs" "./pages/index/index.wxml" "./pages/logs/logs.wxml" "-gn" "\$gwx" > "$root_dir/test/wcc/llw/1/nodejs.json"
|
"$root_dir/compiler/nodejs/wcc" "-d" "--split" ">_<9657" "-cc" "2>_<9657./pages/index/index.wxml>_<96570>_<9657./pages/logs/logs.wxml>_<96570" "-llw" "./pages/index/index>_<9657./pages/logs/logs" "./pages/index/index.wxml" "./pages/logs/logs.wxml" "-gn" "\$gwx" > "$store_dir/nodejs.json"
|
||||||
|
|
||||||
|
diff "$store_dir/wine.json" "$store_dir/nodejs.json" >/dev/null
|
||||||
|
if [ "$?" == "0" ];then
|
||||||
|
echo "the file or dir is same!"
|
||||||
|
else
|
||||||
|
echo "the file or dir is different!"
|
||||||
|
fi
|
File diff suppressed because one or more lines are too long
@ -1,111 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# 参数:
|
|
||||||
# 1 ---- NW版本
|
|
||||||
#
|
|
||||||
set -e
|
|
||||||
|
|
||||||
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
|
|
||||||
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
|
|
||||||
NW_VERSION=$1
|
|
||||||
package_dir="$DIR/../package.nw"
|
|
||||||
|
|
||||||
if [ -z $NW_VERSION ]; then
|
|
||||||
echo "NW 版本未指定!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "目录: $DIR"
|
|
||||||
echo "NW VERSION: $NW_VERSION"
|
|
||||||
|
|
||||||
export PATH="$DIR/../node/bin:$PATH"
|
|
||||||
PY_VERSION=`python -V 2>&1|awk '{print $2}'|awk -F '.' '{print $1}'`
|
|
||||||
if [ $PY_VERSION != 2 ]; then
|
|
||||||
hash python2 2>/dev/null || { echo >&2 "I require python2 but it's not installed. Aborting."; exit 1; }
|
|
||||||
ln -s "$( which python2 )" "$DIR/../node/bin/python"
|
|
||||||
fi
|
|
||||||
|
|
||||||
hash nw-gyp 2>/dev/null || {
|
|
||||||
echo "=======请安装nw-gyp======="
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
rm -fr "${package_dir}/node_modules_tmp" # remove previous hacking tmp
|
|
||||||
mkdir -p "${package_dir}/node_modules_tmp"
|
|
||||||
cp -fr "${package_dir}/node_modules" "${package_dir}/node_modules_tmp/node_modules"
|
|
||||||
|
|
||||||
rm -fr "${package_dir}/node_modules_tmp/node_modules/node-pty"
|
|
||||||
rm -fr "${package_dir}/node_modules_tmp/node_modules/node-pty-node"
|
|
||||||
rm -fr "${package_dir}/node_modules_tmp/node_modules/native-watchdog"
|
|
||||||
rm -fr "${package_dir}/node_modules_tmp/node_modules/oniguruma-node"
|
|
||||||
rm -fr "${package_dir}/node_modules_tmp/node_modules/spdlog"
|
|
||||||
rm -fr "${package_dir}/node_modules_tmp/node_modules/spdlog-node"
|
|
||||||
rm -fr "${package_dir}/node_modules_tmp/node_modules/nodegit"
|
|
||||||
rm -fr "${package_dir}/node_modules_tmp/node_modules/extract-file-icon"
|
|
||||||
npm install node-gyp nw-gyp -g
|
|
||||||
npm config delete registry
|
|
||||||
(npm install \
|
|
||||||
extract-file-icon \
|
|
||||||
native-keymap \
|
|
||||||
native-watchdog \
|
|
||||||
node-pty \
|
|
||||||
oniguruma \
|
|
||||||
spdlog@0.11.1 \
|
|
||||||
trash \
|
|
||||||
vscode-oniguruma \
|
|
||||||
vscode-ripgrep \
|
|
||||||
--prefix="${package_dir}/node_modules_tmp" ) # reinstall modules
|
|
||||||
|
|
||||||
# rebuild
|
|
||||||
echo "nw-gyp version: $( nw-gyp --version )"
|
|
||||||
|
|
||||||
for mod in "${package_dir}/node_modules_tmp/node_modules"/*; do
|
|
||||||
mod_name=$(basename "$mod")
|
|
||||||
echo -e "\e[1;34mrebuild $mod_name\e[0m" >&2
|
|
||||||
cd "$mod"
|
|
||||||
case "$mod_name" in
|
|
||||||
# extract-file-icon|spdlog-node|oniguruma-node|native-keymap|node-pty-node)
|
|
||||||
# npm install
|
|
||||||
# ;;
|
|
||||||
spdlog|oniguruma|node-pty|native-watchdog|nodegit)
|
|
||||||
nw-gyp rebuild --arch=x64 --target="${NW_VERSION}"
|
|
||||||
;;
|
|
||||||
# nodegit)
|
|
||||||
# mkdir lib
|
|
||||||
# npm install
|
|
||||||
# npm run recompile
|
|
||||||
# ;;
|
|
||||||
vscode-ripgrep)
|
|
||||||
rm -rf bin
|
|
||||||
npm install
|
|
||||||
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"
|
|
||||||
;;
|
|
||||||
vscode-windows-*|windows-*)
|
|
||||||
cd ../
|
|
||||||
rm -rf "${mod}"
|
|
||||||
;;
|
|
||||||
trash|vscode-oniguruma)
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo -e "\e[1;31mcannot rebuild $mod\e[0m" >&2
|
|
||||||
rm -rf "$mod"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
find -name "obj.target" | xargs -I{} rm -rf {}
|
|
||||||
find -name "*.node" | xargs -I{} cp -rf {} "${package_dir}/node_modules/$mod_name/{}"
|
|
||||||
done
|
|
||||||
|
|
||||||
# (cd "${package_dir}/node_modules_tmp/node_modules" && find -name "obj.target" | xargs -I{} rm -rf {})
|
|
||||||
# (cd "${package_dir}/node_modules_tmp/node_modules" && find -name "*.node" | xargs -I{} cp -rf {} ${package_dir}/node_modules/{})
|
|
||||||
|
|
||||||
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"
|
|
||||||
|
|
||||||
rm -rf "${package_dir}/node_modules_tmp"
|
|
||||||
|
|
||||||
# 移除旧配置
|
|
||||||
# rm -fr ~/.config/wechat_devtools
|
|
Loading…
x
Reference in New Issue
Block a user