mirror of
https://github.com/msojocs/wechat-web-devtools-linux.git
synced 2025-07-22 00:00:04 +08:00
update
This commit is contained in:
parent
0af4372388
commit
2a6ec3cf76
@ -1,4 +1,4 @@
|
||||
{
|
||||
"version": "0.40.0",
|
||||
"url": "https://npm.taobao.org/mirrors/nwjs/v${version}/nwjs-sdk-v${version}-linux-x64.tar.gz"
|
||||
"version": "0.47.0",
|
||||
"url": "https://oss.npmmirror.com/dist/nwjs/v${version}/nwjs-sdk-v${version}-linux-x64.tar.gz"
|
||||
}
|
@ -135,6 +135,9 @@ git clone https://github.com/dragonation/wechat-devtools.git
|
||||
|
||||
# 界面截图
|
||||
|
||||
版本 1.05.2201210 (待修复bug)
|
||||

|
||||
|
||||
版本 1.03.2006090
|
||||

|
||||
|
||||
|
BIN
res/screenshots/1.05.2201210.png
Normal file
BIN
res/screenshots/1.05.2201210.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 73 KiB |
@ -38,7 +38,7 @@ const nwjs = require("../conf/nwjs.json");
|
||||
lastSize = size;
|
||||
lastTime = now;
|
||||
lastProgress = progress;
|
||||
process.stdout.write(`Downloaded ${@.fs.filename(localPath)}: ${progress.toFixed(2)}%, speed ${speed.toFixed(2)} KiB/s\r`);
|
||||
@info(`Downloaded ${@.fs.filename(localPath)}: ${progress.toFixed(2)}%, speed ${speed.toFixed(2)} KiB/s`);
|
||||
}
|
||||
},
|
||||
"onError": this.reject
|
||||
@ -70,6 +70,7 @@ const nwjs = require("../conf/nwjs.json");
|
||||
|
||||
@.fs.deleteFile.sync(@path(__dirname, "../nwjs"));
|
||||
|
||||
console.log(@path(extractPath, @.fs.listFiles(extractPath)[0].name))
|
||||
@.fs.moveFile.sync(@path(extractPath, @.fs.listFiles(extractPath)[0].name),
|
||||
@path(__dirname, "../nwjs"))
|
||||
|
||||
|
118
tools/update-nwjs-node
Normal file
118
tools/update-nwjs-node
Normal file
@ -0,0 +1,118 @@
|
||||
#!/usr/bin/env node
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const net = require('net')
|
||||
const { spawn, execSync } = require('child_process');
|
||||
const util = require('util');
|
||||
|
||||
const download = (nwjs) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
try {
|
||||
fs.mkdirSync(path.resolve(__dirname, "../cache"));
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
|
||||
let url = nwjs.url.replace('${version}', nwjs.version).replace('${version}', nwjs.version)
|
||||
|
||||
|
||||
let localPath = path.resolve(__dirname, "../cache", url.split("?")[0].split("/").slice(-1)[0]);
|
||||
|
||||
if (fs.existsSync(localPath)) {
|
||||
console.info(`Cache available ${path.basename(localPath)}`);
|
||||
resolve(localPath);
|
||||
return;
|
||||
}
|
||||
console.info(`Downloading ${url}`);
|
||||
|
||||
const wgetCMD = `wget -c ${url} -O ${localPath}.tmp`
|
||||
console.log(`执行 --- ${wgetCMD}`)
|
||||
const ls = spawn('wget', ['-c', url, '-O', `${localPath}.tmp`], { stdio: 'inherit' });
|
||||
|
||||
// ls.stdout.on('data', (data) => {
|
||||
// console.log(`stdout: ${data}`);
|
||||
// });
|
||||
|
||||
// ls.stderr.on('data', (data) => {
|
||||
// console.log(data.length)
|
||||
// process.stderr.write(data);
|
||||
// });
|
||||
|
||||
ls.on('close', (code) => {
|
||||
console.log(`child process exited with code ${code}`);
|
||||
fs.rename(`${localPath}.tmp`, localPath, err => {
|
||||
if (err) reject(err)
|
||||
else resolve(localPath)
|
||||
})
|
||||
});
|
||||
|
||||
})
|
||||
}
|
||||
const extract = function (localPath) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
console.info(`Extracting ${localPath}`);
|
||||
|
||||
let extractPath = path.resolve(__dirname, `../tmp/${path.basename(localPath)}`);
|
||||
|
||||
execSync(`rm -rf ${extractPath}`)
|
||||
|
||||
fs.mkdirSync(extractPath);
|
||||
|
||||
console.log(`执行 tar -xf ${localPath} -C ${extractPath}`)
|
||||
// v参数可输出过程
|
||||
const tarP = spawn("tar", ["-xf", localPath, "-C", extractPath], { stdio: 'inherit' });
|
||||
tarP.on('error', (err) => {
|
||||
reject(err)
|
||||
})
|
||||
tarP.on('close', (code) => {
|
||||
|
||||
console.log(`child process close all stdio with code ${code}`);
|
||||
|
||||
resolve(extractPath);
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const upgrade = function (extractPath) {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
console.info(`Upgrading ${path.basename(extractPath)}`);
|
||||
|
||||
execSync(`rm -rf ${path.resolve(__dirname, "../nwjs")}`);
|
||||
|
||||
fs.renameSync(path.resolve(extractPath, fs.readdirSync(extractPath)[0]),
|
||||
path.resolve(__dirname, "../nwjs"))
|
||||
|
||||
execSync(`rm -rf ${extractPath}`);
|
||||
|
||||
if (fs.existsSync(path.resolve(__dirname, "../node/bin/node"))) {
|
||||
fs.linkSync(path.resolve(__dirname, "../node/bin/node"), path.resolve(__dirname, "../nwjs/node"));
|
||||
fs.linkSync(path.resolve(__dirname, "../node/bin/node"), path.resolve(__dirname, "../nwjs/node.exe"));
|
||||
}
|
||||
if (!fs.existsSync(path.resolve(__dirname, "../package.nw"))) {
|
||||
fs.linkSync(path.resolve(__dirname, "../package.nw"), path.resolve(__dirname, "../nwjs/package.nw"));
|
||||
}
|
||||
|
||||
resolve();
|
||||
|
||||
})
|
||||
}
|
||||
const init = async () => {
|
||||
try {
|
||||
const nwjs = require("../conf/nwjs.json");
|
||||
const localPath = await download(nwjs)
|
||||
const extractPath = await extract(localPath)
|
||||
const result = await upgrade(extractPath)
|
||||
|
||||
console.info(`Succeeded upgrading nwjs to version ${nwjs.version}`);
|
||||
} catch (error) {
|
||||
|
||||
if (error) {
|
||||
console.error('error--->', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
init()
|
Loading…
x
Reference in New Issue
Block a user