@luxkit/cli 1.0.5 → 1.0.6

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.
Files changed (2) hide show
  1. package/dist/index.js +9 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -938,13 +938,14 @@ function getEnvConfig() {
938
938
  const eqIndex = trimmed.indexOf("=");
939
939
  if (eqIndex === -1) continue;
940
940
  const key = trimmed.slice(0, eqIndex).trim();
941
- const value = trimmed.slice(eqIndex + 1).trim();
941
+ const raw = trimmed.slice(eqIndex + 1).trim();
942
+ const value = raw.replace(/^["']|["']$/g, "");
942
943
  if (key) result[key] = value;
943
944
  }
944
945
  return result;
945
946
  }
946
947
  function setEnvConfig(data) {
947
- const lines = Object.entries(data).filter(([, v]) => v !== "").map(([k, v]) => `${k}=${v}`);
948
+ const lines = Object.entries(data).filter(([, v]) => v !== "").map(([k, v]) => `${k}="${v}"`);
948
949
  writeFile(getEnvConfigPath(), lines.join("\n") + "\n");
949
950
  }
950
951
  function clearEnvConfig() {
@@ -963,7 +964,7 @@ function handleShowEnv() {
963
964
  return;
964
965
  }
965
966
  for (const [key, value] of entries) {
966
- logger.log(`${key}=${value}`);
967
+ logger.log(`${key}="${value}"`);
967
968
  }
968
969
  }
969
970
  function registerShowCommand(program2) {
@@ -1805,14 +1806,14 @@ function registerVscodeCommand(program2) {
1805
1806
  import { spawnSync } from "child_process";
1806
1807
  var ALLOWED_KEYS = ["https_proxy", "http_proxy", "all_proxy"];
1807
1808
  function buildCommands(shell, env) {
1808
- const entries = Object.entries(env).map(([k, v]) => `${k}=${v}`);
1809
+ const entries = Object.entries(env);
1809
1810
  if (shell === "cmd") {
1810
- return entries.map((e) => `set ${e}`).join(" && ");
1811
+ return entries.map(([k, v]) => `set ${k}=${v}`).join(" && ");
1811
1812
  }
1812
1813
  if (shell === "bash") {
1813
- return entries.map((e) => `export ${e}`).join(" && ");
1814
+ return entries.map(([k, v]) => `export ${k}="${v}"`).join(" && ");
1814
1815
  }
1815
- return entries.map((e) => `$env:${e}`).join(" ; ");
1816
+ return entries.map(([k, v]) => `$env:${k}="${v}"`).join(" ; ");
1816
1817
  }
1817
1818
  function copyToClipboard(text) {
1818
1819
  const result = spawnSync("clip", [], { input: text, stdio: ["pipe", "ignore", "ignore"] });
@@ -1856,7 +1857,7 @@ function handleSet(args) {
1856
1857
  }
1857
1858
  const eqIndex = arg.indexOf("=");
1858
1859
  const key = arg.slice(0, eqIndex);
1859
- const value = arg.slice(eqIndex + 1);
1860
+ const value = arg.slice(eqIndex + 1).replace(/^["']|["']$/g, "");
1860
1861
  if (!isValidKey(key)) {
1861
1862
  logger.error(`Invalid key: "${key}". Allowed keys: ${ALLOWED_KEYS.join(", ")}`);
1862
1863
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luxkit/cli",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "One-click project formatting & VSCode config CLI",
5
5
  "type": "module",
6
6
  "bin": {