update for 1.03.2006090

This commit is contained in:
Minun 2020-06-19 22:20:59 +08:00
parent f031ab7350
commit 0a24fcfde5
3 changed files with 49 additions and 30 deletions

View File

@ -1,19 +0,0 @@
#!/usr/bin/env mew_js
@info("Patching editor font configs");
const fontFamily = "'Mew Source SC', 'Source Code Pro', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'SF Mono', Consolas, Menlo, Monaco, 'Courier New', monospace";
let configPath = @.fs.homePath(".config/wechat_devtools/Default/Editor/User/settings.json");
let config = undefined;
if (@.fs.exists.file(configPath)) {
config = JSON.parse(@.fs.readFile.sync(configPath, "utf8"));
} else {
config = {};
}
config["editor.fontFamily"] = fontFamily;
@.fs.makeDirs(@.fs.dirname(configPath));
@.fs.writeFile.sync(configPath, JSON.stringify(config, null, 4));

View File

@ -25,6 +25,7 @@ mkdir -p "${package_dir}/node_modules_tmp"
cp -fr "${package_dir}/node_modules" "${package_dir}/node_modules_tmp/node_modules"
(cd "${package_dir}/node_modules_tmp" && npm install --registry=https://registry.npm.taobao.org) # prepare package.json and dependencies
chmod +x ${package_dir}/node_modules_tmp/node_modules/nodegit/vendor/libssh2/configure # the configure file without execute permission which will make gyp failed
(cd "${package_dir}/node_modules_tmp" && npm rebuild --registry=https://registry.npm.taobao.org) # rebuild gyp
mkdir -p "${package_dir}/node_modules/nodegit/build/Release"

View File

@ -1,8 +1,21 @@
#!/usr/bin/env mew_js
const http = require("http");
const { info } = require("console");
const url = "https://servicewechat.com/wxa-dev-logic/download_redirect?type=x64&from=mpwiki";
const urls = {
"stable": "https://developers.weixin.qq.com/miniprogram/dev/devtools/stable.html",
"rc": "https://developers.weixin.qq.com/miniprogram/dev/devtools/rc.html",
"nightly": "https://developers.weixin.qq.com/miniprogram/dev/devtools/nightly.html"
};
let branch = @.process.switches().commands[0];
if ((!branch) || (!urls[branch])) {
branch = "stable";
}
const url = urls[branch];
// "https://servicewechat.com/wxa-dev-logic/download_redirect?type=x64&from=mpwiki";
// const url = "https://servicewechat.com/wxa-dev-logic/download_redirect?type=x64&from=mpwiki&version_type=1";
// https://servicewechat.com/wxa-dev-logic/download_redirect?type=x64&from=mpwiki&download_version=1022001191&version_type=1
// https://servicewechat.com/wxa-dev-logic/download_redirect?type=x64&from=mpwiki&download_version=1021911180&version_type=1
@ -10,17 +23,47 @@ const url = "https://servicewechat.com/wxa-dev-logic/download_redirect?type=x64&
let version = undefined;
const packageDir = "$APPDATA/Tencent/微信开发者工具/package.nw";
const packageDir = "code/package.nw";
let client = @.net.httpClient();
@.async(function () {
@.fs.makeDirs(@path(__dirname, "../cache"));
@info(`Fetching wechat-dev-tool info: ${url}`);
client.request(url, {
"onSuccess": (result) => {
let links = {};
result.toString("utf8").split("<div class=\"page-inner\"")[1].split("<a href=\"").slice(1).map((a) => {
return a.split("</a>")[0];
}).filter((link) => link[0] != "#").forEach((link) => {
let content = link.split(">").slice(1).join(">").replace(/<([^>]*)>/g, "").replace(/\s+/g, "-").toLowerCase();
if ((content === "windows-64") || (content === "windows-32") || (content === "macos")) {
if (!links[content]) {
links[content] = [];
}
let url = link.split("\"")[0];
links[content].push(url);
@info(`Found ${content} link: ${url}`);
}
});
if (!links["windows-64"][0]) {
@error("No windows-64 dist found");
process.exit(1);
}
this.next(links["windows-64"][0]);
},
"onError": this.reject
})
}).then(function (url) {
@info(`Downloading ${url}`);
let localPath = @path(__dirname, "../cache/wechat-devtools-x64.exe");
let client = @.net.httpClient();
let lastSize = 0;
let lastProgress = 0;
@ -107,12 +150,6 @@ const packageDir = "$APPDATA/Tencent/微信开发者工具/package.nw";
@.task.execute(@path(__dirname, "fix-package-name"), [], false, this.test);
}).then(function () {
@info("Patching wechat-devtools editor font");
@.task.execute(@path(__dirname, "fix-editor-font"), [], false, this.test);
}).then(function () {
@info("Patching wechat-devtools editor selection autocopy");
@ -141,8 +178,8 @@ const packageDir = "$APPDATA/Tencent/微信开发者工具/package.nw";
@info("Patching wcc and wcsc");
@.fs.copyFile.sync(@path(__dirname, "../wine/wcc"), @path(__dirname, "package.nw/js/vendor/wcc"));
@.fs.copyFile.sync(@path(__dirname, "../wine/wcsc"), @path(__dirname, "package.nw/js/vendor/wcsc"));
@.fs.copyFile.sync(@path(__dirname, "../wine/wcc"), @path(__dirname, "../package.nw/js/vendor/wcc"));
@.fs.copyFile.sync(@path(__dirname, "../wine/wcsc"), @path(__dirname, "../package.nw/js/vendor/wcsc"));
this.next();