@lichidental/saas-cli 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,16 +30,18 @@ function authUrlFor(env, override) {
30
30
  return `${base}/cli-auth`
31
31
  }
32
32
 
33
- /** 用系统默认浏览器打开 URL(失败静默,不影响主流程) */
33
+ /** 用系统默认浏览器打开 URL(失败静默,不影响主流程);Windows 下 start 以新标签页打开,不打断已有页面 */
34
34
  function openBrowser(url) {
35
- const [cmd, args] =
36
- process.platform === "win32"
37
- ? ["cmd", ["/c", "start", "", `"${url}"`]]
38
- : process.platform === "darwin"
39
- ? ["open", [url]]
40
- : ["xdg-open", [url]]
35
+ const isWin = process.platform === "win32"
36
+ const cmd = isWin ? "cmd" : process.platform === "darwin" ? "open" : "xdg-open"
37
+ // windowsVerbatimArguments:参数原样传给 cmd,避免 node 二次转义把 URL 包成 \"...\"
38
+ const args = isWin ? ["/c", "start", '""', url.replace(/&/g, "^&")] : [url]
41
39
  try {
42
- const p = spawn(cmd, args, { stdio: "ignore", detached: true })
40
+ const p = spawn(cmd, args, {
41
+ stdio: "ignore",
42
+ detached: true,
43
+ ...(isWin ? { windowsVerbatimArguments: true } : {}),
44
+ })
43
45
  p.on("error", () => {})
44
46
  p.unref()
45
47
  } catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lichidental/saas-cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "励齿 SaaS 数据操作 CLI:新建预约、查询医生/患者/预约项目等",
5
5
  "type": "module",
6
6
  "engines": {