mirror of
https://github.com/msojocs/wechat-web-devtools-linux.git
synced 2025-07-07 00:02:14 +08:00
feat: 使用bash优先安装node,提高兼容性
This commit is contained in:
parent
42f9ecabeb
commit
e92e107512
@ -52,6 +52,10 @@ git clone https://github.com/jiyeme/wechat-devtools.git
|
||||
```
|
||||
4. 在本地项目目录中执行如下的语句,构筑开发者工具:
|
||||
```
|
||||
./tools/setup-wechat-devtools-bash
|
||||
```
|
||||
或者
|
||||
```
|
||||
./tools/setup-wechat-devtools-node
|
||||
```
|
||||
5. 在本地项目目录中执行如下的语句,可以安装应用图标(非必须):
|
||||
|
9
test/path-node
Normal file
9
test/path-node
Normal file
@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
root_dir=$(cd `dirname $0`/.. && pwd -P)
|
||||
|
||||
echo $root_dir
|
||||
export PATH="$root_dir/node/bin":$PATH
|
||||
|
||||
node --version
|
||||
|
||||
exec "$root_dir/test/path-node2"
|
3
test/path-node2
Normal file
3
test/path-node2
Normal file
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
console.log(process.version)
|
33
tools/setup-wechat-devtools-bash
Normal file
33
tools/setup-wechat-devtools-bash
Normal file
@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
root_dir=$(cd `dirname $0`/.. && pwd -P)
|
||||
|
||||
echo "==========Initializing node=========="
|
||||
|
||||
if [ -f "$root_dir/node/bin/node" ]; then
|
||||
echo "node安装完毕"
|
||||
else
|
||||
exec "$root_dir/tools/update-node-node"
|
||||
fi
|
||||
|
||||
if [ ! -f "$root_dir/node/bin/node" ]; then
|
||||
echo "Node安装失败"
|
||||
exit
|
||||
fi
|
||||
|
||||
# 将node加入环境
|
||||
export PATH="$root_dir/node/bin":$PATH
|
||||
|
||||
echo "==========Initializing nwjs=========="
|
||||
if [ -f "$root_dir/nwjs/nw" ]; then
|
||||
echo "nwjs安装完毕"
|
||||
else
|
||||
exec "$root_dir/tools/update-nwjs-node"
|
||||
fi
|
||||
|
||||
echo "==========Initializing wechat-devtools package=========="
|
||||
if [ -f "$root_dir/package.nw/package.json" ]; then
|
||||
echo "微信开发者工具安装完毕"
|
||||
else
|
||||
exec "$root_dir/tools/update-wechat-devtools-node"
|
||||
fi
|
@ -49,6 +49,7 @@ const init_nwjs = function () {
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const init_wechat = function () {
|
||||
console.info(
|
||||
"==========Initializing wechat-devtools package=============="
|
||||
|
@ -5,6 +5,7 @@ const { execSync, spawn } = require("child_process");
|
||||
const util = require("util");
|
||||
|
||||
const nodeConfig = require("../conf/node.json");
|
||||
const { exit } = require("process");
|
||||
|
||||
const download = function () {
|
||||
return new Promise((resolve, reject) => {
|
||||
@ -102,7 +103,7 @@ const start = async () => {
|
||||
);
|
||||
} catch (error) {
|
||||
console.error("异常", error);
|
||||
throw error
|
||||
exit(-1)
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -291,7 +291,7 @@ const start = async () => {
|
||||
);
|
||||
} catch (error) {
|
||||
console.error("异常", error);
|
||||
throw error;
|
||||
exit(-1)
|
||||
}
|
||||
};
|
||||
start();
|
||||
|
Loading…
x
Reference in New Issue
Block a user