mirror of
https://github.com/msojocs/wechat-web-devtools-linux.git
synced 2025-07-22 00:00:04 +08:00
add cli supports
This commit is contained in:
parent
7d7b111714
commit
a351ae3e19
@ -12,6 +12,6 @@ cd $APPDATA/..
|
||||
|
||||
export WECHAT_DEVTOOLS_DIR="$DIR/../nwjs"
|
||||
export APPDATA="$DIR/../nwjs"
|
||||
export PATH="$DIR/../nwjs:$PATH"
|
||||
export PATH="$DIR/../node/bin:$DIR/../nwjs:$PATH"
|
||||
|
||||
LANG=zh_CN exec "$DIR"/../nwjs/nw "$@" --load-extension="$DIR"/../nwjs/package.nw/js/ideplugin "$@"
|
||||
LANG=zh_CN.UTF-8 exec "$DIR"/../nwjs/nw --load-extension="$DIR"/../nwjs/package.nw/js/ideplugin "$@"
|
||||
|
17
bin/wechat-devtools-cli
Executable file
17
bin/wechat-devtools-cli
Executable file
@ -0,0 +1,17 @@
|
||||
#! /bin/bash
|
||||
|
||||
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 )"
|
||||
|
||||
cd $APPDATA/..
|
||||
|
||||
export WECHAT_DEVTOOLS_DIR="$DIR/../nwjs"
|
||||
export APPDATA="$DIR/../nwjs"
|
||||
export PATH="$DIR/../node/bin:$DIR/../nwjs:$PATH"
|
||||
|
||||
$DIR/../tools/wechat-devtools-cli "$@"
|
17
tools/fix-cli
Executable file
17
tools/fix-cli
Executable file
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env mew_js
|
||||
|
||||
@info("Patching CLI command");
|
||||
|
||||
const rootDir = @.fs.dirname(__dirname);
|
||||
|
||||
let cli = @.fs.readFile.sync(@path(rootDir, "package.nw/js/common/cli/index.js"), "utf8");
|
||||
|
||||
cli = cli.replace(/USERPROFILE/g, "HOME");
|
||||
cli = cli.replace(/AppData\/Local\/\$\{global\.userDirName\}\/User Data/g,
|
||||
".config/${global.userDirName}");
|
||||
cli = cli.replace(/`\.\/\$\{global.appname\}\.exe`/g,
|
||||
"require(\"path\").join(__dirname, \"../../../../bin/wechat-devtools\")");
|
||||
cli = cli.replace(/"\.\.\/\.\.\/\.\.\/\.\.\/resources_win\/nw\/x64\/nw.exe"/g,
|
||||
"\"../../../../nwjs/nw\"");
|
||||
|
||||
@.fs.writeFile.sync(@path(rootDir, "package.nw/js/common/cli/index.js"), cli);
|
@ -103,22 +103,28 @@ const packageDir = "$APPDATA/Tencent/微信开发者工具/package.nw";
|
||||
|
||||
}).then(function () {
|
||||
|
||||
@info("Fixing wechat-devtools package name");
|
||||
@info("Patching wechat-devtools package name");
|
||||
|
||||
@.task.execute(@path(__dirname, "fix-package-name"), [], false, this.test);
|
||||
|
||||
}).then(function () {
|
||||
|
||||
@info("Fix wechat-devtools editor font");
|
||||
@info("Patching wechat-devtools editor font");
|
||||
|
||||
@.task.execute(@path(__dirname, "fix-editor-font"), [], false, this.test);
|
||||
|
||||
}).then(function () {
|
||||
|
||||
@info("Fix wechat-devtools editor selection autocopy");
|
||||
@info("Patching wechat-devtools editor selection autocopy");
|
||||
|
||||
@.task.execute(@path(__dirname, "fix-selection-copy"), [], false, this.test);
|
||||
|
||||
}).then(function () {
|
||||
|
||||
@info("Patching wechat-devtools CLI supports");
|
||||
|
||||
@.task.execute(@path(__dirname, "fix-cli"), [], false, this.test);
|
||||
|
||||
}).then(function () {
|
||||
|
||||
@info("Rebuilding wechat-devtools node modules");
|
||||
|
3
tools/wechat-devtools-cli
Executable file
3
tools/wechat-devtools-cli
Executable file
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
require("../nwjs/package.nw/js/common/cli/index.js");
|
Loading…
x
Reference in New Issue
Block a user