17 lines
713 B
Plaintext

#!/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);