Skip to content

Commit

Permalink
加入桌面图标
Browse files Browse the repository at this point in the history
  • Loading branch information
炒饭 committed Jun 23, 2017
1 parent 80bc0c6 commit c713dc1
Show file tree
Hide file tree
Showing 14 changed files with 1,181 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
/dist
npm-debug.log
/node_modules
*.log
15 changes: 15 additions & 0 deletions bin/install_desktop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#! /bin/bash
# install desktop

root_dir=$(cd `dirname $0`/.. && pwd -P)

sed -r -e 's/\/path\/to/'${root_dir//\//\\\/}'/g' "$root_dir/desktop.example" > "$root_dir/dist/wechat_dev_tools.desktop"

if type desktop-file-install >/dev/null 2>&1; then
desktop-file-install "$root_dir/dist/wechat_dev_tools.desktop" --dir=$HOME/.local/share/applications
else
echo 'no exists desktop-file-install'
if [ -d "$HOME/.local/share/applications" ]; then
cp "$root_dir/dist/wechat_dev_tools.desktop" $HOME/.local/share/applications/
fi
fi
2 changes: 1 addition & 1 deletion bin/replace_package_nw.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/sh
#! /bin/bash

root_dir=$(cd `dirname $0`/.. && pwd -P)

Expand Down
17 changes: 17 additions & 0 deletions bin/uninstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#! /bin/bash
# install desktop

root_dir=$(cd `dirname $0`/.. && pwd -P)

# TODO 能不能删
need_remove="$HOME/.local/share/applications/wechat_dev_tools.desktop"
if [ -f $need_remove ]; then
echo "remove $need_remove"
rm -v $need_remove
fi

# TODO 能不能删
need_remove="$HOME/.config/微信web开发者工具"
if [ -d $need_remove ]; then
rm -rfv $need_remove
fi
2 changes: 1 addition & 1 deletion bin/update_nwjs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

root_dir=$(cd `dirname $0`/.. && pwd -P)

nwjs_v=`cat $root_dir/bin/nwjs_v`
nwjs_v=`cat $root_dir/nwjs_v`
tmp_dir="/tmp/wxdt_xsp"

nwjs_file="$tmp_dir/nwjs-v$nwjs_v.tar.gz"
Expand Down
6 changes: 3 additions & 3 deletions bin/update_package_nw.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ root_dir=$(cd `dirname $0`/.. && pwd -P)

tmp_dir="/tmp/wxdt_xsp"
dist_dir="$root_dir/dist"
cur_wechat_v=`cat $root_dir/bin/wechat_v`
cur_wechat_v=`cat $root_dir/wechat_v`
echo "当前wechat_v: $cur_wechat_v"


Expand Down Expand Up @@ -54,7 +54,7 @@ cp -r "$wcwd_package_dir" "$root_dir"
# 链接wcc.exe wcsc.exe
ln -f "$onlineverdor_dir/*.exe" "$root_dir/bin/WeappVendor/s"

echo $wechat_v > $root_dir/bin/wechat_v
echo $wechat_v > $root_dir/wechat_v

echo '安装完成'
echo "wechat_v: $(cat $root_dir/bin/wechat_v)"
echo "wechat_v: $(cat $root_dir/wechat_v)"
17 changes: 11 additions & 6 deletions bin/wxdt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#! /bin/bash

root_dir=$(cd `dirname $0`/.. && pwd -P)
echo $root_dir

nwjs_v=`cat $root_dir/bin/nwjs_v`
nwjs_v=`cat $root_dir/nwjs_v`

cur_nwjs_v=""

Expand All @@ -13,19 +12,25 @@ fi

if [ "$cur_nwjs_v" != "$nwjs_v" ]; then
echo "安装微信开发者工具对应nwjs版本:$nwjs_v"
sh "$root_dir/bin/update_nwjs.sh"
bash "$root_dir/bin/update_nwjs.sh"
fi

cd "$root_dir/dist"

want=${1:-"start"}
if [ $want = "start" ]; then
`$root_dir/dist/nw`
`./nw`
elif [ $want = "install" ]; then
sh "$root_dir/bin/replace_weapp_vendor.sh"
bash "$root_dir/bin/replace_weapp_vendor.sh"
bash "$root_dir/bin/install_desktop.sh"
echo "安装完成"
elif [ $want = "debug" ]; then
port=9222
`$root_dir/dist/nw --remote-debugging-port=$port`
`./nw --remote-debugging-port=$port`
echo "remote-debugging-port:$port"
elif [ $want = "uninstall" ]; then
bash "$root_dir/bin/uninstall.sh"
echo "卸载完成,请在退出开发者工具后手动删除此项目目录"
else
echo "不支持$want操作"
exit 127
Expand Down
8 changes: 8 additions & 0 deletions desktop.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Desktop Entry]
Name=微信web开发者工具
Comment=The development tools for wechat web develop
Exec=/path/to/bin/wxdt %U
Icon=/path/to/dist/package.nw/app/images/logo2.png
Type=Application
Terminal=false
X-Desktop-File-Install-Version=0.22
9 changes: 9 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var gulp = require('gulp');
var replace = require('gulp-replace');
var path = require('path');

gulp.task('desktop', function(){
gulp.src(['./desktop.example'])
.pipe(replace('bar', 'foo'))
.pipe(gulp.dest('dist/wechat_web_devtools.desktop'));
});
File renamed without changes.
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,9 @@
"bugs": {
"url": "https://github.com/cytle/wechat_web_devtools/issues"
},
"homepage": "https://github.com/cytle/wechat_web_devtools#readme"
"homepage": "https://github.com/cytle/wechat_web_devtools#readme",
"devDependencies": {
"gulp": "^3.9.1",
"gulp-replace": "^0.6.1"
}
}
39 changes: 38 additions & 1 deletion package.nw/package.json
Original file line number Diff line number Diff line change
@@ -1 +1,38 @@
{"main":"app/html/index.html","name":"微信web开发者工具","appname":"wechatwebdevtools","version":"0.18.182200","window":{"title":"微信web开发者工具 v0.18.182200","icon":"app/images/logo2.png","toolbar":true,"width":600,"height":480,"frame":false},"inject_js_start":"app/dist/inject/jweixindebug.js","inject_js_end":"app/dist/inject/devtools.js","chromium-args":"--disable-devtools -ignore-certificate-errors -load-extension=./package.nw/app/dist/extensions/","node-remote":"http://*.open.weixin.qq.com/*","webview":{"partitions":[{"name":"trusted","accessible_resources":["<all_urls>"]},{"name":"devtools","accessible_resources":["<all_urls>"]},{"name":"simulator","accessible_resources":["<all_urls>"]},{"name":"appservice","accessible_resources":["<all_urls>"]},{"name":"widget","accessible_resources":["<all_urls>"]}]},"devDependencies":{},"beta":false}
{
"main": "app/html/index.html",
"name": "微信web开发者工具",
"appname": "wechatwebdevtools",
"version": "0.18.182200",
"window": {
"title": "微信web开发者工具 v0.18.182200",
"icon": "app/images/logo2.png",
"toolbar": true,
"width": 600,
"height": 480,
"frame": false
},
"inject_js_start": "app/dist/inject/jweixindebug.js",
"inject_js_end": "app/dist/inject/devtools.js",
"chromium-args": "--disable-devtools -ignore-certificate-errors -load-extension=./package.nw/app/dist/extensions/",
"node-remote": "http://*.open.weixin.qq.com/*",
"webview": {
"partitions": [{
"name": "trusted",
"accessible_resources": ["<all_urls>"]
}, {
"name": "devtools",
"accessible_resources": ["<all_urls>"]
}, {
"name": "simulator",
"accessible_resources": ["<all_urls>"]
}, {
"name": "appservice",
"accessible_resources": ["<all_urls>"]
}, {
"name": "widget",
"accessible_resources": ["<all_urls>"]
}]
},
"devDependencies": {},
"beta": false
}
File renamed without changes.
Loading

0 comments on commit c713dc1

Please sign in to comment.