fix: core template engine and upload params to resolve Syntax error

This commit is contained in:
yczpf2019
2026-01-24 19:37:52 +08:00
parent ec4814c208
commit ef98c5e89f
4 changed files with 313 additions and 331 deletions

View File

@@ -17,7 +17,7 @@ MString.tpl = (str, obj) => {
return str;
}
for (let key in obj) {
let re = new RegExp(`{*${key}*}`, 'gim');
let re = new RegExp(`{${key}}`, 'gm');
str = str.replace(re, obj[key]);
}
return str;

View File

@@ -14,7 +14,7 @@ export default class ShellMicroPython extends Shell {
indexPath: path.resolve(CLIENT_PATH, config.boardDirPath),
esptool: `"${PYTHON.path.cli}" "${MICROPYTHON.path.esptool}"`,
com: config.port,
baudrate: config.baudRates
baudrate: config.baudrate || "460800"
};
// 兼容性处理:移除模板中可能存在的冗余引号
let cmdTemplate = config.command || "";
@@ -29,7 +29,7 @@ export default class ShellMicroPython extends Shell {
indexPath: path.resolve(CLIENT_PATH, config.boardDirPath),
ampy: `"${PYTHON.path.cli}" "${MICROPYTHON.path.ampy}"`,
com: config.port,
reset: config.reset || ""
reset: config.reset || "[]"
};
// 兼容性处理:移除模板中可能存在的冗余引号
let cmdTemplate = config.command || "";